#include using namespace std; const int MAX = 3000; const long long INF = 1000000000000000000; template struct li_chao_tree{ struct line{ T a, b; line(): a(0), b(INF){ } line(T a, T b): a(a), b(b){ } T get(T x){ return a * x + b; } }; int N; vector x; vector ST; li_chao_tree(const vector &x2){ x = x2; sort(x.begin(), x.end()); int N2 = x.size(); N = 1; while (N < N2){ N *= 2; } x.resize(N); for (int i = N2; i < N; i++){ x[i] = x[N2 - 1]; } ST = vector(N * 2 - 1); } void line_add(line L, int i, int l, int r){ T la = L.get(x[l]); T lb = ST[i].get(x[l]); T ra = L.get(x[r - 1]); T rb = ST[i].get(x[r - 1]); if (la >= lb && ra >= rb){ return; } else if (la <= lb && ra <= rb){ ST[i] = L; } else { int m = (l + r) / 2; T ma = L.get(x[m]); T mb = ST[i].get(x[m]); if (ma < mb){ swap(L, ST[i]); swap(la, lb); swap(ra, rb); } if (la < lb){ line_add(L, i * 2 + 1, l, m); } if (ra < rb){ line_add(L, i * 2 + 2, m, r); } } } void line_add(T a, T b){ line_add(line(a, b), 0, 0, N); } T get(T x2){ int p = lower_bound(x.begin(), x.end(), x2) - x.begin(); p += N - 1; T ans = INF; ans = min(ans, ST[p].get(x2)); while (p > 0){ p = (p - 1) / 2; ans = min(ans, ST[p].get(x2)); } return ans; } }; int main(){ vector N(3); for (int i = 0; i < 3; i++){ cin >> N[i]; } vector> A(3); for (int i = 0; i < 3; i++){ A[i].resize(N[i]); for (int j = 0; j < N[i]; j++){ cin >> A[i][j]; } } vector> B(3, vector(MAX * 2 + 1, 0)); for (int i = 0; i < 3; i++){ for (int j = 0; j < N[i]; j++){ B[i][A[i][j] + MAX]++; } } int M = MAX * 2 + 2; vector> X(3, vector(M, 0)); vector> Y(3, vector(M, 0)); for (int i = 0; i < 3; i++){ for (int j = 0; j <= MAX * 2; j++){ X[i][j + 1] = X[i][j] + B[i][MAX * 2 - j]; Y[i][j + 1] = Y[i][j] + B[i][MAX * 2 - j] * (MAX - j); } } long long ans = 0; for (int i = 0; i < M; i++){ li_chao_tree LCT(X[2]); for (int j = 0; j < M; j++){ LCT.line_add(-Y[1][j], -Y[0][i] * X[1][j]); } for (int j = 0; j < M; j++){ ans = max(ans, -LCT.get(X[2][j]) + Y[2][j] * X[0][i]); } } cout << ans << endl; }