/** * 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() { int N; cin >> N; const ll MOD = 998244353; vector A(N); rep(i, N) { cin >> A[i]; } /** * dp[i][j]は * A_1 ~ A_i までを用いて、 * 総和が j - 10000 になるときのBの場合の数 */ vector> dp(110, vector(21000)); dp[0][0] = 1; rep(i, N) { for (int j = 0; j <= 20000; 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; } } ll ans = 0; for (int j = 0; j <= 20000; j++) { ans += dp[N][j] * abs(j - 10000); ans %= MOD; } cout << ans << "\n"; return 0; }