/** * author: ytsmash * created: 14.08.2021 13:34:43 **/ #include using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) x.begin(), x.end() const long double EPS = 1e-10; const long long INF = 1e18; const long double PI = acos(-1.0L); using P = pair; int main() { int N; vector A(N); rep(i, N) { cin >> A[i]; } int mod = 998244353; int ans = 0; for (int bit = 0; bit < (1 << N); bit++) { int B = 0; for (int i = 0; i < N; i++) { if (bit & (1 << i)) { B += A[i]; } else { B -= A[i]; } } ans += abs(B) % mod; ans %= mod; } cout << ans << "\n"; return 0; }