/*  -*- coding: utf-8 -*-
 *
 * 3076.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000000;
const int MOD = 998244353;

/* typedef */

typedef long long ll;

/* global variables */

int xs[MAX_N], e2s[MAX_N + 1];

/* subroutines */

int powmod(int a, int n) {  // a^n % MOD
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (ll)pm * a % MOD;
    a = (ll)a * a % MOD;
    n >>= 1;
  }
  return pm;
}

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", xs + i);

  e2s[0] = 1;
  for (int i = 1; i <= n; i++) e2s[i] = e2s[i - 1] * 2 % MOD;

  int sum = 0;
  for (int i = 0; i < n; i++) {
    int d = (ll)xs[i] * powmod(1 + xs[i], i) % MOD * e2s[n - 1 - i] % MOD;
    sum = (sum + d) % MOD;
  }

  printf("%d\n", sum);
  return 0;
}

