#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n, fac[1000010], f[1000010], sf[1000010], a[1000010], inv[1000010];
int qpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = (long long)ret * a % mod;
    a = (long long)a * a % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = 2ll * fac[i - 1] % mod;
  inv[0] = 1;
  inv[1] = qpow(2, mod - 2);
  for (int i = 2; i <= n; i++) inv[i] = (long long)inv[1] * inv[i - 1] % mod;
  int S = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    S = (2ll * S + a[i]) % mod;
    f[i] = (long long)inv[i] * (sf[i - 1] + S) % mod;
    sf[i] = sf[i - 1] + (long long)f[i] * fac[i] % mod;
    if (sf[i] >= mod) sf[i] -= mod;
  }
  cout << (long long)fac[n] * f[n] % mod << endl;
  return 0;
}
