import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
  int n = readln.chomp.to!int;
  long[] a = readln.chomp.split.map!(to!long).array;
  long left = 0;
  foreach (v; a[0..n]) {
    left += v;
  }
  long right = 0;
  foreach (v; a[n..$]) {
    right += v;
  }
  alias Node = Tuple!(long, "value", ulong, "index");
  alias MinRBT = RedBlackTree!(Node, (a, b) => a < b);
  alias MaxRBT = RedBlackTree!(Node, (a, b) => a > b);
  MinRBT minRBT = new MinRBT();
  foreach (i, v; a[0..n]) {
    minRBT.insert(Node(v, i));
  }
  MaxRBT maxRBT = new MaxRBT();
  foreach (i, v; a[n..$]) {
    maxRBT.insert(Node(v, i + n));
  }
  bool[Node] done;
  Node[] arr;
  long _right = right;
  foreach (i; 0..n) {
    Node maxNode = maxRBT.front;
    done[maxNode] = true;
    maxRBT.removeFront;
    // stderr.writeln("delete: ", maxNode);
    _right -= maxNode.value;
    arr ~= maxNode;
  }
  arr = arr.retro.array;
  // stderr.writeln = arr;
  long[] deleteRights = [_right];
  // end delenet n from right
  foreach (i; n..2*n) {
    // add i node
    Node node = Node(a[i], i);
    long last = deleteRights.back;
    if (node in done) {
      // stderr.writeln("(",i,") : ", node, " is already deleted.");
    } else {
      last += arr.front.value;
      last -= node.value;
      arr = arr[1..$];
    }
    deleteRights ~= last;
  }
  deleteRights = deleteRights.retro.array;
  // stderr.writeln = deleteRights;
  long ans = left - deleteRights.back;
  // stderr.writeln(deleteRights.back, ", ", left, ", ", deleteRights.back - left);
  foreach (i, v; deleteRights[0..n].retro.array) {
    // delete i from left
    Node minNode = minRBT.front;
    left += -minNode.value + a[i + n];
    minRBT.removeFront;
    // stderr.writeln("left: ", left, ", right: ", v);
    ans = max(ans, left - v);
  }
  ans.writeln;
}
