#include <bits/stdc++.h>
using namespace std;
long long pw[1000005], a[1000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n;
  cin >> n;
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = (2 * pw[i - 1]) % 998244353;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    long long p = n - i;
    long long x;
    if (p)
      x = ((p + 2) * pw[p - 1]) % 998244353;
    else
      x = 1;
    ans = (ans + (x * a[i]) % 998244353) % 998244353;
  }
  cout << ans << endl;
  return 0;
}
