#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 998244353;
ll modpow(ll x, ll n, ll mod = MOD) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    (a[i] += a[i - 1]) %= MOD;
  }
  vector<ll> pw(n, 1);
  for (int i = 1; i < n; i++) {
    pw[i] = pw[i - 1] * 2 % MOD;
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i == n)
      (ans += a[i - 1]) %= MOD;
    else {
      (ans += 2 * a[i - 1] * pw[n - 1 - i] % MOD) %= MOD;
      if (i + 1 == n) continue;
      (ans += (n - 1 - i) * a[i - 1] % MOD * pw[n - 2 - i] % MOD) %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
