#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(n), y(m);
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];
    ll ans = 0, MOD = 1e9 + 7, xs = 0, ys = 0;
    rep(i, n - 1) {
        xs = (xs + ((i + 1LL) * (n - 1 - i)) % MOD * (x[i + 1] - x[i])) % MOD;
    }
    rep(i, m - 1) {
        ys = (ys + ((i + 1LL) * (m - 1 - i)) % MOD * (y[i + 1] - y[i])) % MOD;
    }
    cout << (xs * ys) % MOD << endl;
}