let N = Int(readLine()!)!
var A = readLine()!.characters.split(" ").map{Int(String($0))!}
let B = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = 0
for i in 0..<N {
    let a = min(A[i], B[i])
    let b = min(A[i+1], B[i]-a)
    A[i+1] -= b
    ans += a+b
}
print(ans)