The question here is vague so I'll offer a few solutions.
Option 1: You don't have to spend all the money.
Trivial solution for minimum keep all the money and buy nothing $n = 0$
Trivial solution for maximum only buy pens $m = 76$
$m+n = 76$
Option 2: You don't have to spend all the money but must buy if you can afford it.
Buy as many books as you can $28$ you have 20 dollars change so can buy one pen $n=29$
Trivial solution for maximum only buy pens $m = 76$
$m+n = 105$
Option 3: you must spend exactly 1000 dollars
Now we are looking for solutions to $13 \cdot x + 35 \cdot y = 1000$
We know that number of books must be less than 28 and not less than zero we can try them all.
Possible solutions are:
10 books and 50 pens $m = 60$
23 books and 15 pens $n = 38$
$m+n = 98$
Any other numbers of books and you are left with change.