With university applications around the corner, James decides to apply for the University of Watermoo. However, in order to do that, he needs to get "gud" and do well on the Euclid Math contest hosted by said university. Thus he decides to not repeat the same mistake this year and actually study for the Euclid contest. In particular, he is currently studying primes. He knows the math but he wants to check his work. So he hires you, a slave friend to create a program that would answer his questions.
His questions are in the following form:
- Let
be defined as the smallest prime greater than or equal to . If is prime, then . Given two positive integers and , James wants to know . He also wants to know the sum of all primes from to inclusive.
Since James really wants to test his skills, he will ask your program
Note: Fast I/O is recommended for this problem. For this problem, Python users are recommended to use PyPy over CPython.
Constraints
For all subtasks:
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line will contain one integer
The next
Output Specification
Output
Sample Input
4
1 5
2 6
11 1
14 4
Sample Output
11 28
13 41
11 11
29 88
Explanation for Sample Output
For the first question,
For the second question,
For the third question,
For the last question,
Comments