import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n, m, mod = mi() a = li() ans = 1 for v in a: ans *= (pow(m, v, mod) + 1) ans %= mod print(ans)