/** * author: ytsmash * created: 14.08.2021 13:34:43 **/ #include using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) x.begin(), x.end() const long double EPS = 1e-10; const long long INF = 1e18; const long double PI = acos(-1.0L); using P = pair; int main() { const long long MOD = 998244353; int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector> dp(N + 1, vector(20001, 0)); dp[0][10000] = 1; for (int i = 0; i < N; i++) { for (int j = A[i]; j <= 20000 - A[i]; j++) { dp[i + 1][j - A[i]] += dp[i][j]; dp[i + 1][j - A[i]] %= MOD; dp[i + 1][j + A[i]] += dp[i][j]; dp[i + 1][j + A[i]] %= MOD; } } long long ans = 0; for (int i = 0; i <= 20000; i++) { ans += dp[N][i] * abs(i - 10000); ans %= MOD; } cout << ans << endl; return 0; }