Problems
Moneybox
Moneybox
Given the weight of \textbf{E} is empty piggy banks and weight \textbf{F} piggy bank with coins. In the piggy bank may be the coin of \textbf{N}, for each known value of \textbf{P_i} and the weight \textbf{W_i} of a coin. Find the minimum and maximum amount of money that may be in the kitty.
\InputFile
In the first row are the number of E and F, the second - the number N, the following N lines - two numbers, \textbf{P_i} and \textbf{W_i}. \textbf{1} ≤ \textbf{E} ≤ \textbf{F} ≤ \textbf{10000}, \textbf{1} ≤ \textbf{N} ≤ \textbf{500}, \textbf{1} ≤ \textbf{P_i} ≤ \textbf{50000}, \textbf{1} ≤ \textbf{W_i} ≤ \textbf{10 000}, all numbers are integers.
\OutputFile
Two numbers are derived through the gap - minimum and maximum amounts. If the piggy bank may not have exactly the specified weight, provided that it is filled with coins given species - print "\textbf{This is impossible.}".
Input example #1
1000 1100 2 1 1 5 2
Output example #1
100 250