Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
Product of Primes
Medium Accuracy: 21.15% Submissions: 4792 Points: 4

Given two numbers L and R (inclusive) find the product of primes within this range. Print the product modulo 10^9+7. If there are no primes in that range you must print 1.
 

Input
The first line of the input contains T the number of test cases.  Then T lines follow. Each test case contains one line , having two values L and which denotes the range of the numbers.

Output
For each test case print the product modulo 10^9+7 in a new line.

 

Constraints :             
1<=T<=50

1<=L,R<=10^9

0<=R-L<=10^6
 

Example

Input
 2
 1 10
 1 20


 Output : 
 210
 9699690


Explanation :

For the first test case, primes are 2,3,5,7. and their product is 2*3*5*7=210.

For the second test case primes are 2,3,5,7,11,13,17,19. and their product is  9699690.

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Product of Primes

Output Window