## Sum of Squares

### Problem 745

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 $$\displaystyle S(N) = \sum_{n=1}^N g(n)$$

For example, $S(10) = 24$ and $S(100) = 767$.

Find $S(10^{14})$. Give your answer modulo $1\,000\,000\,007$.