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