#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; ++i) cin >> v[i];
  long long ans = v[n], bin = 1, k = 3;
  for (int i = n - 1; i > 0; --i) {
    ans += (((v[i] * bin) % 998244353) * k);
    ans %= 998244353;
    bin = (bin * 2) % 998244353;
    ++k;
  }
  cout << ans;
}
