You are given a function f,:,N_0→N_0 defined as below. (N_0 denotes the set of non-negative integers.)
Find the value of f(n) modulo m.
The first line contains a single integer n.
The second line contains n+1 integers a_0,,a_1,,⋯,,a_n.
The third line contains a single integer m.
Print the value of f(n) modulo m.
As a note, the exact value of 999 has a whopping 369,693,700 digits.