#include<iostream>
#include<queue>
#include<cstdio>
using namespace std;
inline int read()
{
register int x = 0, f = 1; register char c = getchar();
while (c < '0' || c>'9') { if (c == '-') f = -1; c = getchar(); }
while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
return x * f;
}
int s[4];
int t;
int main()
{
priority_queue<int> q;
for (int i = 0; i < 4; i++)s[i] = read();
for (int i = 0; i < 4; i++)
{
for (int k = 1; k <= s[i]; k++)
q.push(read());
while (q.size() > 2)
{
int t1 = q.top(); q.pop();
int t2 = q.top(); q.pop();
t += t2;
if(t1!=t2)q.push(t1 - t2);
}
t += q.top();
while (!q.empty())q.pop();
}
cout << t;
return 0;
}