import static java.lang.System.err; import static java.lang.System.out; import java.util.function.IntUnaryOperator; public class Main { public static void main(String[] args) { new Main(); out.flush(); err.flush(); } public Main() { try (java.util.Scanner sc = new java.util.Scanner(System.in)) { int N = sc.nextInt(); final int MOD = 998_244_353; IntUnaryOperator pow2 = x -> { long ans = 1, mul = 2; while (x != 0) { if ((x & 1) != 0) ans = ans * mul % MOD; mul = mul * mul % MOD; x >>= 1; } return (int) ans; }; long ans = 0; for (int i = 0; i < N; ++i) { long a = sc.nextInt(); ans += a * pow2.applyAsInt(i) % MOD * (pow2.applyAsInt(N - i - 1) - 1) % MOD; ans -= a * (pow2.applyAsInt(i) - 1) % MOD * pow2.applyAsInt(N - i - 1) % MOD; } ans %= MOD; ans = (ans + MOD) % MOD; out.println(ans); } } }