#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int MAXN = 1000010;
int get() {
  int x;
  bool f = 0;
  char c;
  while (!isdigit(c = getchar()))
    if (c == '-') f = 1;
  x = c - 48;
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - 48;
  if (f)
    return -x;
  else
    return x;
}
int N, A[MAXN];
int add(int x, int v) {
  x += v;
  if (x >= MOD) x -= MOD;
  return x;
}
int main() {
  N = get();
  for (int i = 1; i <= N; ++i) A[i] = get();
  int F = 0, G = 0, v = 0;
  for (int i = 1; i <= N; ++i) {
    v = add(1LL * v * 2 % MOD, A[i]);
    F = add(G, v);
    G = add(G, F);
  }
  cout << F << endl;
  return 0;
}
