#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long int n, m;
  signed long int x[100000], y[100000];
  unsigned long int a, b, c, d, e;
  c = 0;
  d = 0;
  e = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> y[i];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < m; j++) {
      for (int k = 0; k < n - i; k++) {
        a = x[k + i] - x[k];
        e = e + a;
      }
      for (int l = 0; l < m - j; l++) {
        b = y[l + j] - y[l];
        d = d + b;
      }
      d = d % 1000000007;
      e = e % 1000000007;
      c = c + d * e;
      c = c % 1000000007;
      d = 0;
      e = 0;
    }
  }
  cout << c << endl;
}
