function Main(input) {
	input = input.split("\n");
	const N = parseInt(input[0])
	const As = input[1].split(" ").map(x => parseInt(x))
	const Bs = input[2].split(" ").map(x => parseInt(x))
	const now = As

	var count = 0
	for(i=0; i < N; i++){
		if(now[i] <= Bs[i]){
			var b = now[i]
			count += b
			if(now[i+1] <= Bs[i] - b){
				count += now[i+1]
				now[i+1] = 0
			}else{
				count += Bs[i] - b
				now[i+1] = now[i+1] - (Bs[i] - b)
			}
		}else{
			count += Bs[i]
		}
	}
	console.log(count)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));