#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
constexpr int MAX = 1000100;
constexpr int MOD = 998244353;
int a[MAX];
i64 p[MAX], q[MAX], s[MAX];
int Solve(int n) {
  p[0] = a[0];
  q[0] = a[0];
  s[0] = a[0];
  for (int i = 1; i < n; ++i) {
    q[i] = ((q[i - 1] << 1) + a[i]) % MOD;
    p[i] = (s[i - 1] + q[i]) % MOD;
    s[i] = (s[i - 1] + p[i]) % MOD;
  }
  return p[n - 1];
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i) {
      scanf("%d", &a[i]);
    }
    int ans = Solve(n);
    printf("%d\n", ans);
  }
  return 0;
}
