#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> x(n), y(n);
  for (long long i = 0; i < n; i++) cin >> x.at(i);
  for (long long i = 0; i < m; i++) cin >> y.at(i);
  long long sum = 0;
  for (long long i = 1; i < n; i++) {
    for (long long j = 1; j < m; j++) {
      for (long long a = 0; a < n - i; a++) {
        for (long long b = 0; b < m - j; b++) {
          sum += (x.at(a + i) - x.at(a)) * (y.at(b + j) - y.at(b));
          if (sum >= 1000000007) sum = sum % 1000000007;
        }
      }
    }
  }
  cout << sum;
}
