#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <list>
#include <iomanip>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define mrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii  pair<SINT32,SINT32>
#define Pll  pair<SINT64,SINT64>
#define Piii pair<SINT32,pair<SINT32,SINT32>>
#define Plll pair<SINT64,pair<SINT64,SINT64>>


using namespace std;

int main() {

	SINT64 N;
	cin >> N;

	SINT64 ans = -INF64;

	vector<SINT64> data(N);

	priority_queue<SINT64, vector<SINT64>, greater<SINT64>> Adata;
	priority_queue<SINT64, vector<SINT64>> Bdata;

	vector<SINT64> VAdata(N+1);
	vector<SINT64> VBdata(N+1);
	
	rep(i,0,N) {
		SINT64 buf;
		cin >> buf;
		VAdata[0] += buf;
		Adata.push(buf);
	}
	rep(i,0,N) {
		cin >> data[i];
	}

	rep(i,0,N) {
		SINT64 buf;
		cin >> buf;
		VBdata[0] += buf;
		Bdata.push(buf);
	}
	
	rep(i,0,N) {
		Adata.push(data[i]);	
		VAdata[i+1] = VAdata[i] + data[i] - Adata.top();
		Adata.pop();
	}

	rep(i,0,N) {
		Bdata.push(data[N-i-1]);	
		VBdata[i+1] = VBdata[i] + data[N-i-1] - Bdata.top();
		Bdata.pop();
	}

/*
	rep(i,0,N+1) {
		cout << VAdata[i] <<  " ";
	}
	cout << endl;
	rep(i,0,N+1) {
		cout << VBdata[i] <<  " ";
	}
	cout << endl;
*/


	rep(i,0,N+1) {
		ans = MAX(ans, VAdata[i] - VBdata[N-i]);
//		cout << VAdata[i] - VBdata[N-i] << " ";
	}
//	cout << endl;

	cout << ans << endl;
	return 0;
}

//	sort(data.begin(),data.end());
//	sort(data.begin(),data.end(),std::greater<SINT32>());
//	__gcd(A,B);

//	data.emplace_back(BUF);			//後ろに追加

//  data.erase(std::unique(data.begin(), data.end()), data.end());	//ソート後に使用 同じ値を消す

//	data.insert(data.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> data(N,vector<SINT32>(3));	//2次元配列

/*
	vector<Pii> data(N);
	rep(i,0,N) {
		cin >> data[i].F;
		cin >> data[i].S;
	}
	sort(data.begin(),data.end());
*/

/*
	vector<Piii> data(N);
	rep(i,0,N) {
		cin >> data[i].F;
		cin >> data[i].S.F;
		cin >> data[i].S.S;
	}
	sort(data.begin(),data.end());
*/


// posi = lower_bound(data.begin(),data.end(), X) - data.begin();				// X以上を探す
// posi = lower_bound(data.begin(),data.end(),make_pair(X,0)) - data.begin();	//pair


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/

/*
//ワーシャルフロイド
vector<vector<SINT32>> dist(N,vector<SINT32>(N));
rep(i,0,N) {
	rep(j,0,N) {
		if (i != j) {
			dist[i][j] = INF;
		}
	}
}
rep(k,0,N) {
	rep(i,0,N) {
		rep(j,0,N) {
			dist[i][j] = MIN(dist[i][j], dist[i][k]+dist[k][j]);
		}
	}
}
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}
*/

/*
	//順列全表示
	//sortしてからでないと全列挙にならない
	sort(DATA.begin(),DATA.end());
	do {
		cout << buf << endl;
		rep(i,0,R) {
			cout << DATA[i] << " ";
		}
		cout << endl;

    } while (next_permutation(DATA.begin(),DATA.end()));
*/

//  桁指定表示
//  ans = ans * M_PI;
//	cout << setprecision(15) << ans << endl;

Measured memory_bytes: 4852