include [HTML_REMOVED]
using namespace std;
const int N = 30;
int a[5][N];
int sum[5];
int mn = 0x3f3f3f3f;
int l, r;
void dfs(int cnt, int no){
if(cnt > sum[no]){
mn = min(mn, max(l, r));
return;
}
l += a[no][cnt];
dfs(cnt + 1, no);
l -= a[no][cnt];
r += a[no][cnt];
dfs(cnt + 1, no);
r -= a[no][cnt];
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
for(int i = 1;i <= 4;i)cin >> sum[i];
for(int i = 1;i <= 4;i){
for(int j = 1;j <= sum[i];j++){
cin >> a[i][j];
}
}
int ans = 0;
for(int i = 1;i <= 4;i++){
l = r = 0;
mn = 0x3f3f3f3f;
dfs(1, i);
ans += mn;
}
cout << ans;
return 0;
}