A polynomial f(k) of degree t whose coefficients are all integers is given as
f(k)=c0+c1k+c2k2+⋯+ctkt
For a nonnegative integer n, let S(n) be the sum of f(0),f(1),…,f(n).
S(n)=∑k=0nf(k)=f(0)+f(1)+⋯+f(n)
S(n) is a polynomial as well. Its degree is t+1 and its coefficients are rational, so it can be written as
S(n)=b0a0+b1a1n+b2a2n2+⋯+bt+1at+1nt+1
where for each i=0,1,…,t+1 the integers ai and bi are relatively prime, that is, they have no common divisor greater than 1. A coefficient that equals zero is written with ai=0 and bi=1.
Given a polynomial f(k) of degree t with integer coefficients c0,…,ct, write a program that computes S(n) and prints the value
∑i=0t+1∣ai∣
You may use the following identity for polynomials. For any positive integer d and any real x,
(x+1)d−xd=1+(1d)x+(2d)x2+⋯+(d−1d)xd−1
where (id)=i!(d−i)!d! for any integer i with 0≤i≤d.