John buys twice as many red ties as blue ties.  The red ties cost 50% more than blue ties.  He spent $200 on blue ties that cost $40 each. How much did he spend on ties?
He bought 200 / 40 = 
<gadget id="calculator">200/40</gadget>
<output>5</output>
5 blue ties.
So he bought 5 * 2 = 
<gadget id="calculator">5*2</gadget>
<output>10</output>
10 red ties.
Each red tie cost $40 * .5 = $
<gadget id="calculator">40*.5</gadget>
<output>20</output>
20 more than blue ties.
So they each cost $40 + $20 = $
<gadget id="calculator">40+20</gadget>
<output>60</output>
60.
So he spent $60 * 10 = $
<gadget id="calculator">60*10</gadget>
<output>600</output>
600 on red ties.
So he spent $200 + $600 = $
<gadget id="calculator">200+600</gadget>
<output>800</output>
800 on ties.

<result>800</result>