import java.util.Scanner
import java.util.ArrayList

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)
    val N = sc.nextInt()
    var nowB : Int
    var nowA : Int
    var total : Long = 0
    var previousB : Int
    var arraylist_A = ArrayList<Int>()
    for(i in 0 until N+1){
        arraylist_A.add(sc.nextInt())
    }
    nowB = sc.nextInt()
    nowA = arraylist_A.elementAt(0)
    if(nowB >= nowA){
        total += nowA
        nowB -= nowA
    }else{
        total += nowB
        nowB = 0
    }
    previousB = nowB
    for(i in 1 until N){
        nowB = sc.nextInt()
        nowA = arraylist_A.elementAt(i)
        if(previousB >= nowA){
            total += nowA
            nowA = 0
        }else{
            total += previousB
            nowA -= previousB
        }
        if(nowB >= nowA){
            total += nowA
            nowB -= nowA
        }else{
            total += nowB
            nowB = 0
        }
        previousB = nowB
    }
    nowA = arraylist_A.elementAt(N)
    if(nowA >= previousB){
        total += previousB
    }else{
        total += nowA
    }
    println(total)
}