n,m = input().split()
n = int(n)
m = int(m)
x_list =list()
y_list = list()

x_list= input().split()
y_list= input().split()

all_menseki = 0
waru = 10**9 + 7
amari = 0
for x_min_i,x_min in enumerate(x_list[:-1]):
    for x_max in x_list[x_min_i:]:
        for y_min_i,y_min in enumerate(y_list[:-1]):
            for y_max in y_list[y_min_i:]:
                x = int(x_max) - int(x_min)
                y = int(y_max) - int(y_min)
                amari = (amari + (x % waru) * (y % waru)) % waru    

print(amari)