import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	}
} import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	} int i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = parseInt(sc.next()); n parseInt(sc.next()) parseInt sc.next() sc.next sc int[] a = new int[n+1]; a new int[n+1] n+1 n 1 int[] b = new int[n]; b new int[n] n for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		} i=0; i=0 i 0 i<n+1 i n+1 n 1 i++ i++ i {
			a[i] = parseInt(sc.next());
		} {
			a[i] = parseInt(sc.next());
		} a[i] = parseInt(sc.next()) a[i] a i parseInt(sc.next()) parseInt sc.next() sc.next sc for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			b[i] = parseInt(sc.next());
		} {
			b[i] = parseInt(sc.next());
		} b[i] = parseInt(sc.next()) b[i] b i parseInt(sc.next()) parseInt sc.next() sc.next sc sc.close() sc.close sc long sum = 0; sum 0 int m=0; m 0 for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		} {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		} m = Math.min(a[i]+a[i+1],b[i]) m Math.min(a[i]+a[i+1],b[i]) Math.min Math a[i]+a[i+1] a[i] a i a[i+1] a i+1 i 1 b[i] b i sum += (long)m sum (long)m a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]) a[i+1] a i+1 i 1 Math.min(a[i]+a[i+1]-m,a[i+1]) Math.min Math a[i]+a[i+1]-m a[i]+a[i+1] a[i] a i a[i+1] a i+1 i 1 m a[i+1] a i+1 i 1 out.println(sum) out.println out sum String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	}
} Main
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		int n = parseInt(sc.next());
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(i=0;i<n+1;i++) {
			a[i] = parseInt(sc.next());
		}
		for(i=0;i<n;i++) {
			b[i] = parseInt(sc.next());
		}
		sc.close();
		long sum = 0;
		int m=0;
		for(i=0;i<n;i++) {
			m = Math.min(a[i]+a[i+1],b[i]);
			sum += (long)m;
			a[i+1] = Math.min(a[i]+a[i+1]-m,a[i+1]);
		}
		out.println(sum);
	}
}
