#include <bits/stdc++.h>
using namespace std;
int a[1001000], dp[1001000], f[1000100], g[1010000], mi[1010000];
int main() {
  int n;
  scanf("%d", &n);
  mi[0] = 1;
  for (int i = 1; i <= n; i++) mi[i] = 1ll * mi[i - 1] * 499122177 % 998244353;
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), a[i] = (a[i] + a[i - 1]) % 998244353;
  dp[1] = a[1];
  for (int i = 2; i <= n; i++) {
    g[i] = 1ll * (g[i - 1] + dp[i - 1]) * 499122177 % 998244353;
    f[i] = (f[i - 1] + 1ll * a[i - 1] * mi[i - 1]) % 998244353;
    dp[i] = ((f[i] + g[i]) % 998244353 + 1ll * a[i] * mi[i - 1]) % 998244353;
  }
  for (int i = 1; i < n; i++) dp[n] = dp[n] * 2 % 998244353;
  printf("%d\n", dp[n]);
  return 0;
}
