P28421 [洛谷] JerryC Loves Driving
提高
题目描述

Problem Background

JerryC has recently become obsessed with wild racing!!!

Problem Description

As we all know, JerryC is a crazy female. She recently bought a sports car but without a driver's license, so she can only practice driving in a secluded place.

Of course, JerryC is not going to drive normally. She first decides to drive $(B-A+1)$ segments of the road, with each segment starting from a speed of 1 and accelerating. Each second, the speed increases by 1 unit. When the speed reaches $(i+A-1)$, JerryC will reset the speed to 1 and start the next segment.

For the $i$-th segment in the $j$-th second, the joy value JerryC gains is $\lfloor \frac{i+A-1}{j} \rfloor * (-1)^j$. (JerryC just doesn't like odd numbers.)

Now, please calculate the total joy value JerryC gets in the end.

P.s.:

If the above explanation is not clear, here's a simpler version:

Given A and B, calculate the value of the following expression:

$$\sum_{i=A}^B \sum_{j=1}^{i}\lfloor \frac{i}{j} \rfloor * (-1)^j$$

Input Format

One line containing two positive integers A and B.

Output Format

One line containing an integer representing the final joy value.

Sample Input and Output

Sample Input #1

1 1

Sample Output #1

-1

Sample Input #2

2 2

Sample Output #2

-1

Sample Input #3

3 3

Sample Output #3

-3

Notes

For 50% of the test cases: $1 \leqslant A \leqslant B \leqslant 5*10^3$

For 70% of the test cases: $1 \leqslant A \leqslant B \leqslant 5*10^4$

For 100% of the test cases: $1 \leqslant A \leqslant B \leqslant 2*10^7$

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1
样例输出
-1