/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <ext/random>
#include <ext/rope>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << '{';
  for (size_t i = 0; i < vec.size(); ++i) {
    os << vec[i];
    if (i != vec.size() - 1) os << ',';
  }
  os << '}';
  return os;
}
template<typename T, typename U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
// constant
constexpr int INF = std::numeric_limits<int>::max() / 2;  // 1.073741823e9
constexpr int64 INF64 = std::numeric_limits<int64>::max() / 2;  // 4.611686018427387903e18
constexpr int MOD = 1000000007;

int main(){
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n; cin >> n;
  vector<int64> a(3 * n);
  for (int i = 0; i < 3 * n; ++i) {
    cin >> a[i];
  }

  priority_queue<int64, vector<int64>, greater<int64>> pq1;
  priority_queue<int64> pq2;
  vector<int64> sum1(2 * n, 0);
  vector<int64> sum2(2 * n, 0);

  sum1[0] = a[0];
  sum2[0] = a[3 * n - 1];
  for (int i = 1; i < 2 * n; ++i) {
    sum1[i] = sum1[i - 1] + a[i];
  }
  for (int i = 1; i < 2 * n; ++i) {
    sum2[i] = sum2[i - 1] + a[3 * n - 1 - i];
  }

  vector<int64> larger(2 * n);
  vector<int64> smaller(2 * n);

  pq1.push(a[0]);
  larger[0] = a[0];
  for (int i = 1; i < n; ++i){
    pq1.push(a[i]);
    larger[i] = larger[i - 1] + a[i];
  }
  for (int i = n; i < 2 * n; ++i) {
    larger[i] = larger[i - 1] + a[i];
    pq1.push(a[i]);
    larger[i] -= pq1.top();
    pq1.pop();
  }
  pq2.push(a[3 * n - 1]);
  smaller[0] = a[3 * n - 1];
  for (int i = 1; i < n; ++i) {
    pq2.push(a[3 * n - 1 -  i]);
    smaller[i] = smaller[i - 1] + a[3 * n - 1 - i];
  }
  for (int i = n; i < 2 * n; ++i)  {
    smaller[i] = smaller[i - 1] + a[3 * n - 1 - i];
    pq2.push(a[3 * n - 1 - i]);
    smaller[i] -= pq2.top();
    pq2.pop();
  }

  int64 ans = -INF64;
  for (int i = 0; i <= n; ++i) {
    ans =  max(ans, larger[n - 1 + i] - smaller[2 * n - 1 - i]);
  }
 /*
  for (int i = n - 1; i < 2 * n; ++i) {
    cout << larger[i] << " " << smaller[i] << endl;
  }
  */
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11124