import java.util.*

fun main(vararg args: String) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val monsters = IntArray(n + 1)
    repeat(n + 1) {
        monsters[it] = scanner.nextInt()
    }
    val bullets = IntArray(n)
    repeat(n) {
        bullets[it] = scanner.nextInt()
    }

    var kills = 0L
    for (i in 0 until n) {
        val m = monsters[i]
        val b = bullets[i]
        kills += Math.min(m, b)
        if (b > m) {
            val nextm = monsters[i + 1]
            val nb = b - m
            kills += Math.min(nextm, nb)
            monsters[i + 1] = Math.max(0, nextm - nb)
        }
    }
    println(kills)
}
