#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
int arr[N], mul[N];
int main() {
  int n;
  scanf("%d", &n);
  mul[n - 1] = 1;
  int curr = 1;
  int ans = 0;
  for (int i = n - 2; i >= 0; i--) {
    mul[i] = 2LL * mul[i + 1] % 998244353 + curr;
    mul[i] %= 998244353;
    curr = 2LL * curr % 998244353;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    ans = (ans + 1LL * arr[i] * mul[i]) % 998244353;
  }
  printf("%d", ans);
  return 0;
}
