import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    }
        
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    }
        
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    } 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 List<Integer> monsters = new ArrayList<>(); monsters new ArrayList<>() List<Integer> temp =  new ArrayList<>(); temp new ArrayList<>() for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        } int x=1; int x=1; x 1 x<=n+1 x n+1 n 1 x++ x++ x {
            monsters.add(Integer.parseInt(sc.next()));
        } {
            monsters.add(Integer.parseInt(sc.next()));
        } monsters.add(Integer.parseInt(sc.next())) monsters.add monsters Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        } int x=1; int x=1; x 1 x<=n x n x++ x++ x {
            temp.add(Integer.parseInt(sc.next()));
        } {
            temp.add(Integer.parseInt(sc.next()));
        } temp.add(Integer.parseInt(sc.next())) temp.add temp Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long res = 0; res 0 int a = 0; a 0 int b = monsters.get(0); b monsters.get(0) monsters.get monsters 0 int c = 0; c 0 for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        } int x=2; int x=2; x 2 x<=n+1 x n+1 n 1 x++ x++ x {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        } {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        } a = b a b b = monsters.get(x-1) b monsters.get(x-1) monsters.get monsters x-1 x 1 c = temp.get(x-2) c temp.get(x-2) temp.get temp x-2 x 2 if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            } a<c a c {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                } a+b<=c a+b a b c {
                    res = res+a+b;
                    b=0;
                } res = res+a+b res res+a+b res+a+b res a b b=0 b 0 {
                    res +=c;
                    b = b+a-c;
                } res +=c res c b = b+a-c b b+a-c b+a b a c {
                res+=c;
            } res+=c res c System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    }
        
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    }
        
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        List<Integer> monsters = new ArrayList<>();
        List<Integer> temp =  new ArrayList<>();
        for (int x=1;x<=n+1;x++) {
            monsters.add(Integer.parseInt(sc.next()));
        }
        for (int x=1;x<=n;x++) {
            temp.add(Integer.parseInt(sc.next()));
        }
        long res = 0;
        int a = 0;
        int b = monsters.get(0);
        int c = 0;
        for (int x=2;x<=n+1;x++) {
            a = b;
            b = monsters.get(x-1);
            c = temp.get(x-2);
            if (a<c) {
                if (a+b<=c) {
                    res = res+a+b;
                    b=0;
                } else {
                    res +=c;
                    b = b+a-c;
                }
            } else {
                res+=c;
            }
            
        }
        System.out.println(res);
    }
        
}
