using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();

            var firstSum = new long[N + 1];
            firstSum[0] = Ai.Take((int)N).Sum();
            var segFirst = new SegmentTree<long>((int)N, Min, long.MaxValue);
            for (var i = 0; i < N; ++i)
                segFirst.set(i, Ai[i]);
            segFirst.build();
            for (var i = 0; i < N; ++i)
            {
                var minIdx = segFirst.index();
                var min = segFirst[minIdx];
                firstSum[i + 1] = firstSum[i];
                if (min < Ai[N + i])
                {
                    firstSum[i + 1] += Ai[N + i] - min;
                    segFirst.update(minIdx, Ai[N + i]);
                }
            }

            var lastSum = new long[N + 1];
            lastSum[0] = Ai.Skip((int)N * 2).Sum();
            var segLast = new SegmentTree<long>((int)N, Max, long.MinValue);
            for (var i = 0; i < N; ++i)
                segLast.set(i, Ai[2 * N + i]);
            segLast.build();
            for (var i = 0; i < N; ++i)
            {
                var maxIdx = segLast.index();
                var max = segLast[maxIdx];
                lastSum[i + 1] = lastSum[i];
                if (Ai[2 * N - 1 - i] < max)
                {
                    lastSum[i + 1] -= max - Ai[2 * N - 1 - i];
                    segLast.update(maxIdx, Ai[2 * N - 1 - i]);
                }
            }
            var maxDiff = firstSum[N] - lastSum[0];
            for (var i = 0; i <= N; ++i)
                maxDiff = Max(maxDiff, firstSum[N - i] - lastSum[i]);
            WriteLine(maxDiff);
        }
        class SegmentTree<Monoid> where Monoid : IEquatable<Monoid>
        {
            int sz;
            Monoid[] seg;
            readonly Func<Monoid, Monoid, Monoid> f;
            readonly Monoid M1;
            //var st = new SegmentTree<long>(N, Math.Min, (2L << 30) - 1);みたいな書き方
            //数、操作、初期値
            public SegmentTree(int n, Func<Monoid, Monoid, Monoid> f, Monoid M1)
            {
                this.f = f;
                this.M1 = M1;
                sz = 1;
                while (sz < n) sz <<= 1;
                seg = new int[sz * 2].Select(_ => M1).ToArray();
            }
            public void set(int k, Monoid x) => seg[k + sz] = x;
            public void build()
            {
                for (int k = sz - 1; 0 < k; --k)
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            public void update(int k, Monoid x)
            {
                k += sz;
                seg[k] = x;
                while (0 != (k >>= 1))
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            //区間[a,b)に対して
            public Monoid query(int a, int b)
            {
                Monoid L = M1, R = M1;
                for (a += sz, b += sz; a < b; a >>= 1, b >>= 1)
                {
                    if (0 != (a & 1)) L = f(L, seg[a++]);
                    if (0 != (b & 1)) R = f(seg[--b], R);
                }
                return f(L, R);
            }
            public int index()
            {
                var k = 1;
                var t = seg[k];
                while (k < sz)
                {
                    k *= 2;
                    if (t.Equals(seg[k + 0])) k = k + 0;
                    else k = k + 1;
                }
                return k - sz;
            }
            public Monoid this[int k] => seg[k + sz];
        }
    }
}

Measured memory_bytes: 62996