#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  vector<long long> nos(N);
  for (int i = 0; i < N; i++) scanf("%lld", &nos[i]);
  reverse(nos.begin(), nos.end());
  long long int ans = nos[0], p2 = 1;
  for (int i = 1; i < nos.size(); i++) {
    long long x = nos[i];
    ans += (p2 * i % 998244353 + p2 * 2 % 998244353) * nos[i] % 998244353;
    ans %= 998244353;
    p2 = p2 * 2 % 998244353;
  }
  cout << ans << endl;
  return 0;
}
