#include using namespace std; #define pb emplace_back #define mp make_pair using ll = long long; using pii = pair; constexpr int mod = 998244353; constexpr int inf = 0x3f3f3f3f; constexpr int N = 2e5 + 10; int n, a[N]; ll b[N]; void _main(){ cin >> n; for(int i=1; i<=n; ++i) cin >> a[i]; if(n == 1){ b[1] = 1; } else if(n == 2){ b[1] = b[2] = 3; } else { ll x = 1, y = 4, z = 5; for(int i=4; i<=n; ++i){ x = x * 2 % mod; y = (y * 2 + x) % mod; z = (z * 2 + x) % mod; } for(int i=1; i<=n; ++i){ b[i] = (y * i + z - 1ll * i * i % mod * x) % mod; if(b[i] < 0) b[i] += mod; } } ll ans = 0; for(int i=1; i<=n; ++i) ans += a[i] * b[i] % mod; cout << ans % mod << '\n'; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); _main(); return 0; }