#include #include int cmp_ll_rev (const void *ap, const void *bp) { long long a = *(long long *)ap; long long b = *(long long *)bp; if (a < b) { return 1; } if (a > b) { return -1; } return 0; } int main () { int na = 0; int nb = 0; int nc = 0; long long a[100000] = {}; long long b[100000] = {}; long long c[100000] = {}; int res = 0; long long ans = 0LL; long long sum_a[100001] = {}; long long sum_b[100001] = {}; long long sum_c[100001] = {}; int idx_b = 0; res = scanf("%d", &na); res = scanf("%d", &nb); res = scanf("%d", &nc); for (int i = 0; i < na; i++) { res = scanf("%lld", a+i); } for (int i = 0; i < nb; i++) { res = scanf("%lld", b+i); } for (int i = 0; i < nc; i++) { res = scanf("%lld", c+i); } qsort(a, na, sizeof(long long), cmp_ll_rev); qsort(b, nb, sizeof(long long), cmp_ll_rev); qsort(c, nc, sizeof(long long), cmp_ll_rev); for (int i = 0; i < na; i++) { sum_a[i+1] = a[i]+sum_a[i]; } for (int i = 0; i < nb; i++) { sum_b[i+1] = b[i]+sum_b[i]; } for (int i = 0; i < nc; i++) { sum_c[i+1] = c[i]+sum_c[i]; } while (idx_b < nb-1 && b[idx_b+1] >= 0LL) { idx_b++; } for (int i = 0; i <= na; i++) { int idx = 0; for (int j = nb; j >= idx_b; j--) { while (idx < nc && c[idx]*((long long)i)*(-1LL) <= sum_b[j]) { idx++; } if (sum_a[i]*((long long)j)+sum_b[j]*((long long)idx)+sum_c[idx]*((long long)i) > ans) { ans = sum_a[i]*((long long)j)+sum_b[j]*((long long)idx)+sum_c[idx]*((long long)i); } } } printf("%lld\n", ans); return 0; }