
Sum of Squares II
For a positive integer, $n$, define $g(n)$ to be the maximum perfect square that divides $n$.
For example, $g(18) = 9$, $g(19) = 1$.
Also define
For example, $S(10) = 24$ and $S(100) = 767$.
Find $S(10^{14})$. Give your answer modulo $1\,000\,000\,007$.