p(x)=anxn +an−1xn−1 +···+a1x+a0 If k is any integer then we can write:
p(x) = (x − k)q(x) + r
Here q(x) is called the quotient polynomial of p(x) of degree (n − 1) and r is any integer which is called the remainder.
Forexample,ifp(x)=x3−7x2+15x−8andk=3thenq(x)=x2−4x+3andr=1. Againif p(x) = x3 − 7x2 + 15x − 9 and k = 3 then q(x) = x2 − 4x + 3 and r = 0.
In this problem you have to find the quotient polynomial q(x) and the remainder r. All the input and output data will fit in 32-bit signed integer.
Input
Your program should accept an even number of lines of text. Each pair of line will represent one test case. The first line will contain an integer value for k. The second line will contain a list of integers (an,an−1,...,a0), which represent the set of co-efficient of a polynomial p(x). Here 1 ≤ n ≤ 10000. Input is terminated by