Problem list
Log in
#coci00237 · COCI 2012/2013 Contest 1

Snaga

Platinum IV 1.0 s 32 MB

Let us begin with a positive integer N and find the smallest positive integer which doesn't divide N. If we repeat the procedure with the resulting number, then again with the new result and so on, we will eventually obtain the number 2 (two). Let us define strength(N) as the length of the resulting sequence. For example, for $N = 6$ we obtain the sequence 6, 4, 3, 2 which consists of 4 numbers, thus strength(6) = 4. Given two positive integers $A < B$, calculate the sum of strengths of all integers between A and B (inclusive), that is, strength(A) + strength($A + 1$) + ... + strength(B).

Input

The first and only line of input contains two positive integers, A and B ($3 \le A < B < 10^{17}$).

Output

The first and only line of output should contain the requested sum of strengths.

Example 1

Input
3 6
Output
11

Example 2

Input
100 200
Output
262
Source
COCI 2012/2013 Contest 1
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code