'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = parseInt(args[0][0], 10)
	const a = args[1].map(arg => parseInt(arg, 10))
	const b = args[2].map(arg => parseInt(arg, 10))
	let sum = 0

	for (let i = 0; i < n; i++) {
		const current = Math.min(a[i], b[i])
		sum += current
		a[i] -= current
		b[i] -= current
		const next = Math.min(a[i + 1], b[i])
		sum += next 
		a[i + 1] -= next
		b[i] -= next
	}

	console.log(sum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
