#include <bits/stdc++.h>
using namespace std;
const int N = 1000001, MOD = 998244353;
const double PI = acos(-1.0);
long long n, a[N], ar[N], po[N], num[N];
long long POW(long long OH, long long b) {
  if (b == 0) return 1LL;
  long long z = POW(OH, b / 2LL);
  if (b & 1) return ((((z * z) % MOD) * OH) % MOD);
  return ((z * z) % MOD);
}
long long INV(long long OH) { return POW(OH, MOD - 2LL); }
int main() {
  po[0] = 1LL;
  for (long long i = 1LL; i < N; i++) {
    po[i] = po[i - 1] * 2LL % MOD;
  }
  scanf("%lld", &n);
  for (int i = (int)1; i <= (int)n; i++) {
    scanf("%lld", &a[i]);
  }
  ar[n] = a[n];
  for (int i = n - 1; i > 0; i--) {
    num[i] = n - i;
    ar[i] = a[i] * po[n - i] % MOD;
    ar[i] = (ar[i + 1] + ar[i]) % MOD;
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    long long tmp = po[n - i];
    long long tmp2 =
        (a[i] + (ar[1] - ar[i] + MOD) % MOD * INV(po[num[i - 1]]) % MOD) % MOD;
    tmp = (tmp * tmp2) % MOD;
    sum = (sum + tmp) % MOD;
  }
  cout << sum;
  return 0;
}
