import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	}
}

class DFS{

	int N;
	int[] Value;
	int[] Cost;

	public void abc125_B(){

		Scanner sc=new Scanner(System.in);

		N=sc.nextInt();

		Value=new int[N];
		Cost=new int[N];

		for(int i=0;i<N;i++)	Value[i]=sc.nextInt();

		for(int i=0;i<N;i++)	Cost[i]=sc.nextInt();

		int ans=DFS_do(0,0,0);

		System.out.println(ans);

		sc.close();
	}

	public int DFS_do(int n,int value,int cost) {

		if(n==this.N) return value-cost;

		int ret0=DFS_do(n+1,value,cost);
		int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]);

		return Math.max(ret0, ret1);

	}

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

	public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	}
} Main public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	} main {

		DFS dfs=new DFS();

		dfs.abc125_B();

	} DFS dfs=new DFS(); dfs new DFS() dfs.abc125_B() dfs.abc125_B dfs String[] args args class DFS{

	int N;
	int[] Value;
	int[] Cost;

	public void abc125_B(){

		Scanner sc=new Scanner(System.in);

		N=sc.nextInt();

		Value=new int[N];
		Cost=new int[N];

		for(int i=0;i<N;i++)	Value[i]=sc.nextInt();

		for(int i=0;i<N;i++)	Cost[i]=sc.nextInt();

		int ans=DFS_do(0,0,0);

		System.out.println(ans);

		sc.close();
	}

	public int DFS_do(int n,int value,int cost) {

		if(n==this.N) return value-cost;

		int ret0=DFS_do(n+1,value,cost);
		int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]);

		return Math.max(ret0, ret1);

	}

} DFS int N; N int[] Value; Value int[] Cost; Cost public void abc125_B(){

		Scanner sc=new Scanner(System.in);

		N=sc.nextInt();

		Value=new int[N];
		Cost=new int[N];

		for(int i=0;i<N;i++)	Value[i]=sc.nextInt();

		for(int i=0;i<N;i++)	Cost[i]=sc.nextInt();

		int ans=DFS_do(0,0,0);

		System.out.println(ans);

		sc.close();
	} abc125_B {

		Scanner sc=new Scanner(System.in);

		N=sc.nextInt();

		Value=new int[N];
		Cost=new int[N];

		for(int i=0;i<N;i++)	Value[i]=sc.nextInt();

		for(int i=0;i<N;i++)	Cost[i]=sc.nextInt();

		int ans=DFS_do(0,0,0);

		System.out.println(ans);

		sc.close();
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) N=sc.nextInt() N sc.nextInt() sc.nextInt sc Value=new int[N] Value new int[N] N Cost=new int[N] Cost new int[N] N for(int i=0;i<N;i++)	Value[i]=sc.nextInt(); int i=0; int i=0; i 0 i<N i N i++ i++ i Value[i]=sc.nextInt(); Value[i]=sc.nextInt() Value[i] Value i sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++)	Cost[i]=sc.nextInt(); int i=0; int i=0; i 0 i<N i N i++ i++ i Cost[i]=sc.nextInt(); Cost[i]=sc.nextInt() Cost[i] Cost i sc.nextInt() sc.nextInt sc int ans=DFS_do(0,0,0); ans DFS_do(0,0,0) DFS_do 0 0 0 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc public int DFS_do(int n,int value,int cost) {

		if(n==this.N) return value-cost;

		int ret0=DFS_do(n+1,value,cost);
		int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]);

		return Math.max(ret0, ret1);

	} DFS_do {

		if(n==this.N) return value-cost;

		int ret0=DFS_do(n+1,value,cost);
		int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]);

		return Math.max(ret0, ret1);

	} if(n==this.N) return value-cost; n==this.N n this.N this this.N return value-cost; value-cost value cost int ret0=DFS_do(n+1,value,cost); ret0 DFS_do(n+1,value,cost) DFS_do n+1 n 1 value cost int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]); ret1 DFS_do(n+1,value+Value[n],cost+Cost[n]) DFS_do n+1 n 1 value+Value[n] value Value[n] Value n cost+Cost[n] cost Cost[n] Cost n return Math.max(ret0, ret1); Math.max(ret0, ret1) Math.max Math ret0 ret1 int n n int value value int cost cost public class Main {

	public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	}
} public class Main {

	public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		DFS dfs=new DFS();

		dfs.abc125_B();

	}
}

class DFS{

	int N;
	int[] Value;
	int[] Cost;

	public void abc125_B(){

		Scanner sc=new Scanner(System.in);

		N=sc.nextInt();

		Value=new int[N];
		Cost=new int[N];

		for(int i=0;i<N;i++)	Value[i]=sc.nextInt();

		for(int i=0;i<N;i++)	Cost[i]=sc.nextInt();

		int ans=DFS_do(0,0,0);

		System.out.println(ans);

		sc.close();
	}

	public int DFS_do(int n,int value,int cost) {

		if(n==this.N) return value-cost;

		int ret0=DFS_do(n+1,value,cost);
		int ret1=DFS_do(n+1,value+Value[n],cost+Cost[n]);

		return Math.max(ret0, ret1);

	}

}
