
import java.util.Scanner;

public class 	Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class 	Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    }
} Main public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    } main {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    } final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner final long[] cities = new long[n + 1]; cities new long[n + 1] n + 1 n 1 final long[] braves = new long[n]; braves new long[n] n for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
            cities[i] = scanner.nextInt();
        } {
            cities[i] = scanner.nextInt();
        } cities[i] = scanner.nextInt() cities[i] cities i scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            braves[i] = scanner.nextInt();
        } {
            braves[i] = scanner.nextInt();
        } braves[i] = scanner.nextInt() braves[i] braves i scanner.nextInt() scanner.nextInt scanner long result = 0; result 0 for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        } {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        } if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            } braves[i] > cities[i] braves[i] braves i cities[i] cities i {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } result += cities[i] result cities[i] cities i final long rest = braves[i] - cities[i]; rest braves[i] - cities[i] braves[i] braves i cities[i] cities i if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                } rest > cities[i + 1] rest cities[i + 1] cities i + 1 i 1 {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } result += cities[i + 1] result cities[i + 1] cities i + 1 i 1 cities[i + 1] = 0 cities[i + 1] cities i + 1 i 1 0 {
                    cities[i + 1] -= rest;
                    result += rest;
                } cities[i + 1] -= rest cities[i + 1] cities i + 1 i 1 rest result += rest result rest {
                result += braves[i];
            } result += braves[i] result braves[i] braves i System.out.println(result) System.out.println System.out System System.out result String[] args args public class 	Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    }
} public class 	Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    }
} Main

import java.util.Scanner;

public class 	Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final long[] cities = new long[n + 1];
        final long[] braves = new long[n];

        for (int i = 0; i < n + 1; i++) {
            cities[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            braves[i] = scanner.nextInt();
        }

        long result = 0;
        for (int i = 0; i < n; i++) {
            if (braves[i] > cities[i]) {
                result += cities[i];
                final long rest = braves[i] - cities[i];
                if (rest > cities[i + 1]) {
                    result += cities[i + 1];
                    cities[i + 1] = 0;
                } else {
                    cities[i + 1] -= rest;
                    result += rest;
                }
            } else {
                result += braves[i];
            }
        }

        System.out.println(result);
    }
}
