#include <bits/stdc++.h>

using namespace std;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 1e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;
const long long MOD = 1e9 + 7;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(12);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(12);
//	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

int n;
ll heros[N], monsters1[N], monsters2[N], ans, a, b, c, d, e, f;
int main() {
//	INPUT();
	OUTPUT();
	cin >> n;
	for (int i = 0; i <= n; ++i) {
		cin >> monsters1[i];
		monsters2[i] = monsters1[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> heros[i];
	}
	for (int i = 0; i < n; i++) {
		a = min(monsters1[i], heros[i]);
		b = min(monsters1[i + 1], max((ll) 0, heros[i] - a));
		monsters1[i + 1] -= b;
		c += (a + b);
	}
	for (int i = 0; i < n; i++) {
		d = min(monsters2[i + 1], heros[i]);
		monsters2[i + 1] -= d;
		e = min(monsters2[i], max((ll) 0, heros[i] - d));
		f += (e + d);
	}
	cout << max(c, f);

	return 0;

}
