#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#include <list>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

class Graph {
public:
	int vn;
	int sumcost = 0;
	vector<vector<pii>> g;

	Graph(int n) {
		vn = n;
		g.resize(n);
	}
	virtual void con(int a, int b, int w) = 0;
	int getWeight(int f, int t) {
		auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
		if (itr != g[f].end())
			return itr->second;
		return INT_MIN;
	}
	int Costsum() {
		return sumcost;
	}
	pii getsz(int cur, int p = -1) {
		pii ret = {1,1};//sz dep
		for (auto itr : g[cur])
			if (p != itr.first) {
				pii buf = getsz(itr.first, cur);
				ret.first += buf.first, ret.second = max(ret.second, buf.second + 1);
			}
		return ret;
	}
	void scan(int edcount, bool oindexed, bool w) {
		REP(i, edcount) {
			int a, b, c = 1;
			scanf("%d %d", &a, &b);
			if (w)scanf("%d", &c);
			con(a - oindexed, b - oindexed, c);
		}
	}
};
class BiDGraph : public Graph {//無向
public:
	BiDGraph(int n) : Graph(n) {}

	void con(int a, int b, int w = 1) {
		g[a].push_back({ b,w });
		g[b].push_back({ a, w });
		sumcost++;
	}
};
class DGraph : public Graph {//有向
public:
	DGraph(int n) : Graph(n) {}
	void con(int a, int b, int w = 1) {
		g[a].push_back({ b,w });
		sumcost++;
	}
};




signed main() {
	int n;
	ll bsum = 0,asum = 0;
	scanf("%d", &n);
	vector<ll> num(3*n);
	multiset<ll> af, afu;
	multiset<ll, greater<ll>> bf;
	REP(i, n*3) {
		scanf("%lld", &num[i]);
		if (i < n) {
			bf.insert(num[i]);
			bsum += num[i];
		}
		else
			af.insert(num[i]);
	}

	REP(i, n) {
		asum += *af.begin();

		afu.insert(*af.begin());
		af.erase(af.begin());
	}

	ll Max = LLONG_MIN;
	rep(i, n, n*3-n) {
		Max = max(Max , bsum - asum);

		int bfb = *(--bf.end());
		auto itr = af.find(num[i]);
		if (itr != af.end()) {
			af.erase(itr);
		}
		else {
			itr = afu.find(num[i]);
			asum += *af.begin()- *itr;
			afu.insert(*af.begin());
			af.erase(af.begin());
			afu.erase(itr);
		}

		if (num[i] > bfb) {
			bsum += num[i] - bfb;
			bf.erase(--bf.end());
			bf.insert(num[i]);
		}
	}
	Max = max(Max, bsum - asum);
	printf("%lld\n", Max);
	return 0;
}

Measured memory_bytes: 16640