#include #include using namespace std; using mint = atcoder::modint998244353; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector a(n + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; } vector p2(n + 1, 0); p2[0] = 1; for (int i = 1; i <= n; i++) { p2[i] = p2[i - 1] * 2; } mint ans = 0; for (int i = 1; i <= n; i++) { mint tmp1 = p2[i - 1]; if (i > 1) { tmp1 += (i - 1) * p2[i - 2]; } mint tmp2 = p2[n - i]; if (n - i > 0) { tmp2 += (n - i) * p2[n - i - 1]; } ans += a[i] * tmp1 * tmp2; } cout << ans.val() << endl; }