#include <bits/stdc++.h>
using namespace std;
const int nmax = 100005;
const int mod = 1e9 + 7;
int ar1[nmax];
int ar2[nmax];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  long long uttor = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> ar1[i];
  for (int i = 1; i <= m; i++) cin >> ar2[i];
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j < m; j++) {
      uttor +=
          ((j * i) % mod * ((n - i) * (m - j)) % mod *
           abs(ar2[j + 1] - ar2[j]) % mod * abs(ar1[i + 1] - ar1[i]) % mod) %
          mod;
      uttor %= mod;
    }
  }
  cout << uttor;
  return 0;
}
