#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7, mod = 998244353;
long long f[maxn], g[maxn];
int n, a[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    f[i] = (f[i - 1] * 2 % mod + g[i - 1] * 2 % mod + 1ll * a[i] +
            1ll * a[i - 1]) %
           mod;
    g[i] = (g[i - 1] * 2 % mod + a[i - 1]) % mod;
  }
  printf("%lld\n", (f[n]) % mod);
  return 0;
}
