//#include #include #include using namespace std; //using namespace atcoder; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; int main() { ll N; cin>>N; vll A(N); rep(i,N)cin>>A[i]; vector DP(N+1,vll(40000,0)); DP[0][20000]=1; ll mod=998244353; rep(i,N){ rep(j,40000){ if(DP[i][j]>0){ DP[i+1][j+A[i]]+=DP[i][j]; DP[i+1][j-A[i]]+=DP[i][j]; DP[i+1][j+A[i]]%=mod; DP[i+1][j-A[i]]%=mod; } } } ll an=0; rep(i,40000){ ll p=DP[N][i]*abs(i-20000); p%=mod; an+=p; an%=mod; } cout<