N,M = list(map(int,input().split()))

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

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

MOD = 10**9+7



total_w = total_h = 0

for n in range(1,N):

    w = xs[n] - xs[n-1]

    w = (w * n * (N-n)) % MOD

    total_w = (total_w + w) % MOD

for n in range(1,M):

    h = ys[n] - ys[n-1]

    h = (h * n * (M-n)) % MOD

    total_h = (total_h + h) % MOD

ans = (total_w * total_h) % 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



w_sum = 0

for i in range(N//2):

    times = N-1 - i*2

    w = X[-1-i] - X[i]

    w_sum += (w*times)%MOD

    w_sum %= MOD



h_sum = 0

for i in range(M//2):

    times = M-1 - i*2

    h = Y[-1-i] - Y[i]

    h_sum += (h*times)%MOD

    h_sum %= MOD



print(((w_sum * h_sum) % MOD))
N, M = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
MOD = 10**9 + 7
total_w = total_h = 0
for n in range(1, N):
    w = xs[n] - xs[n - 1]
    w = (w * n * (N - n)) % MOD
    total_w = (total_w + w) % MOD
for n in range(1, M):
    h = ys[n] - ys[n - 1]
    h = (h * n * (M - n)) % MOD
    total_h = (total_h + h) % MOD
ans = (total_w * total_h) % 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
w_sum = 0
for i in range(N // 2):
    times = N - 1 - i * 2
    w = X[-1 - i] - X[i]
    w_sum += (w * times) % MOD
    w_sum %= MOD
h_sum = 0
for i in range(M // 2):
    times = M - 1 - i * 2
    h = Y[-1 - i] - Y[i]
    h_sum += (h * times) % MOD
    h_sum %= MOD
print(((w_sum * h_sum) % MOD))

-xs = list(map(int, input().split())) -ys = list(map(int, input().split())) +X = list(map(int, input().split())) +Y = list(map(int, input().split())) -total_w = total_h = 0 -for n in range(1, N): -    w = xs[n] - xs[n - 1] -    w = (w * n * (N - n)) % MOD -    total_w = (total_w + w) % MOD -for n in range(1, M): -    h = ys[n] - ys[n - 1] -    h = (h * n * (M - n)) % MOD -    total_h = (total_h + h) % MOD -ans = (total_w * total_h) % MOD -print(ans) +w_sum = 0 +for i in range(N // 2): +    times = N - 1 - i * 2 +    w = X[-1 - i] - X[i] +    w_sum += (w * times) % MOD +    w_sum %= MOD +h_sum = 0 +for i in range(M // 2): +    times = M - 1 - i * 2 +    h = Y[-1 - i] - Y[i] +    h_sum += (h * times) % MOD +    h_sum %= MOD +print(((w_sum * h_sum) % MOD))