import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	} main {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer 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 int idx; idx for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		} idx = 0; idx = 0 idx 0 idx < N + 1 idx N + 1 N 1 idx++ idx++ idx {
			A[idx] = Integer.parseInt(sc.next());
		} {
			A[idx] = Integer.parseInt(sc.next());
		} A[idx] = Integer.parseInt(sc.next()) A[idx] A idx Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		} idx = 0; idx = 0 idx 0 idx < N idx N idx++ idx++ idx {
			B[idx] = Integer.parseInt(sc.next());
		} {
			B[idx] = Integer.parseInt(sc.next());
		} B[idx] = Integer.parseInt(sc.next()) B[idx] B idx Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long defeated = 0; defeated 0 for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		} idx = 0; idx = 0 idx 0 idx < N idx N idx++ idx++ idx {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		} {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		} if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			} A[idx] < B[idx] A[idx] A idx B[idx] B idx {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} defeated += A[idx] defeated A[idx] A idx B[idx] = B[idx] - A[idx] B[idx] B idx B[idx] - A[idx] B[idx] B idx A[idx] A idx if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				} A[idx + 1] < B[idx] A[idx + 1] A idx + 1 idx 1 B[idx] B idx {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} defeated += A[idx + 1] defeated A[idx + 1] A idx + 1 idx 1 A[idx + 1] = 0 A[idx + 1] A idx + 1 idx 1 0 {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				} defeated += B[idx] defeated B[idx] B idx A[idx + 1] = A[idx + 1] - B[idx] A[idx + 1] A idx + 1 idx 1 A[idx + 1] - B[idx] A[idx + 1] A idx + 1 idx 1 B[idx] B idx {
				defeated += B[idx];
			} defeated += B[idx] defeated B[idx] B idx System.out.println(defeated) System.out.println System.out System System.out defeated String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] A = new int[N + 1];
		int[] B = new int[N];
		int idx;
		for (idx = 0; idx < N + 1; idx++) {
			A[idx] = Integer.parseInt(sc.next());
		}
		for (idx = 0; idx < N; idx++) {
			B[idx] = Integer.parseInt(sc.next());
		}

		long defeated = 0;
		// 勇者は手前から全力を尽くす
		for (idx = 0; idx < N; idx++) {
			// 手前の街
			if (A[idx] < B[idx]) {
				defeated += A[idx];
				B[idx] = B[idx] - A[idx];
				// 次の街
				if (A[idx + 1] < B[idx]) {
					defeated += A[idx + 1];
					A[idx + 1] = 0;
				} else {
					defeated += B[idx];
					A[idx + 1] = A[idx + 1] - B[idx];
				}
			} else {
				defeated += B[idx];
			}
		}

		System.out.println(defeated);
	}

}
