/* https://codeforces.com/contest/1196/problem/F: 2500 points!
 * F. K-th Path
 * You are given a connected undirected weighted graph consisting of n vertices and m edges. n, m <= 2.10^5
You need to print the k-th smallest shortest path in this graph (paths from the vertex to
itself are not counted, paths from i to j and from j to i are counted as one). k<=400!!
 */

/*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;

// defines
#define int long long
typedef long long ll;
#define double long double
#define vec vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define FZ(n) memset((n),0,sizeof())
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define mp make_pair
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(ALL(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
#define max3(a, b, c) max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c) min(a, b) < min(b, c) ? min(a, b) : min(b, c)

//permanent constants
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 998244353; //1e9 + 7;  const ll MOD2 = (ll)MOD * (ll)MOD;
const double PI = 2.0*acos(0.0); //acos(-1.0L);
const double EPS = static_cast<double>(1e-10);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0};
//const ll INF = (ll)(1e18 + 239);
const int BIG = (int)(1e9 + 239);

//random
mt19937 rnd(239); //(chrono::high_resolution_clock::now().time_since_epoch().count());

// lambda function: [capture list](parameters) -> return value { body }
// vector<int> v = {3, 1, 2, 1, 8};
// sort(begin(v), end(v), [] (int a, int b) { return a > b; });
// Sort indexes based on comparing values in v:  sort(ALL(idx), [&v](size_t i, size_t j) {return v[i]<v[j];});

//*********** DEBUG FUNCTION: show values of parameters ************
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
//**********************************************

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }
void input() {   }

void solve() {
	int n; cin >> n;
	vi a(n+1), b(n); FOR(i, 0, n+1) cin >> a[i]; FOR(i, 0, n) cin >> b[i];
	vi x(n+1);
	int rem = 0;
	FOR(i, 0, n) {
		b[i] += min(a[i], rem);
		x[i] = min(a[i], b[i]);
		rem = b[i] - x[i];

//		error(x[i], b[i], rem);

	}
	x[n] = min(a[n], rem);
	int sum = 0;
	FOR(i, 0, n+1) {sum += x[i];} // cout << x[i] << " ";}
//	cout << endl;

	cout << sum << endl;
}
signed main() {
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

//  int test = 0;
//  int t; cin >> t;
//  while(t--)
  {
//	  cout << "Case " << ++test << ": ";
	  solve();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 2560