#include <bits/stdc++.h>
using namespace std;
inline int Gcd(int X, int Y) { return Y ? Gcd(Y, X % Y) : X; }
inline long long Gcd(long long X, long long Y) { return Y ? Gcd(Y, X % Y) : X; }
inline int Pow(int base, long long exp, int _mod) {
  if (!(base %= _mod)) return 0;
  int _ans = 1;
  for (; exp; exp >>= 1, base = (long long)base * base % _mod)
    exp& 1 ? _ans = (long long)_ans * base % _mod : 0;
  return _ans;
}
inline long long Pow(long long base, long long exp, long long _mod) {
  if (!(base %= _mod)) return 0;
  long long _ans = 1;
  for (; exp; exp >>= 1, base = base * base % _mod)
    exp& 1 ? _ans = _ans * base % _mod : 0;
  return _ans;
}
const int INF = 0x3f3f3f3f;
int n;
int a[1000001];
int p[1000001];
int main() {
  scanf("%d", &n);
  p[0] = 1;
  for (int i = 1; i <= (n); ++i) p[i] = p[i - 1] * 2ll % 998244353;
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  int Ans = 0;
  for (int i = 1; i <= (n); ++i) {
    Ans =
        (Ans + (long long)a[i] *
                   ((long long)(n - i) * p[n - i - 1] % 998244353 + p[n - i]) %
                   998244353) %
        998244353;
  }
  printf("%d", Ans);
  return 0;
}
