#include <bits/stdc++.h>
using namespace std;
long long D, a[(1000000 + 1000)], refun[(1000000 + 1000)], hh, n, ans;
int main() {
  scanf("%lld", &n);
  refun[0] = 1;
  for (int i = 1; i <= n; ++i) {
    refun[i] = (refun[i - 1] << 1) % (998244353);
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i < n; ++i) {
    hh = ((a[i] * (n - i + 2) % (998244353)) * refun[n - i - 1]) % (998244353);
    ans = ans + hh;
    if (ans >= (998244353)) ans -= (998244353);
  }
  ans += a[n];
  if (ans >= (998244353)) ans -= (998244353);
  cout << ans;
}
