The school bought a batch of books, 25% of which were allocated to the lower grades, and the rest were allocated to the middle and upper grades at a ratio of 2:3. It is known that the middle grades have 40 more books than the lower grades. How many books did the school buy in total?
学校买了一批图书，其中25%分给低年级，其余按2：3分配给中年级和高年级．已知中年级比低年级多40本，学校一共买了多少本图书？
<gadget id="calculator">25 / 100</gadget>
<output>1/4 = around 0.25</output>

<gadget id="calculator">1 - (1/4)</gadget>
<output>3/4 = around 0.75</output>

<gadget id="calculator">2 + 3</gadget>
<output>5</output>

<gadget id="calculator">2 / 5</gadget>
<output>2/5 = around 0.4</output>

<gadget id="calculator">(3/4) * (2/5)</gadget>
<output>3/10 = around 0.3</output>

<gadget id="calculator">(3/10) - (1/4)</gadget>
<output>1/20 = around 0.05</output>

<gadget id="calculator">40 / (1/20)</gadget>
<output>800</output>

<result>800</result>