#include <bits/stdc++.h>
long long const MOD = 1e9 + 7;
long long const INF = 1e18;
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long ans1 = 0, ans2 = 0, sum = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    long long x;
    cin >> x;
    ans1 += x * i % MOD - sum;
    ans1 %= MOD;
    sum = (sum + x) % MOD;
  }
  sum = 0;
  for (int(i) = 0; (i) < (m); (i)++) {
    long long x;
    cin >> x;
    ans2 += x * i % MOD - sum;
    ans2 %= MOD;
    sum = (sum + x) % MOD;
  }
  cout << ans1 * ans2 % MOD << endl;
  return 0;
}
