#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long long N = 1e6 + 10;
const long long mod = 998244353;
long long a[N], h[N];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    a[i] = read();
  }
  h[1] = 1;
  long long p = 1;
  for (long long i = 2; i <= n; i++) {
    h[i] = (h[i - 1] * 2 + p) % mod;
    (p <<= 1) %= mod;
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    (ans += a[i] * h[n - i + 1]) %= mod;
  }
  printf("%lld\n", ans);
  return 0;
}
