#include <bits/stdc++.h>
using namespace std;
int a[1004000], n;
int MD = 998244353;
long long cum[1004000], pwr[1004000];
;
long long pw(int x) {
  if (x == n) return 1;
  int zb = n - x;
  long long res = 0;
  res += pwr[zb - 1] * 2;
  res %= MD;
  if (zb >= 2) res += (1ll * pwr[zb - 2] * (zb - 1)) % MD;
  res %= MD;
  return res;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  pwr[0] = 1;
  for (int i = 1; i <= n; i++) {
    cum[i] = cum[i - 1] + a[i];
    cum[i] %= MD;
    pwr[i] = pwr[i - 1] * 2;
    pwr[i] %= MD;
  }
  long long zbr = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (1ll * pw(i) * cum[i]) % MD;
    ans %= MD;
  }
  cout << ans << endl;
}
