When x hundred units are made in a week, a factory earns revenue R(x)=12x2+40x thousand dollars and has costs C(x)=x3+13x+40 thousand dollars. The machine can make at most 6 hundred units a week, so x can take any value from 0 to 6. What is the greatest weekly profit, in thousand dollars?