Multiply the number amount of cartridges by the number of books and add that tot he number of cartridges by the number of magazines.:
This needs to be either less than or equal tot he total cartridges she wants to use
40B + 30M ≤ 300
Do the same with pages:
200B + 80M ≤ 1200