#include <bits/stdc++.h>
using namespace std;
using namespace std;
inline int read() {
  char ch;
  bool sign = 0;
  int res = 0;
  while (!isdigit(ch = getchar()))
    if (ch == '-') sign = 1;
  while (isdigit(ch)) res = res * 10 + (ch ^ 48), ch = getchar();
  if (sign)
    return -res;
  else
    return res;
}
const int maxn = 1000000 + 10;
const long long inf = 68721573904;
const int MAXM = 3;
const int MOD[MAXM] = {469762049, 998244353, 1004535809};
const int mod = 998244353;
const int maxm = 800;
inline long long fpow(long long a, long long b) {
  long long ans(1);
  for (; b; b >>= 1, a = 1LL * a * a % mod) {
    if (b & 1) ans = 1LL * ans * a % mod;
  }
  return ans;
}
long long dp[maxn], a[maxn], b[maxn];
long long sumdp[maxn];
int n;
int main(void) {
  scanf("%d", &(n));
  long long t = fpow(2, mod - 2);
  long long now = t;
  for (auto i = (1); i <= (n); ++i) scanf("%lld", &(a[i]));
  for (auto i = (1); i <= (n); ++i) {
    (a[i] += a[i - 1]) %= mod;
    b[i] = (b[i - 1] + (now * a[i] % mod)) % mod;
    now = now * t % mod;
  }
  dp[0] = 0;
  long long fm = fpow(2, n - 1);
  fm = fpow(fm, mod - 2);
  for (auto i = (1); i <= (n); ++i) {
    long long val = ((b[i - 1] * fpow(2, i - 1) % mod) * fm % mod);
    val = (val + a[i] * fm) % mod;
    dp[i] = sumdp[i - 1] + val;
    dp[i] %= mod;
    sumdp[i] = sumdp[i - 1];
    sumdp[i] = sumdp[i - 1] + dp[i];
    sumdp[i] %= mod;
  }
  long long ans = (mod + dp[n]) * fpow(2, n - 1) % mod;
  printf("%lld\n", ans);
  return 0;
}
