He spends 3*20=$<<3*20=60>>60 on the shares.

He sells 10 for 10*4=$<<10*4=40>>40.

He sells the other 20-10=<<20-10=10>>10 for a higher valuation.

Their price was 3*2=$<<3*2=6>>6.

So he got 10*6=$<<10*6=60>>60 from those.

So in total, he got 60+40=$<<60+40=100>>100.

So his profit was 100-60=$<<100-60=40>>40.

# Answer

40
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Tom buys 20 shares of a stock that costs $3 each.  He sells 10 of those shares for $4 each.  The rest of the shares end up doubling in value.  How much profit does he make?
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
40
Tom buys 20 shares of a stock that costs $3 each.  He sells 10 of those shares for $4 each.  The rest of the shares end up doubling in value.  How much profit does he make?
train