const val mod = 998244353L
fun power(base: Long, exp: Int): Long {
    return when(exp){
        0 -> 1L
        1 -> base
        else -> power(base * base % mod, exp / 2) * power(base, exp % 2) % mod
    }
}
fun main(args: Array<String>?): Unit {
    val n = readLine()!!.trim().toInt()
    val numbers = readLine()!!.trim().split(' ').map(String::toLong)
    println(
            numbers.indices.map { i -> power(2L, n - i - 1) * numbers[i] % mod * power(numbers[i] + 1, i) % mod}.reduce { acc, l -> (acc + l) % mod }
    )
}
