In a school with 800 students, 5/8 of the students are girls. Seven-tenths of the girls and two-fifths of the boys are in the primary grades, while the rest are middle schoolers. How many middle schoolers are there?
There are 800 x 5/8 = 
<gadget id="calculator">800*5/8</gadget>
<output>500</output>
500 girls.
So, there are 800 - 500 = 
<gadget id="calculator">800-500</gadget>
<output>300</output>
300 boys.
There are 500 x 7/10 = 
<gadget id="calculator">500*7/10</gadget>
<output>350</output>
350 girls that are in the primary grades.
Hence, 500 - 350 = 
<gadget id="calculator">500-350</gadget>
<output>150</output>
150 girls are middle schoolers.
There are 300 x 2/5 = 
<gadget id="calculator">300*2/5</gadget>
<output>120</output>
120 boys that are in the primary grades.
Hence, 300 - 120 = 
<gadget id="calculator">300-120</gadget>
<output>180</output>
180 boy students are middle schoolers.
Therefore, a total of 150 girls + 180 boys = 
<gadget id="calculator">150+180</gadget>
<output>330</output>
330 middle schoolers.

<result>330</result>