#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const long long mod = 998244353;
long long fpm(long long a, long long p) {
  long long r = 1, base = a;
  while (p) {
    if (p & 1) r = r * base % mod;
    base = base * base % mod;
    p /= 2;
  }
  return r;
}
long long a[maxn], dp[maxn], s[maxn], n, inv[maxn], pw[maxn], s1[maxn],
    s2[maxn];
void init() {
  pw[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= n; i++) {
    pw[i] = pw[i - 1] * 2 % mod;
    inv[i] = fpm(pw[i], mod - 2);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    s[i] = (s[i - 1] + a[i]) % mod;
  }
  init();
  for (int i = 1; i <= n; i++) {
    dp[i] =
        (s[i] * inv[i - 1] % mod + s1[i - 1] * inv[i] % mod + s2[i - 1] % mod) %
        mod;
    s1[i] = (s1[i - 1] + dp[i] * pw[i] % mod) % mod;
    s2[i] = (s2[i - 1] + s[i] * inv[i] % mod) % mod;
  }
  cout << dp[n] * pw[n - 1] % mod << endl;
}
