#include <bits/stdc++.h>
using namespace std;
static int a[1000005];
static long long p2[1000005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  p2[0] = 1;
  for (int i = 1; i < n; ++i) {
    p2[i] = (p2[i - 1] * 2) % 998244353;
  }
  long long result = 0;
  for (int i = 1; i < n; ++i) {
    result =
        (result + p2[n - i - 1] * a[i] % 998244353 * (n + 2 - i)) % 998244353;
  }
  result = (result + a[n] + 998244353) % 998244353;
  cout << result;
  return 0;
}
