#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m;
long long a[1000005], f[1000005], S[1000005];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  f[1] = a[1];
  S[1] = a[1];
  for (i = 2; i <= n; i++) {
    f[i] = (f[i - 1] * 2 + S[i - 1] + a[i]) % 998244353;
    S[i] = (S[i - 1] * 2 + a[i]) % 998244353;
  }
  printf("%I64d", f[n]);
}
