SKS001 - Secret Recipe

no tags 

Harsh and Vishal are besties.Vishal has a secret recipe which would land both of them a job.But he his unwilling 

to share his recipe.

Both of them are standing on the positive side of x-axis.Harsh is on coordinate i and Vishal on j(i<=j).Harsh can make two kinds of moves,

if he is standing on coordinate m he could either move to m+1 or a coordinate n such that n is prime.The cost of jumping is the value of the coordinate on which Harsh jumps.

Vishal would give his recipe only if Harsh reaches him in minimum total cost.Help Harsh out.

 

Input

The first line of input contains two integers i and j (i<=j) as mentioned above.

0<=i,j<=2*10^9

Output

Output a single line containing minimum cost to reach j from i.

Example

Input:
2 4
Output:
7

hide comments
akjol2049: 2018-11-09 12:50:38

he cant move backwards..(to m-1) right?

Last edit: 2018-11-09 12:51:15
abhishak69: 2018-10-04 20:17:45

hints


Added by:Shuvam
Date:2018-07-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own