#include using namespace std; using ll = long long; ll const m = 998244353; int main () { int N; ll A[200020]; for (int i = 0; i < N; i ++) { cin >> A[i]; } ll bi = 1; ll ans = 0; for (int i = 0; i < N; i ++) { ans -= (A[i] * (bi - 1)) % m; if (ans < 0) { ans += m; } ans += (A[N - i - 1] * (bi - 1)) % m; if (ans >= m) { ans -= m; } bi *= 2; bi %= m; } cout << ans << endl; }