#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int N = 1e6 + 5;
inline long long power(long long a, long long b) {
  long long x = 1;
  a = a % mod;
  while (b) {
    if (b & 1) x = (x * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return x;
}
inline long long inv(long long a) { return power(a, mod - 2); }
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long a[N], n;
long long dp[N];
void pre() {
  dp[1] = 1;
  long long tmp = 1;
  for (int i = 2; i <= n; i++) {
    dp[i] = dp[i - 1] << 1;
    if (dp[i] > mod) dp[i] -= mod;
    dp[i] = dp[i] + tmp;
    if (dp[i] > mod) dp[i] -= mod;
    tmp = tmp << 1;
    if (tmp > mod) tmp -= mod;
  }
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  pre();
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + (dp[n + 1 - i] * a[i]) % mod);
    if (ans > mod) ans -= mod;
  }
  printf("%lld", ans);
  return 0;
}
