#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int a[1000010];
long long POW[1000010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  POW[0] = 1;
  for (int i = 1; i <= 1000000; i++) POW[i] = (POW[i - 1] << 1) % mod;
  long long ans = a[n], now;
  for (int i = 1; i < n; i++) {
    now = (n - i + 2) * 1ll * a[i] % mod * POW[n - i - 1] % mod;
    ans = (ans + now) % mod;
  }
  cout << ans << endl;
  return 0;
}
