n,m = map(int, input().split())
x = input().split()
y = input().split()

x_ = []
for i in range(n-1):
    for j in range(i+1,n):
        x_.append( int(x[j])-int(x[i]) )
y_ = []
for i in range(m-1):
    for j in range(i+1,m):
        y_.append( int(y[j])-int(y[i]) )

area = [a*b for a in x_ for b in y_]
print( sum(area)%(10**9+7) )