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