#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long int mod = 1000000007;
  int n, m;
  cin >> n >> m;
  vector<long long int> x(n), y(m), sx(n + 1, 0), sy(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    x[i] += (long long int)1e+9;
    sx[i + 1] = (x[i] + sx[i]) % mod;
  }
  return 0;
  for (int i = 0; i < m; i++) {
    cin >> y[i];
    y[i] += (long long int)1e+9;
    sy[i + 1] = (y[i] + sy[i]) % mod;
  }
  return 0;
  long long int X = 0;
  for (int i = 1; i < n; i++) {
    X += mod + (x[i] * i) % mod - (mod + sx[i] - sx[0]) % mod;
    X %= mod;
  }
  long long int Y = 0;
  for (int i = 1; i < m; i++) {
    Y += mod + (y[i] * i) % mod - (mod + sy[i] - sy[0]) % mod;
    Y %= mod;
  }
  cout << (X * Y) % mod << endl;
  return 0;
}
