POLEVAL  Evaluate the polynomial
Your task consists of evaluate a polynomial of degree n (0 <= n <= 999) represented by its n+1 coefficients of the form:
in each one of the k (1 <= k <= 100) points x_{1}, x_{2}, …, x_{k}. The coefficients of the polynomial and the values where they will be evaluated are integers in the interval [100, 100] that guarantees that the polynomial's evaluation is at the most 2^{63} – 1.
Input
There will be multiple test cases, each one with 4 lines that are described below
n: degree of polynomial.
c_{n} c_{n1 }… c_{2 } c_{1} c_{0}: coefficients of the polynomial separated by a single space.
k: number of points to evaluate the polynomial.
x_{1} x_{2 }…_{ } x_{k1} x_{k}: points to evaluate the polynomial separated by a single space.
The final test case is a single line where n = 1 and this case should not be processed.
Output
For each test case you should print k + 1 lines of output, the very first line containing the case number and the following k lines with the result of the polynomial's evaluation in each one of the k given points. See the sample.
Example
Input: 2
1 2 1
5
0 1 1 2 2
3
2 1 2 1
4
0 1 2 2
1
Output: Case 1:
1
2
2
1
7
Case 2:
1
0
15
9
hide comments
wrzoboo:
20180709 12:19:12
Basically unsolvable with Python3, Horner + optimization = TLE 

prabhat236218:
20171130 18:00:10
simple implement


kaushalag29:
20170518 19:51:09
AC in one GO


ajeetk_973:
20170407 11:02:35
implement horner & get AC 

nilabja16180:
20170405 09:44:40
Naive approach works fine, AC in ONE GO! 

anurag_lal1:
20170108 08:18:07
Using Naive approach got TLE but AC using Horner's method :)


rahadiankputra:
20161002 07:50:24
Simple yet very, very beautiful problem :D 

vineetpratik:
20160622 10:13:48
if you get TLE ,


Pawe³ Tarasiuk:
20160528 22:58:07
Got AC, wanted to give this task to students, but there seems to be a problem with the constraints.


ash_hacker:
20160324 12:22:05
Done with naive approach, didn't calculated each exponent individually, just multiply x progressively to get each exponent. 
Added by:  Ivan Alfonso Olamendy 
Date:  20070825 
Time limit:  0.462s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: C99 ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  My own resource 