#include <bits/stdc++.h>
using namespace std;
long long numbit(long long x) { return (1LL << x) - 1LL; }
long long getbit(long long x, long long i) { return (x >> i) & 1LL; }
long long onbit(long long x, long long i) { return x | (1LL << i); }
long long offbit(long long x, long long i) { return x & (~(1LL << i)); }
const long long maxLL = 1000000000000000001;
const long long maxInt = 1820000009;
const int Nmax = 200010;
long long tmp, res, mod, N, gt[1000001];
int main() {
  cin >> N;
  mod = 998244353;
  gt[0] = 1;
  for (long long i = (1); i <= (N); i++) gt[i] = (gt[i - 1] * 2) % mod;
  for (long long i = (1); i <= (N - 1); i++) {
    long long x;
    scanf("%lld", &x);
    tmp = ((gt[N - i - 1]) * (2 + N - i)) % mod;
    res = (res + tmp * x) % mod;
  }
  long long x;
  cin >> x;
  res = (res + x) % mod;
  cout << res;
}
