import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 998244353;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    foreach (i; 0..N-1) (A[i+1] += A[i]) %= MOD;

    long a = 1;
    long b = 0;
    long ans = 0;

    foreach_reverse (i; 0..N) {
        (ans += A[i] * a % MOD) %= MOD;
        a = a * 2 % MOD;
        if (b > 0) a += powmod(2, b-1, MOD);
        a %= MOD;
        b += 1;
    }

    ans.writeln;
}

long powmod(long a, long x, long m) {
    long ret = 1;
    while (x) {
        if (x % 2) ret = ret * a % m;
        a = a * a % m;
        x /= 2;
    }
    return ret;
}
