#include <bits/stdc++.h>
using namespace std;
void YES(bool flag) { cout << (flag ? "YES" : "NO") << endl; }
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
void yes(bool flag) { cout << (flag ? "yes" : "no") << endl; }
const int INF = 1e7;
const long long MOD = 1e9 + 7;
vector<long long> x, y;
long long get(int l, vector<long long> z) {
  long long rtn = 0ll;
  for (int i = 0; i < l; i++)
    for (int j = 0; j < l - i; j++) {
      rtn += z[i + j] - z[i];
      rtn %= MOD;
    }
  return rtn;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    x.push_back(tmp);
  }
  for (int i = 0; i < m; i++) {
    long long tmp;
    cin >> tmp;
    y.push_back(tmp);
  }
  long long ans = 1ll;
  ans *= get(n, x);
  ans %= MOD;
  ans *= get(m, y);
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
