#include<bits/stdc++.h>
using namespace std;
int minn=1000000000;
int s[5];
int a[30][5];
int l,r,ans;
void dfs(int x,int y,int l,int r){
if(x>s[y]){
minn=min(minn,max(l,r));
return ;
}
dfs(x+1,y,l+a[x][y],r);
dfs(x+1,y,l,r+a[x][y]);
}
int main(){
cin>>s[1]>>s[2]>>s[3]>>s[4];
for(int i=1;i<=4;i++){
minn=1000000000;
l=r=0;
for(int j=1;j<=s[i];j++){
cin>>a[j][i];
}
dfs(1,i,0,0);
ans+=minn;
}
cout<<ans;
return 0;
}