#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const int mod = 998244353;
int pow2[N + 5];
int a[N + 5];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  pow2[0] = 1;
  for (int i = 1; i <= N; i++) pow2[i] = (pow2[i - 1] * 1LL * 2) % mod;
  for (int i = 1; i <= N; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += pow2[n - i - 1] * 1LL * a[i + 1] % mod;
    ans += (n - i) * 1LL * pow2[n - i - 1] % mod * a[i] % mod;
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}
