#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
//#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define MOD 998244353
#define SIZE 1000005

int N;
ll POW[SIZE];
ll x[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

int main(){

	POW[0] = 1;
	for(int i = 1; i < SIZE; i++){

		POW[i] = POW[i-1]*2;
		POW[i] %= MOD;
	}

	scanf("%d",&N);

	for(int i = 1; i <= N; i++){

		scanf("%lld",&x[i]);
	}

	ll ans = 0;

	for(int i = 1; i <= N; i++){

		ll tmp = mod_pow(1+x[i],i-1,MOD);

		tmp *= x[i];
		tmp %= MOD;

		tmp *= POW[N-i];
		tmp %= MOD;

		ans += tmp;
		ans %= MOD;
	}

	printf("%lld\n",ans);

	return 0;
}

