#include using namespace std; long long mod = 998244353; //入力が必ずmod未満の時に使う. struct mint{ long long v = 0; mint(){} mint(int a){v = a;} mint(long long a){v = a;} mint(unsigned long long a){v = a;} long long val(){return v;} void modu(){v %= mod;} mint repeat2mint(long long a,long long b){ mint ret = 1,p = a; int Log = 60; if(b <= 2e9) Log = 30; for(int i=0; i(mint b){if(v > b.v) return true; else return false;} bool operator>=(mint b){if(v >= b.v) return true; else return false;} bool operator<(mint b){if(v < b.v) return true; else return false;} bool operator<=(mint b){if(v <= b.v) return true; else return false;} mint pow(long long x){return repeat2mint(v,x);} mint inv(){return mint(1)/v;} }; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector A(N); for(auto &a : A) cin >> a; vector> dp(N+1,vector(100001)); dp.at(0).at(0) = 1; for(int i=0; i= 0){ mint sum = 0; for(int k=0; k<=100000-a1; k++){ sum += dp.at(i).at(k); dp.at(i+1).at(k) = sum; } } else{ int diff = a0-a1; mint sum = 0; for(int k=diff; k<=100000-a1; k++){ sum += dp.at(i).at(k-diff); dp.at(i+1).at(k) = sum; } } } mint answer = 0; for(auto d : dp.back()) answer += d; cout << answer.v << endl; }