typedef long long ll; typedef long double ld; #include using namespace std; #define int long long const ll MOD = 998244353; signed main(){ ll n; std::cin >> n; vector a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } vector> dp(n+1,vector(20010)); dp[0][10000] = 1; for (int i = 0; i < n; i++) { for (int j = -10000; j <= 10000; j++) { if(j+10000-a[i]>=0)dp[i+1][j+10000] += dp[i][j+10000-a[i]]; if(j+10000+a[i]<=20000)dp[i+1][j+10000] += dp[i][j+10000+a[i]]; dp[i+1][j+10000]%=MOD; } } ll ans = 0; for (int i = -10000; i <= 10000; i++) { ans += (abs(i)+MOD)%MOD*dp[n][i+10000]%MOD; ans %= MOD; } std::cout << ans << std::endl; }