#include <bits/stdc++.h>
using namespace std;
unsigned GCD(unsigned u, unsigned v) {
  unsigned r;
  while (v != 0) {
    r = u % v;
    u = v;
    v = r;
  }
  return u;
}
struct DSU {
  vector<long long int> deg;
  vector<long long int> par;
  long long int sum;
  DSU() {}
  DSU(long long int n) {
    deg.resize(n, 0);
    par.resize(n, -1);
    sum = n;
  }
  long long int find(long long int x) {
    if (par[x] == -1) return x;
    return par[x] = find(par[x]);
  }
  void uni(long long int x, long long int y) {
    x = find(x);
    y = find(y);
    if ((x != -1 || y != -1) && x == y) return;
    sum--;
    if (deg[x] < deg[y])
      par[x] = y;
    else {
      deg[x] += (deg[x] == deg[y]);
      par[y] = x;
    }
  }
};
long long int mod = 998244353, inf = 4e18;
long long int sum = 0;
long long int tmp3 = 0, tmp = 0, tmp2 = 0, comb = 1;
vector<long long int> arr, check, st;
long long int n, m = 0, q;
long long int maxi = 0, mini = inf;
string s2, s;
vector<set<long long int>> g;
long long int high = 0;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  cin >> n;
  arr.resize(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  vector<long long int> f(n + 1), sums(n + 1);
  f[0] = 0, sums[0] = arr[0];
  for (int i = 1; i <= n; i++) {
    if (i != n) sums[i] = (2 * sums[i - 1] - arr[i - 1] + arr[i]) % mod;
    f[i] = (2 * f[i - 1] + sums[i - 1]) % mod;
  }
  cout << f[n];
  return 0;
}
