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

typedef long long ll;
constexpr ll MOD = 998244353;

ll power(ll x, ll n){
    x %= MOD;
    ll res = 1;
    while(n > 0){
        if(n&1){
            res *= x;
            res %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return res;
}

int main(){
    ll ans = 0, n;
    cin >> n;
    for(int i=0;i<n;i++){
        ll a;
        cin >> a;
        ans += a*power(a+1,i)%MOD*power(2,n-i-1)%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}
