import std.stdio, std.algorithm, std.conv, std.array, std.string, std.range;

enum long PRIM = 10^^9+7;
long[99999] XS;
long[99999] YS;

void main()
{

    auto nm = readln.chomp.split(" ").map!(to!long);
    auto n = nm[0]-1;
    auto m = nm[1]-1;

    auto xs = readln.chomp.split(" ").map!(to!long);
    foreach (i; 0..n)
        XS[i] = (xs[i+1] - xs[i]);

    auto ys = readln.chomp.split(" ").map!(to!long);
    foreach (i; 0..m)
        YS[i] = (ys[i+1] - ys[i]);
    
    long area;
    foreach (x; 0..n)
        foreach (y; 0..m)
            area += ( (XS[x] * YS[y])%PRIM *
                ( ((x+1)*(y+1))%PRIM * ((n-x)*(m-y))%PRIM )%PRIM
            )%PRIM;

    writeln(area%PRIM);
}