certain city invested the same funds to set up a paper mill and a printing factory. After two years of operation, the paper mill made a profit of 80,000 yuan, and the printing factory made a profit of 400,000 yuan. The current capital of the printing factory is three times that of the paper factory. How much is the original investment of each factory?
某市投入相同的资金兴办了一个造纸厂和一个印刷厂，投产两年后，造纸厂盈利了8万元，印刷厂盈利40万元，印刷厂现在的资金是造纸厂的3倍，这两个工厂原来的投资各是多少万元？
<gadget id="calculator">8 * 3</gadget>
<output>24</output>

<gadget id="calculator">40 - 24</gadget>
<output>16</output>

<gadget id="calculator">3 - 1</gadget>
<output>2</output>

<gadget id="calculator">16 / 2</gadget>
<output>8</output>

<result>8</result>