#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void pre() {}
void solve() {}
const long long mod = 998244353;
long long pw[1000009], a[1000009];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  pre();
  pw[0] = 1;
  for (int i = 1; i <= (1000000); ++i) pw[i] = pw[i - 1] * 2 % mod;
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> a[i + 1];
  long long ans = a[n];
  for (int i = 1; i <= (n - 1); ++i) {
    ans += 1ll * pw[n - i] * a[i] % mod;
    ans += 1ll * (n - i) * a[i] % mod * pw[n - 1 - i] % mod;
  }
  cout << ans % mod;
  return 0;
}
