import java.util.Scanner;

public class Main {
    static int[] kachi;
    static int[] cost;
    private static int result;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        kachi = new int[counter];
        cost = new int[counter];

        int maxKachi = 0;
        for (int i = 0; i < counter; i++) {
            kachi[i] = scanner.nextInt();
            maxKachi += kachi[i];
        }

        int maxCost = 0;
        for (int i = 0; i < counter; i++) {
            cost[i] = scanner.nextInt();
            maxCost += cost[i];
        }
        result = maxKachi - maxCost;

        select(0,counter,0);
        System.out.println(result);

    }

    public static void select(int index, final int counter, int tmp) {
        if (index == counter - 1) {
            if (tmp + kachi[index] - cost[index] > result) {
                result = tmp + kachi[index] - cost[index];
            }

            if (tmp > result) {
                result = tmp;
            }

            return;
        }

        select(index + 1, counter, tmp);
        select(index + 1, counter, tmp + kachi[index] - cost[index]);
    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz