#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    ll mod = 1000000007;
    int n, m;
    cin >> n >> m;
    vector<ll> x(n);
    vector<ll> y(m);
    for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = 0; i < m; i++) cin >> y[i];
    
    ll s = 0;
    ll t = 0;
    for (int i = 1; i < n; i++) {
        s += (x[i] - x[i-1]) * i * (n-i);
        s %= mod;
    }
    for (int i = 1; i < m; i++) {
        t += (y[i] - y[i-1]) * i * (m-i);
        t %= mod;
    }
    
    cout << (s*t)%mod << endl;
    return 0;
}