#P3636. 曲面

曲面

Description

We know that the graph of the inverse proportional function xy=axy = a is a hyperbola.

xht then wondered: what would it look like if we extend it to three dimensions?

Define the surface C(k)C(k) as the surface determined by the equation xyz=kxyz = k.

Define the aesthetic value P(k)P(k) of the surface as the sum of the squares of the Manhattan distances to the origin of all lattice points (points whose xx, yy, and zz coordinates are all integers) on C(k)C(k).

(The Manhattan distance from (x,y,z)(x, y, z) to the origin is x+y+z|x| + |y| + |z|.)

Now, xht arranges the surfaces {C(a),C(a+1),,C(b)}\{C(a), C(a+1), \dots, C(b)\} in a row. You are required to compute the sum of their aesthetic values, that is P(a)+P(a+1)++P(b)P(a) + P(a+1) + \dots + P(b), modulo 1000710007.

Input Format

One line containing two positive integers aa, bb.

Output Format

One line containing a single integer.

3 3
300
64 19260817
9932

Hint

Explanation of Sample 1:

On the surface xyz=3xyz = 3, there are 1212 lattice points: (1,1,3)(1, 1, 3), (1,3,1)(1, 3, 1), (3,1,1)(3, 1, 1), (1,1,3)(-1, -1, 3), (1,3,1)(-1, -3, 1), (3,1,1)(-3, -1, 1), (1,1,3)(1, -1, -3), (1,3,1)(1, -3, -1), (3,1,1)(3, -1, -1), (1,1,3)(-1, 1, -3), (1,3,1)(-1, 3, -1), (3,1,1)(-3, 1, -1). The sum of the squares of their Manhattan distances to the origin is 52×12=3005^2 \times 12 = 300.

Constraints:

  • For 20%20\% of the testdata, a=b100a = b \le 100.
  • For another 40%40\% of the testdata, a,b3×105a, b \le 3 \times 10^5.
  • For 100%100\% of the testdata, 1a,b3×1081 \le a, b \le 3 \times 10^8.

Translated by ChatGPT 5