Problem 406 -- Prime Cuts

read problem

Tips

A problem about prime numbers. First, find out all primes from 1 to 1000. There are less than 200 so that you can simply store them inside your program.

Second, read the input. Be prepared to meet some empty lines in-between data lines. Do a bit of calculation to find out the locations of the starting and ending term.

Third, print out the relevent part of your prime array.

Accepted. Cannot be easier!

 

Test Cases

Input

21 2
18 2
18 18
100 7

17 17
17 1



19 1
1 1
1 2

1000 5
2 1

Output

21 2: 5 7 11

18 2: 3 5 7 11

18 18: 1 2 3 5 7 11 13 17

100 7: 13 17 19 23 29 31 37 41 43 47 53 59 61 67

17 17: 1 2 3 5 7 11 13 17

17 1: 5 7

19 1: 7

1 1: 1

1 2: 1

1000 5: 409 419 421 431 433 439 443 449 457

2 1: 1 2