cho.sh
NotesCho Mini
Loading...

Prime Numbers

Time limit

1s

Memory limit

128 MB

Problem

Given natural numbers M and N, find all prime numbers among the natural numbers from M through N inclusive. Write a program that prints the sum of those primes and the smallest prime.

Input

The first line contains M, and the second line contains N.

M and N are natural numbers not greater than 10,000, and M is less than or equal to N.

Output

If at least one prime number exists from M through N inclusive, print their sum on the first line and the smallest prime on the second line.

If there is no prime number in the range, print only -1 on the first line.