#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint998244353; int main(){ int na,nb,nc; cin>>na>>nb>>nc; vector a(na),b(nb),c(nc); rep(i,na) cin>>a.at(i); rep(i,nb) cin>>b.at(i); rep(i,nc) cin>>c.at(i); const ll shf=3005; vector ra(shf*2),rb(shf*2),rc(shf*2); rep(i,na) ra.at(a.at(i)+shf)++; rep(i,nb) rb.at(b.at(i)+shf)++; rep(i,nc) rc.at(c.at(i)+shf)++; vector sma(shf*2+1),csa(shf*2+1); for(int i=shf*2-1;i>=0;i--){ sma.at(i)=sma.at(i+1)+ra.at(i)*(i-shf); csa.at(i)=csa.at(i+1)+ra.at(i); } ll ans=0; ll smb=0,bb=0; for(int lb=shf*2-1;lb>=0;lb--){ ll smc=0,cc=0; for(int lc=shf*2-1;lc>=0;lc--){ int d; if(bb==0) d=-shf; else d=clamp(-smc/bb,-shf,shf); ll tmp=sma.at(d+shf)*bb+smb*cc+smc*csa.at(d+shf); ans=max(ans,tmp); smc+=rc.at(lc)*(lc-shf); cc+=rc.at(lc); } smb+=rb.at(lb)*(lb-shf); bb+=rb.at(lb); } cout<