#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100, MOD = 998244353;
int a[N], power2[N];
int n, cnt;
int sum(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
int mul(int a, int b) { return (1LL * a * b) % MOD; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  power2[0] = 1;
  for (int i = 1; i < N; i++) power2[i] = mul(2, power2[i - 1]);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cnt = a[n];
  for (int i = 1; i < n; i++) {
    int add = mul(sum(power2[n - i], mul(n - i, power2[n - i - 1])), a[i]);
    cnt = sum(cnt, add);
  }
  return cout << cnt, 0;
}
