Tony has a terrible toothache and decides to buy some painkillers from the store.  He picks up a bottle of 50 pills and takes them home.  He takes 2 pills each day three times a day for the first 2 days, before cutting this amount in half for the next 3 days.  On the sixth day, he takes a final 2 pills in the morning and ends up feeling better.  How many pills are left in the bottle?
Tony starts with 50 pills and takes 2 pills each 3 times a day, meaning he takes 2*3=6 pills in total.
Tony repeats this process for two days in total, meaning over those two days he takes 2*6= 
<gadget id="calculator">2*6</gadget>
<output>12</output>
12 pills.
Tony then cuts down his pill usage in half, meaning he's now taking 6/2= 
<gadget id="calculator">6/2</gadget>
<output>3</output>
3 pills a day.
Since he repeats this process for three days, that means he takes 3*3= 
<gadget id="calculator">3*3</gadget>
<output>9</output>
9 pills for that period.
Adding in the two pills Tony took on the final day, that means he took 12+9+2=
<gadget id="calculator">12+9+2</gadget>
<output>23</output>
23 pills.
Since there were 50 pills in the bottle to begin with, this means Tony has 50-23=
<gadget id="calculator">50-23</gadget>
<output>27</output>
27 pills remaining.

<result>27</result>