Problem #141
Complex Summation
An nth root of unity, where n is a positive integer (i.e. n = 1, 2, 3, …), is a number z satisfying the equation:
z^n = 1
An nth root of unity is primitive if it is not a kth root of unity for some smaller k:
z^k \neq 1 (k = 1,2,3,...,n-1)
Let S(n) be the sum of all the primitive nth roots of unity.
Define F(n,k) = \sum_{i=1}^{n} i^k S(i)
Enter the value of F(10^{11},10^3) mod 1000000007.