#include <bits/stdc++.h>
int Fl, Pn, SI = 100;
char mch = ' ', ch, Bf[21];
void chin(char& c) {
  while (!(isprint(c = getchar())))
    ;
}
template <typename t>
void in(t& a) {
  a = 0;
  ch = getchar();
  Fl = 1;
  while (((ch < '0') || (ch > '9')) && ch != EOF)
    Fl = (ch == '-') ? -Fl : Fl, ch = getchar();
  while ((ch >= '0') && (ch <= '9')) a = a * 10 + ch - '0', ch = getchar();
  a *= Fl;
}
template <typename t>
void out(t a) {
  if (a < 0) putchar('-'), a = -a;
  if (a == 0) putchar('0');
  while (a) Bf[++Pn] = a % 10 + '0', a /= 10;
  while (Pn) putchar(Bf[Pn]), --Pn;
  putchar(mch);
}
template <typename t, typename... ARGS>
void in(t& a, ARGS&... args) {
  in(a);
  in(args...);
}
template <typename t, typename... ARGS>
void out(t a, ARGS... args) {
  out(a);
  out(args...);
}
using namespace std;
int n, m, a[100001], b[100001];
long long sum;
int main() {
  in(n, m);
  for (register int i = (1); i <= (n); ++i) in(a[i]);
  for (register int i = (1); i <= (m); ++i) in(b[i]);
  for (register int i = (1); i <= (n); ++i)
    for (register int j = (i + 1); j <= (n); ++j)
      for (register int k = (1); k <= (m); ++k)
        for (register int l = (k + 1); l <= (m); ++l)
          (sum += ((long long)((a[j] - a[i]) % 1000000007) * (b[l] - b[k]) %
                   1000000007) %
                  1000000007) %= 1000000007;
  cout << sum << endl;
  return 0;
}
