#include <bits/stdc++.h>

#define __INIT_CC__ ios::sync_with_stdio(false); \
	cin.tie(0);

#ifdef __WIN32__
	char getchar_unlocked() {return getchar();}
#endif

#define FOR(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<(_t);++(_i))
#define FORN(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<=(_t);++(_i))
#define FORD(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i>=(_t);--(_i))
#define FORLL(_i,_n,_m) for(long long (_i)=(_n),_t=(_m);_i<(_t);++(_i))
#define FORNLL(_i,_n,_m) for(long long (_i)=(_n),_t=(_m);(_i)<=(_t);++(_i))
#define FORDLL(_i,_n,_m) for(long long (_i)=(_n),_t=(_m);(_i)>=(_t);--(_i))
#define FOREACH(_i,_a) for (__typeof(_a.begin()) _i=_a.begin();_i!=_a.end();++_i)
#define RESET(_a,_value) memset(_a,_value,sizeof(_a))
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define mp make_pair
#define SIZE(_a) (int)_a.size()
#define VSORT(_a) sort(_a.begin(),_a.end())
#define SSORT(_a,_val) sort(_a,_a+(_val))
#define ALL(_a) _a.begin(),_a.end()
#define mt make_tuple
#define _get(_tuple,_i) get<_i>(_tuple)
#define eb emplace_back
 
using namespace std;
 
const int dr[] = { 1, 0,-1, 0, 1, 1,-1,-1};
const int dc[] = { 0, 1, 0,-1, 1,-1,-1, 1};
const double eps = 1e-9;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef pair<double,double> pdd;
typedef vector<pdd> vpdd;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);

template <class T> T take(queue<T> &O) {T tmp=O.front();O.pop();return tmp;}
template <class T> T take(stack<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <class T> T take(priority_queue<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <class T> inline void getint(T &num)
{
	bool neg = 0;
	num = 0;
	char c;
	while ((c = getchar_unlocked()) && (!isdigit(c) && c != '-'));
	if (c == '-')
	{
		neg = 1;
		c = getchar_unlocked();
	}
	do num = num * 10 + c - '0';
	while ((c = getchar_unlocked()) && isdigit(c));
	if (neg) num = -num;
}

template <class T> inline bool inRange(T z, T a, T b){return a <= z && z <= b;}

void OPEN(string in = "input.txt",string out = "output.txt")
{
	freopen(in.c_str(), "r", stdin);
	freopen(out.c_str(), "w", stdout);
	return ;
}

//using sokokaleb's template v3.1

multiset<int> PQ[3];
ll jum[3];
int n, arr[300005];

int main(int argc, char** argv) {
	__INIT_CC__
	cin >> n;
	FORN (i, 1, n) {
		int a;
		cin >> a;
		arr[i] = a;
		jum[0] += a;
		PQ[0].insert(a);
	}
	FORN (i, 1, 2 * n) {
		int a;
		cin >> a;
		jum[1] += a;
		PQ[1].insert(a);
		arr[i + n] = a;
	}
	FORN (i, 1, n) {
		auto a = PQ[1].begin();
		PQ[1].erase(a);
		int lol = *a;
		jum[1] -= lol;
		jum[2] += lol;
		PQ[2].insert(lol);
	}

	ll ans = jum[0] - jum[2];
	FORN (i, n + 1, 2 * n) {
		auto pos = PQ[2].find(arr[i]);
		int remo = -1;
		if (pos != PQ[2].end()) {
			PQ[2].erase(pos);
			jum[2] -= arr[i];
			auto pos1 = PQ[1].begin();
			jum[2] += *pos1;
			jum[1] -= *pos1;
			PQ[2].insert(*pos1);
			PQ[1].erase(pos1);
		} else {
			auto pos1 = PQ[1].find(arr[i]);
			PQ[1].erase(pos1);
			jum[1] -= arr[i];
		}

		jum[0] += arr[i];
		PQ[0].insert(arr[i]);
		jum[0] -= *(PQ[0].begin());
		PQ[0].erase(PQ[0].begin());
		ans = max(ans, jum[0] - jum[2]);
	}

	cout << ans << "\n";
}


Measured memory_bytes: 15488