#include <bits/stdc++.h>
using namespace std;
long long n, a[1000005], ans, p = 1;
int main() {
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", a + i);
  for (int i = n - 1; i > 0; p = (p << 1) % 998244353, i--)
    ans = (ans + (n + 2 - i) * p % 998244353 * a[i] % 998244353) % 998244353;
  printf("%I64d\n", (ans + a[n]) % 998244353);
  return 0;
}
