#include <bits/stdc++.h>
using namespace std;
inline char gch() {
  static char buf[100010], *h = buf, *t = buf;
  return h == t && (t = (h = buf) + fread(buf, 1, 100000, stdin), h == t)
             ? EOF
             : *h++;
}
const int mo = 998244353;
inline void re(long long &x) {
  x = 0;
  char a;
  bool b = 0;
  while (!isdigit(a = getchar())) b = a == '-';
  while (isdigit(a)) x = (x << 1) + (x << 3) + a - '0', a = getchar();
  if (b == 1) x *= -1;
}
long long n, dp[1000010], p[1000010], a[1000010];
int main() {
  re(n);
  p[0] = 1;
  for (register int i = 1; i <= n; i++)
    re(a[i]), a[i] = a[i] + a[i - 1], a[i] %= mo, p[i] = p[i - 1] % mo * 2 % mo;
  dp[0] = 0;
  long long pri = 0;
  dp[1] = a[1];
  for (register int i = 2; i <= n; i++) {
    dp[i] = dp[i - 1];
    dp[i] = (dp[i] % mo + dp[i - 1] * 2 % mo) % mo;
    dp[i] = (dp[i] + mo - pri) % mo;
    dp[i] = (dp[i] + mo - a[i - 1]) % mo;
    dp[i] = (dp[i] + a[i]) % mo;
    pri = (pri + dp[i - 1]) % mo;
  }
  printf("%d", dp[n]);
}
