#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
int n, arr[N], dp[N], s = 0, s2 = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  dp[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    s2 *= 2;
    s2 %= 998244353;
    s2 += arr[n - i];
    s2 %= 998244353;
    dp[i] = s + s2;
    dp[i] %= 998244353;
    s += dp[i];
    s %= 998244353;
  }
  cout << dp[0] << endl;
  return 0;
}
