#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
inline long long rd() {
  register long long x = 0, w = 1;
  register char ch;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
long long n, a[1000010], s[1000010], an, ss, bb;
int main() {
  n = rd();
  for (int i = 1; i <= n; i++) a[i] = rd(), s[i] = (s[i - 1] + a[i]) % mod;
  for (int i = 1; i <= n; i++) {
    bb = ((bb << 1) % mod + a[i]) % mod;
    an = (ss + bb) % mod;
    ss = (ss + an) % mod;
  }
  printf("%lld\n", an);
  return 0;
}
