w,h,*L=list(map(int,open(0).read().split()))

P=L[:w];Q=L[w:]

x,y=w,h

sss=[]

for i,pi in enumerate(P):

	sss.append((pi,1))

for j,qj in enumerate(Q):

	sss.append((qj,0))

sss.sort()

ans=0

for c,f in sss:

	if f and x:

		x-=1

		ans+=c*(y+1)

	elif not f and y:

		y-=1

		ans+=c*(x+1)

print(ans)







w,h,*L=list(map(int,open(0).read().split()))

P=L[:w];Q=[-qj for qj in L[w:]]

x,y,ans=w,h,0

for c in sorted(P+Q,key=abs):

	if c>0:

		if x:ans+=c*(y+1);x-=1

	else:

		if y:ans-=c*(x+1);y-=1

print(ans)
w, h, *L = list(map(int, open(0).read().split()))
P = L[:w]
Q = L[w:]
x, y = w, h
sss = []
for i, pi in enumerate(P):
    sss.append((pi, 1))
for j, qj in enumerate(Q):
    sss.append((qj, 0))
sss.sort()
ans = 0
for c, f in sss:
    if f and x:
        x -= 1
        ans += c * (y + 1)
    elif not f and y:
        y -= 1
        ans += c * (x + 1)
print(ans)

w, h, *L = list(map(int, open(0).read().split()))
P = L[:w]
Q = [-qj for qj in L[w:]]
x, y, ans = w, h, 0
for c in sorted(P + Q, key=abs):
    if c > 0:
        if x:
            ans += c * (y + 1)
            x -= 1
    else:
        if y:
            ans -= c * (x + 1)
            y -= 1
print(ans)

-Q = L[w:] -x, y = w, h -sss = [] -for i, pi in enumerate(P): -    sss.append((pi, 1)) -for j, qj in enumerate(Q): -    sss.append((qj, 0)) -sss.sort() -ans = 0 -for c, f in sss: -    if f and x: -        x -= 1 -        ans += c * (y + 1) -    elif not f and y: -        y -= 1 -        ans += c * (x + 1) +Q = [-qj for qj in L[w:]] +x, y, ans = w, h, 0 +for c in sorted(P + Q, key=abs): +    if c > 0: +        if x: +            ans += c * (y + 1) +            x -= 1 +    else: +        if y: +            ans -= c * (x + 1) +            y -= 1