#include #include using namespace std; using LL = long long; using P = pair; using Graph = vector>; const int INF = 1 << 29; const long long LINF = 1LL << 60; #define all(x) (x).begin(), (x).end() #define rep(i,n) for(int i = 0; i < (n); ++i) templatevoid chmin(T&a, T b){if(a > b) a = b;} templatevoid chmax(T&a, T b){if(a < b) a = b;} int main(){ int N; cin >> N; vector A(N); for(int i = 0; i < N; ++i) cin >> A[i]; vector> dp(N+1, vector(20010, false)); dp[0][A[0]+10000] = true; dp[0][-1*A[0]+10000] = true; for(int i = 0; i < N; ++i){ for(int j = 0; j < 20010; ++j){ //plus if(dp[i][j]){ if(j + A[i+1] <= 20001) dp[i+1][j+A[i+1]] = true; if(j - A[i+1] >= 0) dp[i+1][j-A[i+1]] = true; } } } long long ans = 0; for(int i = 0; i <= 20001; ++i){ if(dp[N][i]) { ans += (i - 10000); ans %= 998244353; } } cout << ans << endl; }