import java.util.*;

public class Main {

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    }

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

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    }

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int monster[] = new int[n + 1]; monster new int[n + 1] n + 1 n 1 int hero[] = new int[n]; hero new int[n] n for (int i = 0; i < n + 1; i++) {
            monster[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
            monster[i] = sc.nextInt();
        } {
            monster[i] = sc.nextInt();
        } monster[i] = sc.nextInt() monster[i] monster i sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++) {
            hero[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            hero[i] = sc.nextInt();
        } {
            hero[i] = sc.nextInt();
        } hero[i] = sc.nextInt() hero[i] hero i sc.nextInt() sc.nextInt sc long ans = 0; ans 0 for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        } {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        } if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            } hero[i] <= monster[i] hero[i] hero i monster[i] monster i {
                ans += hero[i];
            } ans += hero[i] ans hero[i] hero i {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            } ans += monster[i] ans monster[i] monster i hero[i] -= monster[i] hero[i] hero i monster[i] monster i if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                } hero[i] <= monster[i + 1] hero[i] hero i monster[i + 1] monster i + 1 i 1 {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } ans += hero[i] ans hero[i] hero i monster[i + 1] -= hero[i] monster[i + 1] monster i + 1 i 1 hero[i] hero i {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                } ans += monster[i + 1] ans monster[i + 1] monster i + 1 i 1 monster[i + 1] = 0 monster[i + 1] monster i + 1 i 1 0 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    }

} public class Main {

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    }

} Main
import java.util.*;

public class Main {

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

        int n = sc.nextInt();

        int monster[] = new int[n + 1];
        int hero[] = new int[n];

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

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

        long ans = 0;

        for (int i = 0; i < n; i++) {
            if (hero[i] <= monster[i]) {
                ans += hero[i];
            } else {
                ans += monster[i];
                hero[i] -= monster[i];
                if (hero[i] <= monster[i + 1]) {
                    ans += hero[i];
                    monster[i + 1] -= hero[i];
                } else {
                    ans += monster[i + 1];
                    monster[i + 1] = 0;
                }
            }
        }

        System.out.println(ans);

        sc.close();

    }

}