N = int(input()) A = list(map(int, input().split())) while N > 1: B = [sum(A[:i+1]) for i in range(N)] A = B[1:] N -= 1 print(A[0] % 998244353)