#include //#include using namespace std; //using namespace atcoder; //using mint = modint998244353; //const int mod = 998244353; //using mint = modint1000000007; //const int mod = 1000000007; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } inline long long ceil_div(long long x, long long y) { return (x < 0) ? x / y : (x + (y - 1)) / y; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int na, nb, nc; cin >> na >> nb >> nc; const int MX = 3003; auto f = [&](const int n) { vectorc(MX * 2 + 1); rep(i, n) { int x; cin >> x; c[MX + x]++; } vector

res(MX * 2 + 1); long long cnt = 0, sum = 0; rrep2(i, -MX, MX + 1) { cnt += c[i + MX]; sum += c[i + MX] * i; res[i + MX] = { cnt,sum }; } return res; }; auto a = f(na); auto b = f(nb); auto c = f(nc); long long ans = 0; // Sb,Scă‚’Fix for (auto q : b)for (auto r : c) { if (0 == q.first) { long long val = max(0LL, (long long)na * r.second) + q.second * r.first; chmax(ans, val); } else { long long x = ceil_div(-r.second, q.first); P p = x > MX ? P(0, 0) : a[max(0LL, x + MX)]; long long val = p.second * q.first + p.first * r.second + q.second * r.first; chmax(ans, val); } } cout << ans << endl; return 0; }