#include using namespace std; struct iofast_t { iofast_t() { ios::sync_with_stdio(false); cin.tie(nullptr); } } iofast; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } template > T &chmin(T &l, T r, Compare &&f = less()) { return l = min(l, r, f); } template > T &chmax(T &l, T r, Compare &&f = less()) { return l = max(l, r, f); } #include using mint = atcoder::modint998244353; int main() { constexpr int lim = 10000; int n; cin >> n; auto a = vec(uns, n); for (auto &e : a) cin >> e; auto dp = vec(0, n + 1, lim + lim + 1); dp[0][lim + 0] = 1; for (int i = 1; i <= n; ++i) { int v = a[i - 1]; for (int j = 0; j <= lim + lim; ++j) { if (0 <= j - v) { dp[i][j] += dp[i - 1][j - v]; } if (j + v <= lim + lim) { dp[i][j] += dp[i - 1][j + v]; } } } mint ans = 0; for (int i = 0; i <= lim + lim; ++i) { ans += dp[n][i] * abs(i - lim); } cout << ans.val() << endl; }