#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; #include using mint = atcoder::modint998244353; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; constexpr int pos = 100 * 100; vector dp(pos * 2 + 1, 0); dp[pos] = 1; rep(i, n) { int a; cin >> a; vector ndp(pos * 2 + 1, 0); rep(j, pos * 2 + 1) { if (dp[j].val() == 0) continue; assert(j - a >= 0); assert(j + a <= pos * 2 + 1); ndp[j - a] += dp[j]; ndp[j + a] += dp[j]; } swap(dp, ndp); } mint ans = 0; rep(j, pos * 2 + 1) ans += abs(j - pos) * dp[j]; cout << ans.val() << '\n'; return 0; }