P = sorted(map(int, input().split())) Q = sorted(map(int, input().split())) print((sum(P) * sum(Q) - sum(p * q for p, q in zip(P, Q))) * 2)