OPMODULO - "Operation - Modulo"

Mahmud solved some easy math problems from SPOJ and called himself king of number theory. GodFather GodMATHer Rashad heard it and got angry, so he kidnapped Mahmud. Rashad gave him a task called "Operation - Modulo". Mahmud must solve this task, you know what will happen otherwise ;(. In the Operation - Modulo, we define a function f(n) = (n mod 1) + (n mod 2) + (n mod 3) + ... + (n mod n), where n mod x denotes the remainder when dividing n by x. Rashad interests with integers n such that f(n) = f(n - 1), so he gave Mahmud two numbers L and R, and demands him to find the sum of all integers n such that L ≤ n ≤ R and f(n) = f(n - 1).

Input

First and the only line of input contains two positive integers, L and R (1 ≤ L ≤ R ≤ 1018).

Output

Print the demanded sum in one line.

Example

Input:
1 3

Output:
3

Note: I hope you proved your solution before submitting it :)


Added by:Barish
Date:2018-03-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Deep places of my brain

hide comments
2024-07-18 09:53:45
I am getting runtime error each time Iam trying to submit it with below code. Can someone help me with this?
<snip>
[Simes]: Read the footer - Don't post source code here... but seeing as how the forum is down at the moment, what is the "return sum;" for?

Last edit: 2024-07-18 20:53:27
2024-03-25 17:19:09
Good question, but more test case would have been nice, don't listen to other comments, think and try to find solution by printing values of n, some might think it'll overflow or has to be moduled, but when u find it it's piece of cake
2023-09-05 14:04:56
worst coding learning site.....atleast give 4-5 test cases ..so that we understand exactly the expectation of the question...there is so much ambiguity in this question....as it demands the sum of all n...but in the test case output is all n+(n-1)
2022-12-05 07:58:31
can anybody tell me the answer for 1 16
is it 31 or 15?
it should be 31 but the accepted code was one that was giving output 15.
2022-11-09 15:20:45
D:\c++ code\luvQuestions\printModuloM.cpp
2022-08-27 15:00:53
look for pattern by printing values of n.
2022-08-12 03:11:27
@sachin_0001
consider precomputing
2022-03-12 09:07:14
isn't f(0) undefined? how come f(1)=f(0) holds?


Last edit: 2022-03-12 09:12:35
2022-02-08 18:50:12
I'm getting Runtime errors :(
2021-08-21 05:15:12
I found the sequence but it is showing the wrong answer on submission while i have provided custom inputs and it is working good on my test cases.
I did the mistake of taking the Modulo with 10^9+7, thinking the sum to be very large, and misinterpreting the name of the problem, thus wrong submissions many times, but now it is submitted

Last edit: 2021-08-21 05:21:22
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.