#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long a[1000010];
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  long long cur_dim = 1;
  long long cur_step = 1;
  long long prev = 0;
  for (long long i = n; i > 0; --i) {
    long long helper = (cur_step * cur_dim) % mod + mod;
    helper -= prev;
    helper %= mod;
    ans += helper * a[i - 1];
    ans %= mod;
    prev = cur_step * cur_dim;
    prev %= mod;
    cur_dim++;
    cur_step *= 2;
    cur_step %= mod;
  }
  cout << ans;
}
