Problem:
Score : 500 points

Problem Statement

You are going to eat X red apples and Y green apples.

You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C.

Before eating a colorless apple, you can paint it red or green, and it will count as a red or green apple, respectively.

From the apples above, you will choose the apples to eat while making the sum of the deliciousness of the eaten apples as large as possible.

Find the maximum possible sum of the deliciousness of the eaten apples that can be achieved when optimally coloring zero or more colorless apples.

Constraints

1 \leq X \leq A \leq 10^5

1 \leq Y \leq B \leq 10^5

1 \leq C \leq 10^5

1 \leq p_i \leq 10^9

1 \leq q_i \leq 10^9

1 \leq r_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y A B C
p_1 p_2 ... p_A
q_1 q_2 ... q_B
r_1 r_2 ... r_C

Output

Print the maximum possible sum of the deliciousness of the eaten apples.

Sample Input 1

1 2 2 2 1
2 4
5 1
3

Sample Output 1

12

The maximum possible sum of the deliciousness of the eaten apples can be achieved as follows:

Eat the 2-nd red apple.

Eat the 1-st green apple.

Paint the 1-st colorless apple green and eat it.

Sample Input 2

2 2 2 2 2
8 6
9 1
2 1

Sample Output 2

25

Sample Input 3

2 2 4 4 4
11 12 13 14
21 22 23 24
1 2 3 4

Sample Output 3

74

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;

	public static void Main(string[] args)
	{
		var oo = Input().ToInt();
		var x = oo[0];
		var y = oo[1];
		var a = oo[2];
		var b = oo[3];
		var c = oo[4];
		
		var ps = Input();
		var pq = Input();
		var pr = Input();
		
		var p = new HeapQueue<long>(a, (s,t) => (int)(t-s));
		var q = new HeapQueue<long>(b, (s,t) => (int)(t-s));
		var r = new HeapQueue<long>(c, (s,t) => (int)(s-t));
		
		for(int i = 0; i < a; i++)
		{
			var _q = ps[i].ToLong();
			p.Push(_q);
			
		}
		
		for(int i = 0; i < b; i++)
		{
			var _q = pq[i].ToLong();
			q.Push(_q);
		}
		
		for(int i = 0; i < c; i++)
		{
			r.Push(pr[i].ToLong());
		}
		
		
		for(int i = 0; i < a - x; i++)
		{
			p.Pop();
		}
			
			
		for(int i = 0; i < b - y; i++)
			q.Pop();
			
		while(r.Count > 0)
		{
			var min = Math.Min(p.Peep() , q.Peep());
			if(min >= r.Peep())
				break;
			if(p.Peep() < q.Peep())
			{
				p.Pop();
				p.Push(r.Pop());
			}
			else
			{
				q.Pop();
				q.Push(r.Pop());
			
			}
		}
		long wa = 0;
		while(p.Count > 0)
		{
			wa += p.Pop();
		}
		
		while(q.Count > 0)
		{
			wa += q.Pop();
		}
		Console.WriteLine(wa);
	}
	
	static long CountAndCalc(long[] k, int x)
	{
		Array.Sort(k);
		Array.Reverse(k);
		long wa = 0;
		for(int i = 0; i < x; i++)
			wa += k[i];
		return wa;
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

class HeapQueue<T> where T : IComparable<T>
{
	private List<T> _buffer;
	private Comparison<T> _comparer;
	
	public HeapQueue()
	{
		_buffer = new List<T>();
	}
	
	public HeapQueue(int capacity, Comparison<T> comparer = null)
	{
		_buffer = new List<T>(capacity);

		_comparer = comparer;
	}
	
	public void Push(T el)
	{
		List<T> array = _buffer;
		int n = array.Count;
		array.Add(el);
		
		while (n != 0)
		{
			int i = (n - 1) / 2;
			if (Compare(array[n], array[i]) > 0)
			{
				T tmp = array[n]; array[n] = array[i]; array[i] = tmp;
			}
			n = i;
		}
	}
	
	public T Pop()
	{
		T el = _buffer[0];
		
		List<T> array = _buffer;
		
		int n = array.Count - 1;
		array[0] = array[n];
		array.RemoveAt(n);

		for (int i = 0, j; (j = 2 * i + 1) < n; )
		{
			if ((j != n - 1) && (Compare(array[j], array[j + 1]) < 0))
				j++;
			if (Compare(array[i], array[j]) < 0)
			{
				T tmp = array[j]; array[j] = array[i]; array[i] = tmp;
			}
			i = j;
		}
		return el;
	}
	
	public T Peep()
	{
		if(_buffer.Count <= 0)
			return default(T);

		return _buffer[0];
	}
	private int Compare(T left, T right)
	{
		if(_comparer == null)
			return left.CompareTo(right);
		return _comparer(left, right);
	}
	
	public int Count
	{
		get{ return _buffer.Count; }
	}
	
}