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