#include using namespace std; #include using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif int main() { vector n(3); rep(i,3) cin >> n[i]; vector> qs(3); vector sz(3); vector sum(3); rep(i,3){ rep(j,n[i]){ int a; cin >> a; if(a>=0) { sum[i] += a; sz[i]++; } else qs[i].push(a); } } ll ans = 0; rep(i,3){ ans += sum[i] * sz[(i+1)%3]; } dbg(ans); while(true){ bool upd = false; rep(i,3){ if(qs[i].empty()) continue; int u = qs[i].top(); sum[i] += u; sz[i]++; ll tmp = 0; rep(j,3){ tmp += sum[j] * sz[(j+1)%3]; } if(tmp>=ans) { ans = tmp; upd = true; qs[i].pop(); } else{ sum[i] -= u; sz[i]--; } } dbg(upd); if(!upd) break; } cout << ans << endl; return 0; }