#include using namespace std; using ll = long long; #include #include using namespace std; using mint = atcoder::modint998244353; class FPC{ private: int size; vector ff, fi; public: FPC(int _n = 0) : size(_n), ff(_n + 1), fi(_n + 1){ ff[0] = fi[0] = 1; for(int i = 1;i <= size;i++){ ff[i] = ff[i - 1] * i; fi[i] = ff[i].inv(); } } mint fact(int n) const{ assert(0 <= n && n <= size); return ff[n]; } mint faci(int n) const{ assert(0 <= n && n <= size); return fi[n]; } mint parm(int n, int r) const{ assert(0 <= n && n <= size); assert(0 <= r && r <= size); return ff[n] * fi[r]; } mint comb(int n, int r) const{ assert(0 <= n && n <= size); assert(0 <= r && r <= size); assert(n >= r); return ff[n] * fi[r] * fi[n - r]; } }; int N; int A[210]; int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N; for(int i = 0;i < N;i++)cin >> A[i]; int n = (int)1e5 + 1; for(int i = 0;i < N;i++){ n -= max(0, A[i] - A[i + 1]); } FPC fpc(n + N); mint ans = (n < N ? 0 : fpc.comb(n + N - 1, N)); cout << ans.val() << endl; return 0; }