#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll mod = 998244353;
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    ll ans = 0;

    for(int i=0;i<n;i++){
        ll ret = modpow(2,n-i-1);
        ret *= (a[i] * modpow(a[i]+1,i))%mod;
        //cerr << ret << endl;
        ans += ret; 
        ans %= mod;
    }
    cout << ans << endl;
}
