#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
long long qpow(long long a, long long b) {
  if (b == -1) return 0;
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % 998244353;
    a = a * a % 998244353;
    b >>= 1;
  }
  return res;
}
long long n;
long long a[1000005], ans;
signed main() {
  read(n);
  for (long long i = 1; i <= n; ++i) read(a[i]);
  for (long long i = 1; i <= n; ++i) {
    ans += a[i] * qpow(2, n - i) % 998244353;
    ans %= 998244353;
    ans += a[i] * qpow(2, n - i - 1) % 998244353 * (n - i) % 998244353;
    ans %= 998244353;
  }
  writeln(ans);
  return 0;
}
