#include <bits/stdc++.h>
using namespace std;
unsigned long long inf = (1LL << 62);
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long max(long long a, long long b) {
  if (a < b) {
    return b;
  } else
    return a;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
pair<long long, long long> dx[4] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
vector<pair<long long, long long> > list;
void floyd(int N, long long** d) {
  for (int k = 0; k < (int)(N + 1); k++) {
    for (int i = 0; i < (int)(N + 1); i++) {
      if (d[i + 1][k + 1] == inf) continue;
      for (int j = 0; j < (int)(N + 1); j++) {
        if (d[j + 1][k + 1] == inf) continue;
        d[i + 1][j + 1] =
            min(d[i + 1][j + 1], d[i + 1][k + 1] + d[j + 1][k + 1]);
      }
    }
  }
}
unsigned long long modpow(unsigned long long a, unsigned long long b) {
  long long retval = 0;
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    retval = modpow(a, b / 2) % mod;
    return (retval * retval) % mod;
  } else {
    return ((a % mod) * modpow(a, b - 1)) % mod;
  }
}
unsigned long long modkaijou(unsigned long long a) {
  if (a == 1 || a == 0) {
    return 1;
  }
  long long retval = 1;
  for (unsigned long long i = a; i >= 1; i--) {
    retval = (retval * (i % mod)) % mod;
  }
  return retval % mod;
}
unsigned long long modcomb(unsigned long long a, unsigned long long b) {
  if (a == 0 || b == 0) return 1;
  return (((modkaijou(a) * modpow(modkaijou(a - b), mod - 2)) % mod) *
          modpow(modkaijou(b), mod - 2)) %
         mod;
}
class DisjointSet {
 public:
  vector<int> p, rank, num;
  DisjointSet() {}
  DisjointSet(int size) {
    rank.resize(size, 0);
    p.resize(size, 0);
    num.resize(size, 0);
    for (int i = 0; i < (int)(size); i++) {
      p[i] = i;
      rank[i] = 0;
      num[i] = 1;
    }
  }
  bool same(int x, int y) { return findSet(x) == findSet(y); }
  void unite(int x, int y) {
    if (!same(x, y)) link(findSet(x), findSet(y));
  }
  void link(int x, int y) {
    if (rank[x] > rank[y]) {
      p[y] = x;
      num[x] += num[y];
    } else {
      p[x] = y;
      num[y] += num[x];
      if (rank[x] == rank[y]) {
        rank[y]++;
      }
    }
  }
  long long NumberOfElements(int x) { return num[findSet(x)]; }
  int findSet(int x) {
    if (x != p[x]) {
      p[x] = findSet(p[x]);
      num[x] = 1;
    }
    return p[x];
  }
};
bool compare_b(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first < b.first) {
    return true;
  } else if (a.first == b.first) {
    return a.second < b.second;
  } else {
    return false;
  }
}
int ketasuu(int a) {
  int ret = 1;
  int val = a;
  while (val / 10 != 0) {
    ret += 1;
    val /= 10;
  }
  return ret;
}
typedef struct trio {
  long long a, b, y;
} ti;
string to_binary(long long a) {
  long long val = a;
  string retval = "";
  retval = to_string(val % 2);
  while (val / 2 != 0) {
    val /= 2;
    retval = (to_string(val % 2)) + retval;
  }
  return retval;
}
int ctoi(char a) { return a - '0'; }
string S;
long long x[100005], y[100005];
int main() {
  long long n, m;
  cin >> n >> m;
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i];
  }
  for (int j = 0; j < (int)(m); j++) {
    cin >> y[j];
  }
  long long ans = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
  ans %= mod;
  ans *= (n - 1);
  ans %= mod;
  ans *= (m - 1);
  ans %= mod;
  cout << ans << endl;
  return 0;
}
