#P3636. Aesthetics of 3D Surfaces
Aesthetics of 3D Surfaces
Aesthetics of 3D Surfaces
Consider the family of surfaces \(C(k)\) defined by the equation \(xyz=k\), where \(k\) is a nonzero integer. Each surface \(C(k)\) contains only those points \((x,y,z)\) with integer coordinates (i.e. lattice points) satisfying \(xyz=k\).
We define the aesthetic score \(P(k)\) of the surface \(C(k)\) as the sum of the squares of the Manhattan distances from every lattice point on \(C(k)\) to the origin. Recall that for a point \((x,y,z)\), the Manhattan distance to the origin is given by:
\[ |x|+|y|+|z| \]Thus, the aesthetic score is computed as:
\[ P(k)=\sum_{(x,y,z)\in C(k)} \Big(|x|+|y|+|z|\Big)^2 \]You are given two nonzero integers \(a\) and \(b\) (with \(a\le b\)) and a series of surfaces \(\{C(a), C(a+1), \ldots, C(b)\}\). Your task is to compute the sum:
\[ S=\sum_{k=a}^{b}P(k)\pmod{10007} \]Note: It is guaranteed that none of the values in the range \([a,b]\) is zero.
inputFormat
The input consists of two space-separated integers \(a\) and \(b\) (\(a\le b\)). It is guaranteed that none of them is zero.
outputFormat
Output a single integer, which is \(S\) modulo \(10007\).
sample
1 1
36