#include using namespace std; using LL = long long; using ULL = unsigned long long; constexpr LL MOD = 998244353; int dp[101][20001]; int main() { int N; cin >> N; dp[0][10000] = 1; for (int i = 1; i <= N; i++) { int A; cin >> A; for (int j = 0; j <= 20000; j++) { if (dp[i - 1][j]) { dp[i][j + A] += dp[i - 1][j]; dp[i][j - A] += dp[i - 1][j]; dp[i][j + A] %= MOD; dp[i][j - A] %= MOD; } } } LL ans = 0; for (int i = 0; i <= 20000; i++) { ans += abs(1LL * (i - 10000) * dp[N][i]); ans %= MOD; } cout << ans << endl; }