#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using mint = atcoder::modint998244353; int main() { fast_io(); int n; cin >> n; vector a(n); int a_sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; a_sum += a[i]; } vector dp(n + 1, vector(a_sum + 1)); dp[0][0] = 1; for (int i = 0; i < n; i++) { for (int j = 0; j <= a_sum; j++) { if (dp[i][j].val() == 0) continue; dp[i + 1][j + a[i]] += dp[i][j]; dp[i + 1][abs(j - a[i])] += dp[i][j]; } } mint ans = 0; for (int j = 0; j <= a_sum; j++) { ans += dp[n][j] * j; } cout << ans.val() << endl; }