n, m = list(map(int, input().split()))

x = list(map(int, input().split()))

y = list(map(int, input().split()))

mod = 10 ** 9 + 7

xsum, ysum = 0, 0

for i in range(n):

    xsum += i * x[i] - (n - 1 - i) * x[i]

for i in range(m):

    ysum += i * y[i] - (m - 1 - i) * y[i]

ans = (xsum * ysum) % mod

print(ans)

n, m = list(map(int, input().split()))

x = list(map(int, input().split()))

y = list(map(int, input().split()))

mod = 10 ** 9 + 7

xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n))

ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))

ans = (xsum * ysum) % mod

print(ans)

n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7
xsum, ysum = 0, 0
for i in range(n):
    xsum += i * x[i] - (n - 1 - i) * x[i]
for i in range(m):
    ysum += i * y[i] - (m - 1 - i) * y[i]
ans = (xsum * ysum) % mod
print(ans)

n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7
xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n))
ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))
ans = (xsum * ysum) % mod
print(ans)

-xsum, ysum = 0, 0 -for i in range(n): -    xsum += i * x[i] - (n - 1 - i) * x[i] -for i in range(m): -    ysum += i * y[i] - (m - 1 - i) * y[i] +xsum = sum((i * x[i] - (n - 1 - i) * x[i]) for i in range(n)) +ysum = sum((i * y[i] - (m - 1 - i) * y[i]) for i in range(m))