#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL MOD = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  LL X[n], Y[m];
  for (int i = 0; i < n; i++) {
    LL x;
    cin >> x;
    X[i] = x;
  }
  for (int i = 0; i < m; i++) {
    LL y;
    cin >> y;
    Y[i] = y;
  }
  vector<LL> WX, WY;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      WX.push_back((X[j] - X[i]) % MOD);
    }
  }
  for (int i = 0; i < m - 1; i++) {
    for (int j = i + 1; j < m; j++) {
      WY.push_back((Y[j] - Y[i]) % MOD);
    }
  }
  LL ans = 0;
  for (auto wx : WX) {
    for (auto wy : WY) {
      ans += wx * wy;
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
