#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int N; ll A[202020]; int main() { cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; mint ans = 0; for (int i = 1; i <= N; i++) { ans += A[i] * mint(2).pow(max(0, N - i - 1)) * ((i - 1) * mint(2).pow(max(0, i - 2)) + mint(2).pow(i - 1)); } cout << ans.val() << endl; return 0; }