#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> sum(3); vector> a(3, vector(0)); rep(i,3){ a[i].resize(n[i]); rep(j,n[i]) cin >> a[i][j]; sort(a[i].rbegin(),a[i].rend()); } rep(i,3){ sum[i].resize(n[i]+1); rep(j,n[i]){ sum[i][j+1] += sum[i][j] + a[i][j]; } } dbg(sum); ll ans = 0; for(int i=0;i<=min(3000,n[1]);i++){ for(int j=0;j<=min(3000,n[2]);j++){ ll s = sum[2][j]; int r = n[0]; int l = 0; while(r-l>1){ int mid = (l+r)/2; if(a[0][mid]*i+s>=0) l = mid; else r = mid; } ans = max(ans, sum[0][r]*i+s*r + sum[1][i]*j); } } cout << ans << endl; return 0; }