A certain factory has several tons of coal, half of which was used up to 2 tons for the first time, and then 10 tons were bought; half was used for the second time, and then another 10 tons were bought. At this time, there are 22 tons of coal left in the factory. How much is the original coal?
某工厂有煤若干吨，第一次用去了一半多2吨，后买进10吨；第二次又用了一半，然后又买进10吨．此时，工厂还剩煤22吨，问原有煤多少吨？
<gadget id="calculator">22 - 10</gadget>
<output>12</output>

<gadget id="calculator">12 * 2</gadget>
<output>24</output>

<gadget id="calculator">24 - 10</gadget>
<output>14</output>

<gadget id="calculator">14 + 2</gadget>
<output>16</output>

<gadget id="calculator">16 * 2</gadget>
<output>32</output>

<result>32</result>