#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int MAXN = 1e6 + 1;
long long pw2[MAXN], a[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  pw2[0] = 1;
  for (int i = 1; i < n; ++i) pw2[i] = (pw2[i - 1] * 1ll * 2) % MOD;
  long long cur = (pw2[n - 1] * 1ll * a[0]) % MOD;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = (ans + cur) % MOD;
    if (i < n - 1)
      cur = ((cur + MOD) - pw2[n - 2 - i] * a[i]) % MOD,
      cur = (cur + (pw2[n - 2 - i] * 1ll * a[i + 1])) % MOD;
  }
  cout << ans;
}
