#include <bits/stdc++.h>
using namespace std;
const long long moder = 1e9 + 7;
double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
void _BG(const char *s) {}
template <typename T, typename... TT>
void _BG(const char *s, T a, TT... b) {
  for (int c = 0; *s && (c || *s != ','); ++s) {
    cerr << *s;
    switch (*s) {
      case '(':
      case '[':
      case '{':
        ++c;
        break;
      case ')':
      case ']':
      case '}':
        --c;
        break;
    }
  }
  cerr << " = " << a;
  if (*s) {
    cerr << ", ";
    _BG(++s, b...);
  } else
    cerr << endl;
}
bool RD(void) { return true; }
bool RD(char &a) { return scanf(" %c", &a) == 1; }
bool RD(char *a) { return scanf("%s", a) == 1; }
bool RD(double &a) { return scanf("%lf", &a) == 1; }
bool RD(int &a) { return scanf("%d", &a) == 1; }
bool RD(long long &a) { return scanf("%lld", &a) == 1; }
template <typename T, typename... TT>
bool RD(T &a, TT &...b) {
  return RD(a) && RD(b...);
}
void PT(const char a) { putchar(a); }
void PT(const char *a) { fputs(a, stdout); }
void PT(char *a) { fputs(a, stdout); }
void PT(const double a) { printf("%.16f", a); }
void PT(const int a) { printf("%d", a); }
void PT(const long long a) { printf("%lld", a); }
template <char sep = ' ', char end = '\n'>
void PL(void) {
  if (end) PT(end);
}
template <char sep = ' ', char end = '\n', typename T, typename... TT>
void PL(const T a, const TT... b) {
  PT(a);
  if (sizeof...(b) && sep) PT(sep);
  PL<sep, end>(b...);
}
inline string IntToString(long long a) {
  char x[100];
  sprintf(x, "%lld", a);
  string s = x;
  return s;
}
inline long long StringToInt(string a) {
  char x[100];
  long long res;
  strcpy(x, a.c_str());
  sscanf(x, "%lld", &res);
  return res;
}
inline string GetString(void) {
  char x[1000005];
  scanf("%s", x);
  string s = x;
  return s;
}
inline string uppercase(string s) {
  int n = ((int)(s).size());
  for (int i(0), _B(n); i < _B; ++i)
    if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}
inline string lowercase(string s) {
  int n = ((int)(s).size());
  for (int i(0), _B(n); i < _B; ++i)
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}
inline void OPEN(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
inline bool feq(const double &a, const double &b) {
  return fabs(a - b) < 1e-10;
}
bool is_prime(long long x) {
  if (x <= 1) return 0;
  for (long long y = 2; y * y <= x; ++y)
    if (x % y == 0) return 0;
  return 1;
}
long long sqr(int a) { return (long long)a * a; }
long double sqr(long double a) { return a * a; }
long long sqr(long long a) { return a * a; }
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <class A, class B>
inline bool mina(A &x, const B &y) {
  return (y < x) ? (x = y, 1) : 0;
}
template <class A, class B>
inline bool maxa(A &x, const B &y) {
  return (x < y) ? (x = y, 1) : 0;
}
template <class Int, Int mod>
class ModInt {
 public:
  Int x;
  ModInt() : x(0) {}
  ModInt(int a, bool m = 1) {
    if (m) {
      x = a % mod;
      if (x < 0) x += mod;
    } else
      x = a;
  }
  ModInt(long long a, bool m = 1) {
    if (m) {
      x = a % mod;
      if (x < 0) x += mod;
    } else
      x = a;
  }
  inline ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= mod) x -= mod;
    return *this;
  }
  inline ModInt &operator-=(ModInt that) {
    if ((x += mod - that.x) >= mod) x -= mod;
    return *this;
  }
  inline ModInt &operator*=(ModInt that) {
    x = long long(x) * that.x % mod;
    return *this;
  }
  inline ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  inline ModInt operator-() const { return ModInt(-this->x); }
  ModInt inverse() const {
    long long a = x, b = mod, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      u -= t * v;
      swap(a, b);
      swap(u, v);
    }
    return ModInt(u);
  }
  inline friend ostream &operator<<(ostream &out, ModInt m) {
    return out << m.x;
  }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  bool operator<(ModInt that) const { return x < that.x; }
  bool operator<=(ModInt that) const { return x <= that.x; }
  bool operator>(ModInt that) const { return x > that.x; }
  bool operator>=(ModInt that) const { return x >= that.x; }
};
ModInt<int, moder> F[(300005)];
ModInt<int, moder> FI[(300005)];
ModInt<int, moder> Cnr(int n, int r) {
  if (r < 0 || r > n) return 0;
  return F[n] * FI[r] * FI[n - r];
}
long long si(int i) { return (long long)i * (i + 1) / 2; }
long long multModer(long long l1, long long l2) { return (l1 * l2) % moder; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<long long> vx(n);
  vector<long long> vy(m);
  for (int i = 0; i < n; ++i) {
    cin >> vx.at(i);
  }
  for (int i = 0; i < m; ++i) {
    cin >> vy.at(i);
  }
  long long sum = 0;
  long long sn = si(n - 1);
  long long sm = si(m - 1);
  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < m - 1; ++j) {
      long long area =
          multModer(vx.at(i + 1) - vx.at(i), vy.at(j + 1) - vy.at(j));
      long long xcnt = sn - si(i) - si(n - 2 - i);
      long long ycnt = sm - si(j) - si(m - 2 - j);
      xcnt = multModer(xcnt, 1ll);
      ycnt = multModer(ycnt, 1ll);
      sum += multModer(area, multModer(xcnt, ycnt));
      sum = multModer(sum, 1ll);
    }
  }
  cout << (sum) << endl;
  return 0;
}
