#include <bits/stdc++.h>
using namespace std;
int const N = int(1e6) + 5;
int const mod = 998244353;
int a[N];
int add[N];
int deg2[N];
void precalc(int n) {
  deg2[0] = 1;
  for (int i = 1; i <= n; ++i) {
    deg2[i] = (deg2[i - 1] * 2) % mod;
  }
  for (int i = 2; i <= n; ++i) {
    add[i] = (a[i - 1] * (long long)deg2[n - (i - 1) - 1]) % mod;
    add[i] = (add[i] + add[i - 1]) % mod;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ifstream in("input.txt");
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  precalc(n);
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    res = (res + add[i]) % mod;
    res = (res + a[i] * (long long)deg2[n - i]) % mod;
  }
  cout << res;
  return 0;
}
