#include<bits/stdc++.h>
using namespace std;
const int maxn = 101;
int tim[maxn][maxn];
int main()
{
int s[4];
for (int i = 0; i < 4; i++)
{
cin >> s[i];
}
int arr[21];
int _sum=0;
for (int i = 0; i < 4; i++)
{
int sum = 0;
for (int j = 1; j <= s[i]; j++)
{
cin >> arr[j];
sum += arr[j];
}
for (int j = 1; j <= s[i]; j++)
{
if (s[i] == 1)
break;
for (int k = 1; k <= sum / 2; k++)
{
if (arr[j] > k)
{
tim[j][k] = tim[j - 1][k];
}
else
{
tim[j][k] = tim[j - 1][k] > tim[j - 1][k-arr[j]]+arr[j] ? tim[j - 1][k] : tim[j - 1][k - arr[j]]+arr[j];
}
}
}
if (s[i] != 1)
{
_sum += sum - tim[s[i]][sum / 2];
}
else
{
_sum += sum;
}
}
cout << _sum;
}