import std.array;
import std.range;
import std.algorithm;
import std.conv;
import std.stdio;
import std.string;
import std.traits;
import std.ascii;

class Solver {
  private long[] x;
  private long[] y;

  public this(string xstr, string ystr) {
    x = xstr.split.map!(to!long).array;
    y = ystr.split.map!(to!long).array;
  }

  public long ans() {
    long ans = 0;

    int xn = x.length - 1;
    int yn = y.length - 1;

    foreach(xi; iota(xn)) {
      foreach(yi; iota(yn)) {
        long size = (x[xi + 1] - x[xi]) * (y[yi + 1] - y[yi]);
        long choice = (xi + 1) * (xn - xi) * (yi + 1) * (yn - yi);
        ans += size * choice;
        ans %= 1_000_000_000 + 7;
      }
    }

    return ans;
  }
}

void main(string[] args) {
  readln;
  string xstr = readln.chomp;
  string ystr = readln.chomp;
  auto a = new Solver(xstr, ystr);
  a.ans.writeln;
}