시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 306 | 72 | 52 | 25.616% |
You are given a function $f \, : \, \mathbb{N}_0 \to \mathbb{N}_0$ defined as below. ($\mathbb{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, \, \cdots, \, a_n$.
The third line contains a single integer $m$.
Print the value of $f(n)$ modulo $m$.
2 2 3 2 11
6
$f(0) = 2$, $f(1) = 3^2 = 9$, $f(2) = 2^9 = 512$.
The value of $512$ modulo $11$ is $6$.
As a note, the exact value of $9^{9^9}$ has a whopping $369 \, 693 \, 700$ digits.