Expression Challenge(Dublicate) (Deleted)
Submissions: 36   Accuracy:

38.89%

  Difficulty: Basic   Marks: 1

There is a contest going on at the maths fair and you need to help Mr Geek to solve T polynomial expression given that you will be provided with the coefficients of polynomial and  with the value for which you need to evaluate the polynomial expression.

Example:
Coefficients:-  1 5  (in increasing order starting from degree 0  )
Value:-7
O/P:-36

Input:
The first line consists of T test cases. The following T lines consists of an integer N specifying the highest degree of the polynomial.
The next line contains a list of coefficients in increasing order of thier degree. The next line specifies the value V at which the expression needs to be evaluated.

Output:
Output in a single line the answer of the expression. As answers can be very large please output them modulo 109+7.

Constraints:
1<=T<=1000
1<=N<=45
0<=V<=100000

Example:
Input:

2
1
0 5
7
2
1 1 1
8

Output:
35
73

** For More Input/Output Examples Use 'Expected Output' option **

Author: Ayush Saluja


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.