############################################################# import sys sys.setrecursionlimit(10**7) from heapq import heappop,heappush from collections import deque,defaultdict,Counter from bisect import bisect_left, bisect_right from itertools import product,combinations,permutations ipt = sys.stdin.readline def iin(): return int(ipt()) def lmin(): return list(map(int,ipt().split())) MOD = 998244353 ############################################################# NA,NB,NC = lmin() A = lmin() B = lmin() C = lmin() M = 3000 cnt_A = [0]*(2*M+2) cnt_B = [0]*(2*M+2) cnt_C = [0]*(2*M+2) for a in A: cnt_A[a] += 1 for b in B: cnt_B[b] += 1 for c in C: cnt_C[c] += 1 cum_A = [0]*(2*M+2) cum_cnt_A = [0]*(2*M+2) for i in range(M,-M-1,-1): cum_A[i] += cum_A[i+1]+cnt_A[i]*i cum_cnt_A[i] += cum_cnt_A[i+1]+cnt_A[i] cum_B = [0]*(2*M+2) cum_cnt_B = [0]*(2*M+2) for i in range(M,-M-1,-1): cum_B[i] += cum_B[i+1]+cnt_B[i]*i cum_cnt_B[i] += cum_cnt_B[i+1]+cnt_B[i] cum_C = [0]*(2*M+2) cum_cnt_C = [0]*(2*M+2) for i in range(M,-M-1,-1): cum_C[i] += cum_C[i+1]+cnt_C[i]*i cum_cnt_C[i] += cum_cnt_C[i+1]+cnt_C[i] ans = 0 SB = 0 cb = 0 for b in range(M+1,-M-1,-1): for c in range(M+1,-M-1,-1): if cum_cnt_B[b] > 0: t = (-cum_C[c]+cum_cnt_B[b]-1)//cum_cnt_B[b] t = max(-M,t) t = min(M+1,t) ans = max(ans, cum_cnt_B[b]*cum_A[t]+cum_cnt_A[t]*cum_C[c]+cum_B[b]*cum_cnt_C[c]) else: ans = max(ans, max(0,NA*cum_C[c]+cum_B[b]*cum_cnt_C[c])) print(ans)