#include <bits/stdc++.h>
using namespace std;
const int pr = 998244353;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  long long a[n + 1], dp[n + 1];
  a[0] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] += a[i - 1];
    a[i] %= pr;
  }
  for (long long i = 1, sum_a = 0, sum_dp = 0, sum_cont = 0; i <= n; ++i) {
    dp[i] = a[i] + sum_a + sum_dp;
    dp[i] %= pr;
    sum_dp += dp[i];
    sum_dp %= pr;
    if (i > 1) sum_a *= 2;
    sum_a += a[i];
    sum_a %= pr;
  }
  cout << dp[n];
  return 0;
}
