#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 1010000;
const int mod = 998244353;
using namespace std;
inline void sc(long long &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
long long f[N], sum[N], g[N], h[N];
int main() {
  long long n;
  sc(n);
  for (int i = 1; i <= n; i++) sc(sum[i]), (sum[i] += sum[i - 1]) %= mod;
  for (int i = 1; i <= n; i++) {
    f[i] = (g[i - 1] + h[i - 1] + sum[i]) % mod;
    g[i] = (g[i - 1] + f[i]) % mod;
    h[i] = (h[i - 1] * 2 % mod + sum[i]) % mod;
  }
  printf("%lld\n", f[n]);
  return 0;
}
