#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n;
long long a[1000010], pw[1000010], cur = 0, fans = 0;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    ((cur <<= 1) += mod + a[i] - a[i - 1]) %= mod;
    (fans += cur * pw[n - i] % mod) %= mod;
  }
  cout << fans << endl;
  return 0;
}
