#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 1e6 + 10;
template <class T>
T mymin(const T a, const T b) {
  return a < b ? a : b;
}
template <class T>
T mymax(const T a, const T b) {
  return a > b ? a : b;
}
long long ans = 0;
long long a[maxn], sum[maxn];
long long mod = 998244353;
int N;
long long fast_pow(long long a, long long b) {
  b = max(0LL, b);
  long long base = a;
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * base) % mod;
    }
    b >>= 1;
    base = (base * base) % mod;
  }
  return ans % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> a[i];
  for (int i = 1; i <= N; i++) sum[i] = (sum[i - 1] + a[i]) % mod;
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans = (ans +
           ((((N - i) * fast_pow(2, N - i - 1) % mod) + fast_pow(2, N - i)) %
            mod) *
               a[i] % mod) %
          mod;
  }
  cout << ans << endl;
  return 0;
}
