#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> exd_gcd(long long a, long long b) {
  if (a % b == 0) return {0, 1};
  pair<long long, long long> T = exd_gcd(b, a % b);
  return {T.second, T.first - a / b * T.second};
}
long long mul(long long x, long long y, long long mod) {
  long long ans = 0, m = abs(x), s = 0, sgn = (x > 0) xor (y > 0) ? -1 : 1;
  for (x = abs(x), y = abs(y); y; y >>= 1, m <<= 1, m = m >= mod ? m - mod : m)
    if (y & 1) s += m, s = s >= mod ? s - mod : s;
  return (s * sgn % mod + mod) % mod;
}
long long dangerous_mul(long long a, long long b, long long mod) {
  return (a * b - (long long)((long double)a * b / mod) * mod) % mod;
}
long long powmod(long long x, long long p, long long mod) {
  long long s = 1, m = x % mod;
  for (; p; m = mul(m, m, mod), p >>= 1)
    if (p & 1) s = mul(s, m, mod);
  return s;
}
vector<long long> linear_inv(long long p) {
  vector<long long> inv(p);
  inv[1] = 1;
  for (int i = 2; i < p; ++i) inv[i] = (p - p / i) * inv[p % i] % p;
  return inv;
}
long long MOD = 998244353;
long long ans = 0, S[1000001], SS = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> S[i];
  SS = S[0];
  ans = S[0];
  for (int i = 1; i < n; ++i) {
    SS -= S[i - 1];
    SS = SS * 2 % MOD;
    SS += S[i - 1];
    SS += S[i];
    SS %= MOD;
    ans = (2 * ans + SS) % MOD;
  }
  cout << (ans + MOD) % MOD << '\n';
}
