#include <iostream>
#include <queue>
#include <vector>

using namespace std;

priority_queue<int, vector<int>, greater<int>> a;
priority_queue<int> b;
vector<int> c;
int main()
{
    int n, x, p, q;

    cin >> n;

    int sumA = 0;
    int sumB = 0;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.push(x);
        sumA += x;
    }
    for(int i = 0; i < n; i++){
        cin >> x;
        c.push_back(x);
    }

    for(int i = 0; i < n; i++){
        cin >> x;
        b.push(x);
        sumB += x;
    }

    int i_l = 0, i_r = n-1;

    for(int i = 0; i < n; i++){
        //cout << a.top() << "   " << b.top() << endl;
        p = c[i_l] - a.top();
        q = -(c[i_r] - b.top());

        if(p >= q){
            sumA += p;
            a.pop();
            a.push(c[i_l++]);
        }
        else{
            sumB -= q;
            b.pop();
            b.push(c[i_r--]);
        }
    }

    cout << sumA - sumB << endl;


    return 0;
}
