import java.util.Scanner
import scala.collection.mutable.PriorityQueue

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt()
  val a = new Array[Int](3*n + 1)

  for(i <- 1 to 3*n)
    a(i) = sc.nextInt()

  val left = new Array[Long](n+1)
  val right = new Array[Long](n+1)


  // left
  left(0) = a.slice(1, n+1).sum
  val pqd = new PriorityQueue[Int]()(Ordering.Int.reverse)
  for(i <- 1 to n)
    pqd.enqueue(a(i))
  for(i <- n+1 to 2*n){
    pqd.enqueue(a(i))
    left(i-n) = left(i-n-1) + a(i) - pqd.dequeue
  }


  // right
  right(n) = a.slice(2*n+1, 3*n+1).sum
  val pqa = new PriorityQueue[Int]
  for(i <- (2*n+1 to 3*n).reverse)
    pqa.enqueue(a(i))
  for(i <- (n to 2*n-1).reverse){
    pqa.enqueue(a(i+1))
    right(i-n) = right(i-n+1) + a(i+1) - pqa.dequeue
  }


  var ans = -1e18.toLong
  for(i <- 0 to n){
    ans = Math.max(ans, left(i) - right(i))
  }

  println(ans)
}
