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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

} 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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

} 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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] monster = new int[N + 1];
        int[] hero = new int[N];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    } 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 long count = 0; count 0 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 for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        } {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        } if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            } monster[i] >= hero[i] monster[i] monster i hero[i] hero i {
                count += hero[i];
            } count += hero[i] count hero[i] hero i if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            } monster[i] + monster[i + 1] >= hero[i] monster[i] + monster[i + 1] monster[i] monster i monster[i + 1] monster i + 1 i 1 hero[i] hero i {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } count += hero[i] count hero[i] hero i monster[i + 1] -= (hero[i] - monster[i]) monster[i + 1] monster i + 1 i 1 (hero[i] - monster[i]) hero[i] hero i monster[i] monster i if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            } monster[i] + monster[i + 1] < hero[i] monster[i] + monster[i + 1] monster[i] monster i monster[i + 1] monster i + 1 i 1 hero[i] hero i {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            } count += monster[i] + monster[i + 1] count monster[i] + monster[i + 1] monster[i] monster i monster[i + 1] monster i + 1 i 1 monster[i + 1] = 0 monster[i + 1] monster i + 1 i 1 0 System.out.println(count) System.out.println System.out System System.out count 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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

} 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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

} 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];
        long count = 0;
        for (int i = 0; i < N + 1; i++) {
            monster[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            hero[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            if (monster[i] >= hero[i]) {
                count += hero[i];
            } else if (monster[i] + monster[i + 1] >= hero[i]) {
                count += hero[i];
                monster[i + 1] -= (hero[i] - monster[i]);
            } else if (monster[i] + monster[i + 1] < hero[i]) {
                count += monster[i] + monster[i + 1];
                monster[i + 1] = 0;
            }
        }
        System.out.println(count);

    }

}
