A city has a population of 300,000.  50,000 people immigrate to the country and then 30,000 people leave.  After that 1/8 of the population gets pregnant and 1/4 of those people have twins.  How many people are there after the births?
There was a net immigration to the country of 50,000-30,000=
<gadget id="calculator">50000-30000</gadget>
<output>20_000</output>
20,000.
So the total number of people before birth is 300,000+20,000=
<gadget id="calculator">300000+20000</gadget>
<output>320_000</output>
320,000.
That means 320,000/8=
<gadget id="calculator">320000/8</gadget>
<output>40_000</output>
40,000 get pregnant.
So 40,000/4=
<gadget id="calculator">40000/4</gadget>
<output>10_000</output>
10,000 have twins.
So that means they have 10,000*2=
<gadget id="calculator">10000*2</gadget>
<output>20_000</output>
20,000 children.
There are 40,000-10,000=
<gadget id="calculator">40000-10000</gadget>
<output>30_000</output>
30,000 children from single births.
So the total number of people is 320,000+30,000+20,000=
<gadget id="calculator">320000+30000+20000</gadget>
<output>370_000</output>
370,000.

<result>370_000</result>