import java.io.*;
import java.util.*;
class Program{
    int N,v[], c[], arr[];
    ArrayList<Integer> sub_c = new ArrayList<Integer>();
    ArrayList<Integer> sub_v = new ArrayList<Integer>();
    ArrayList<Integer> p = new ArrayList<Integer>();
    Program(int v[], int c[], int N){
        this.v = v;
        this.c = c;
        this.N = N;
        this.arr = new int[N];
    }
    void solve(int i){
        if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        }    
    }
    int ans(){
        return Math.max(0,Collections.max(p));
    }
    int price(){
        int sum = 0;
        for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i);
        return sum;
    }
}
class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int v []= new int[N];
        int c []= new int[N];
        for(int i=0;i<N;i++) v[i] = in.nextInt();
        for(int i = 0;i<N;i++) c[i] = in.nextInt();
        Program obj = new Program(v,c,N);
        obj.solve(0); System.out.println(obj.ans());
    }
} import java.io.*; io.* java import java.util.*; util.* java class Program{
    int N,v[], c[], arr[];
    ArrayList<Integer> sub_c = new ArrayList<Integer>();
    ArrayList<Integer> sub_v = new ArrayList<Integer>();
    ArrayList<Integer> p = new ArrayList<Integer>();
    Program(int v[], int c[], int N){
        this.v = v;
        this.c = c;
        this.N = N;
        this.arr = new int[N];
    }
    void solve(int i){
        if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        }    
    }
    int ans(){
        return Math.max(0,Collections.max(p));
    }
    int price(){
        int sum = 0;
        for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i);
        return sum;
    }
} Program int N N v[] v c[] c arr[]; arr ArrayList<Integer> sub_c = new ArrayList<Integer>(); sub_c new ArrayList<Integer>() ArrayList<Integer> sub_v = new ArrayList<Integer>(); sub_v new ArrayList<Integer>() ArrayList<Integer> p = new ArrayList<Integer>(); p new ArrayList<Integer>() Program(int v[], int c[], int N){
        this.v = v;
        this.c = c;
        this.N = N;
        this.arr = new int[N];
    } Program {
        this.v = v;
        this.c = c;
        this.N = N;
        this.arr = new int[N];
    } this.v = v this.v this this.v v this.c = c this.c this this.c c this.N = N this.N this this.N N this.arr = new int[N] this.arr this this.arr new int[N] N int v[] v int c[] c int N N void solve(int i){
        if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        }    
    } solve {
        if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        }    
    } if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        } i==N i N p.add(price()) p.add p price() price {
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        } sub_c.add(c[i]) sub_c.add sub_c c[i] c i sub_v.add(v[i]) sub_v.add sub_v v[i] v i solve(i+1) solve i+1 i 1 sub_c.remove(sub_c.size()-1) sub_c.remove sub_c sub_c.size()-1 sub_c.size() sub_c.size sub_c 1 sub_v.remove(sub_v.size()-1) sub_v.remove sub_v sub_v.size()-1 sub_v.size() sub_v.size sub_v 1 solve(i+1) solve i+1 i 1 int i i int ans(){
        return Math.max(0,Collections.max(p));
    } ans {
        return Math.max(0,Collections.max(p));
    } return Math.max(0,Collections.max(p)); Math.max(0,Collections.max(p)) Math.max Math 0 Collections.max(p) Collections.max Collections p int price(){
        int sum = 0;
        for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i);
        return sum;
    } price {
        int sum = 0;
        for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i);
        return sum;
    } int sum = 0; sum 0 for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i); int i=0; int i=0; i 0 i<sub_c.size() i sub_c.size() sub_c.size sub_c i++ i++ i sum += sub_v.get(i) - sub_c.get(i); sum += sub_v.get(i) - sub_c.get(i) sum sub_v.get(i) - sub_c.get(i) sub_v.get(i) sub_v.get sub_v i sub_c.get(i) sub_c.get sub_c i return sum; sum class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int v []= new int[N];
        int c []= new int[N];
        for(int i=0;i<N;i++) v[i] = in.nextInt();
        for(int i = 0;i<N;i++) c[i] = in.nextInt();
        Program obj = new Program(v,c,N);
        obj.solve(0); System.out.println(obj.ans());
    }
} Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int v []= new int[N];
        int c []= new int[N];
        for(int i=0;i<N;i++) v[i] = in.nextInt();
        for(int i = 0;i<N;i++) c[i] = in.nextInt();
        Program obj = new Program(v,c,N);
        obj.solve(0); System.out.println(obj.ans());
    } main {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int v []= new int[N];
        int c []= new int[N];
        for(int i=0;i<N;i++) v[i] = in.nextInt();
        for(int i = 0;i<N;i++) c[i] = in.nextInt();
        Program obj = new Program(v,c,N);
        obj.solve(0); System.out.println(obj.ans());
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int v []= new int[N]; v new int[N] N int c []= new int[N]; c new int[N] N for(int i=0;i<N;i++) v[i] = in.nextInt(); int i=0; int i=0; i 0 i<N i N i++ i++ i v[i] = in.nextInt(); v[i] = in.nextInt() v[i] v i in.nextInt() in.nextInt in for(int i = 0;i<N;i++) c[i] = in.nextInt(); int i = 0; int i = 0; i 0 i<N i N i++ i++ i c[i] = in.nextInt(); c[i] = in.nextInt() c[i] c i in.nextInt() in.nextInt in Program obj = new Program(v,c,N); obj new Program(v,c,N) obj.solve(0) obj.solve obj 0 System.out.println(obj.ans()) System.out.println System.out System System.out obj.ans() obj.ans obj String[] args args
import java.io.*;
import java.util.*;
class Program{
    int N,v[], c[], arr[];
    ArrayList<Integer> sub_c = new ArrayList<Integer>();
    ArrayList<Integer> sub_v = new ArrayList<Integer>();
    ArrayList<Integer> p = new ArrayList<Integer>();
    Program(int v[], int c[], int N){
        this.v = v;
        this.c = c;
        this.N = N;
        this.arr = new int[N];
    }
    void solve(int i){
        if (i==N) p.add(price());
        else{
            sub_c.add(c[i]);
            sub_v.add(v[i]);
            solve(i+1);
            sub_c.remove(sub_c.size()-1);
            sub_v.remove(sub_v.size()-1);
            solve(i+1);
        }    
    }
    int ans(){
        return Math.max(0,Collections.max(p));
    }
    int price(){
        int sum = 0;
        for(int i=0;i<sub_c.size();i++) sum += sub_v.get(i) - sub_c.get(i);
        return sum;
    }
}
class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int v []= new int[N];
        int c []= new int[N];
        for(int i=0;i<N;i++) v[i] = in.nextInt();
        for(int i = 0;i<N;i++) c[i] = in.nextInt();
        Program obj = new Program(v,c,N);
        obj.solve(0); System.out.println(obj.ans());
    }
}