#include using namespace std; #if __has_include("Today's/debug.cpp") #include "Today's/debug.cpp" #else #define debug(...) #define print_line #define debugc(...) #define cerr \ if (false) cerr #endif #include using namespace atcoder; int main() { int N; cin >> N; vector A(N + 1); for (int i = 1; i <= N; i++) { cin >> A[i]; } modint998244353 ans = 0; for (int i = 1; i <= N; i++) { modint998244353 num = i == 1 ? 1 : (i + 1) * modint998244353::raw(2).pow(i - 2); ans += num * A[i] * modint998244353::raw(2).pow(max(0, N - i - 1)); } cout << ans.val() << endl; }