#include <bits/stdc++.h>
inline void input(long long &_x) {
  _x = 0;
  long long _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x = _x * 10 + (_tc - 48), _tc = getchar();
  _x *= _tmp;
}
inline void output(long long _x) {
  if (_x == 0) {
    putchar('0');
    return;
  }
  if (_x < 0) {
    putchar('-');
    _x = -_x;
  }
  char _buff[20];
  long long _f = 0;
  while (_x > 0) {
    _buff[_f++] = _x % 10 + '0';
    _x /= 10;
  }
  for (_f -= 1; _f >= 0; _f--) putchar(_buff[_f]);
  putchar('\n');
}
using namespace std;
long long n;
long long a[3];
long long f[3];
long long b[3];
signed main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long res = (i - 1) % 2ll, cnt = i % 2ll;
    input(a[cnt]);
    if (i == 1) {
      f[cnt] = a[cnt];
      continue;
    } else if (i == 2) {
      f[cnt] = 3ll * a[1] + a[0];
      b[0] = a[1] + a[0];
      continue;
    }
    b[cnt] = 2ll * b[res] + (a[cnt] - a[res]);
    b[cnt] %= 998244353ll;
    f[cnt] = 2ll * f[res] + b[cnt];
    f[cnt] %= 998244353ll;
  }
  output(f[n % 2] % 998244353ll);
}
