#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(2e6) + 17;
int n;
ll MOD = 998244353ll;
ll a[MAXN], sum[MAXN], dp[MAXN];
bool read() {
  if (!(cin >> n)) return false;
  for (ll i = 0; i < (ll)(n); ++i) cin >> a[i + 1];
  return true;
}
void solve() {
  for (ll i = 0; i < (ll)(n); ++i) {
    sum[i + 1] = sum[i] + a[i + 1];
    sum[i + 1] %= MOD;
  }
  ll pref = 0, S = 0;
  for (int i = 1; i <= n; ++i) {
    dp[i] = sum[i] + S + pref;
    dp[i] %= MOD;
    pref += dp[i];
    pref %= MOD;
    S = 2ll * S + sum[i];
    S %= MOD;
  }
  cout << dp[n] << '\n';
}
int main() {
  cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');
  while (read()) solve();
  return 0;
}
