using AtcoderBeginnerContest160.Questions;
using AtcoderBeginnerContest160.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtcoderBeginnerContest160.Questions
{
    public class QuestionE : AtCoderQuestionBase
    {
        enum Color
        {
            Red = 0,
            Green = 1,
            None = 2
        }

        struct Apple : IComparable<Apple>
        {
            public int Value { get; set; }
            public Color Color { get; set; }

            public int CompareTo(Apple other)
            {
                var diff = Value - other.Value;
                if (diff != 0)
                {
                    return diff;
                }
                else
                {
                    return (int)Color - (int)other.Color;
                }
            }

            public override string ToString() => $"{Color}:{Value}";
        }

        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var xyabc = inputStream.ReadIntArray();
            var x = xyabc[0];
            var y = xyabc[1];
            var p = inputStream.ReadIntArray();
            var q = inputStream.ReadIntArray();
            var r = inputStream.ReadIntArray();
            var whiteApples = r;  // alias

            var apples = new Apple[x + y];
            Array.Sort(p);
            Array.Reverse(p);   // 降順
            Array.Sort(q);
            Array.Reverse(q);   // 降順
            Array.Sort(r);
            Array.Reverse(r);   // 降順

            for (int i = 0; i < x; i++)
            {
                apples[i] = new Apple { Value = p[i], Color = Color.Red };
            }

            for (int i = 0; i < y; i++)
            {
                apples[i + x] = new Apple { Value = q[i], Color = Color.Green };
            }

            Array.Sort(apples);   // 昇順

            int whiteIndex = 0;
            for (int i = 0; i < apples.Length; i++)
            {
                if (apples[i].Value < whiteApples[whiteIndex])
                {
                    apples[i] = new Apple { Value = whiteApples[whiteIndex], Color = Color.None };
                    whiteIndex++;
                }
                if (whiteIndex >= whiteApples.Length)
                {
                    break;
                }
            }

            long total = 0;
            for (int i = 0; i < apples.Length; i++)
            {
                total += apples[i].Value;
            }
            yield return total;
        }
    }
}


namespace AtcoderBeginnerContest160
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionE();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtcoderBeginnerContest160.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtcoderBeginnerContest160.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 35940