#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=100010;
ll a[MAXN],b[MAXN],n,ans;
int main () {
	scanf("%d",&n);
	for (int i=1;i<=n+1;i++) {scanf("%d",&a[i]);}
	for (int i=1;i<=n;i++) {scanf("%d",&b[i]);}
	for (int i=n;i>=1;i--) {
		ans+=min(b[i],a[i+1]),b[i]-=min(b[i],a[i+1]);
		if (b[i]) {
			ll t=min(b[i],a[i]);
			ans+=t,b[i]-=t,a[i]-=t; 
		}
	}
	printf("%lld\n",ans);
}