import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

void main(){
    int N;
    readVars(N);
    auto a = readln.split.to!(long[]);

    auto ps = new long[](N + 1);
    ps[0] = a[0 .. N].sum;

    //auto minhp = heapify!"a > b"(Array!long(a[0 .. N]));
    auto minhp = new BinaryHeap!(Array!long, "a > b")();

    foreach(i ; 0 .. N){
        minhp.insert(a[i]);
    }

    long x;

    foreach(i ; 0 .. N){
        minhp.insert(a[N + i]);
        x = minhp.front; minhp.popFront;
        ps[i + 1] = ps[i] + a[N + i] - x;
    }

    auto ss = new long[](N + 1);
    ss[0] = a[2*N .. $].sum;
    
    //auto maxhp = heapify(Array!long(a[2*N .. $]));
    auto maxhp = new BinaryHeap!(Array!long)();

    foreach(i ; 0 .. N){
        maxhp.insert(a[3*N - 1 - i]);
    }

    foreach(i ; 0 .. N){
        maxhp.insert(a[2*N - 1 - i]);
        x = maxhp.front; maxhp.popFront;
        ss[i + 1] = ss[i] + a[2*N - 1 - i] - x;
    }

    /+
    a.writeln;
    ps.writeln;
    ss.writeln;
    +/

    long ans = -(1L<<60);
    //writeln(ans);

    foreach(i ; 0 .. N + 1){
        ans = max(ans, ps[i] - ss[N - i]);
    }

    writeln(ans);

}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}