#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && (c != '-'))
    ;
  if (c == '-') {
    nega = 1;
    c = getchar();
  }
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
  if (nega) x = -x;
}
template <typename T>
inline void writep(T x) {
  if (x > 9) writep(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  writep(x);
}
template <typename T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
const long long base = 998244353;
int n;
long long a[1000001];
long long p2[1000001];
int main() {
  read(n);
  for (int i = (1); i <= (n); i++) read(a[i]);
  p2[0] = 1;
  for (int i = (1); i <= (n); i++) p2[i] = (p2[i - 1] * 2) % base;
  long long ans = 0;
  for (int i = (1); i < (n); i++)
    ans += ((a[i] * p2[n - i - 1]) % base * (n - i + 2)) % base;
  ans += a[n];
  ans = (ans + base) % base;
  writeln(ans);
}
