#include <iostream>
#include <vector>

using namespace std;
constexpr int64_t MOD = 1'000'000'007;

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int64_t> x(n), y(m);
    for(int i=0; i<n; i++) {
        cin >> x[i];
    }
    for(int j=0; j<m; j++) {
        cin >> y[j];
    }

    int64_t ans = 0;
    for(int i=0; i<n-i; i++) {
        for(int j=0; j<m-j; j++) {
            int64_t area = (x[n-1-i] - x[i]) * (y[m-1-j] - y[j]) % MOD;
            area = (area * (n-1-2*i)) % MOD;
            area = (area * (m-1-2*j)) % MOD;
            ans = (ans + area) % MOD;
        }
    }

    cout << ans << endl;
    return 0;
}
