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