#include <bits/stdc++.h>
using namespace std;
template <typename T>
void DEBUG(T e) {
  if (true == false) return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T>& v) {
  if (true == false) return;
  for (const auto& e : v) {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T> >& vv) {
  if (true == false) return;
  for (const auto& v : vv) {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e) {
  if (true == false) return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge) {
  if (flg) {
    cout << hoge << endl;
    exit(0);
  }
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b) {
  return a > b && (a = b, true);
}
template <class T>
struct CumulativeSum2D {
  vector<vector<T> > data;
  CumulativeSum2D(long long W, long long H)
      : data(W + 1, vector<long long>(H + 1, 0)) {}
  void add(long long x, long long y, T z) {
    ++x, ++y;
    if (x >= data.size() || y >= data[0].size()) return;
    data[x][y] += z;
  }
  void build() {
    for (long long i = 1; i < data.size(); i++) {
      for (long long j = 1; j < data[i].size(); j++) {
        data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
      }
    }
  }
  T query(long long sx, long long sy, long long gx, long long gy) {
    return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
  }
};
void solve(void) {
  long long H, W;
  cin >> H >> W;
  vector<long long> vX(H, 0);
  vector<long long> vY(W, 0);
  for (long long i = 0; i < H; i++) {
    cin >> vX[i];
  }
  for (long long i = 0; i < W; i++) {
    cin >> vY[i];
  }
  H--;
  W--;
  CumulativeSum2D<long long> CS(W, H);
  for (long long i = 0; i < H; i++) {
    for (long long j = 0; j < W; j++) {
      CS.add(j, i, (vX[i + 1] - vX[i]) * (vY[j + 1] - vY[j]));
    }
  }
  CS.build();
  long long MAX = 0;
  long long ANS = 0;
  for (long long i = 0; i < H; i++) {
    for (long long j = 0; j < W; j++) {
      for (long long i2 = i + 1; i2 <= H; i2++) {
        for (long long j2 = j + 1; j2 <= W; j2++) {
          ANS += CS.query(j, i, j2, i2);
          ANS %= 1000000007;
        }
      }
    }
  }
  cout << ANS << endl;
  return;
}
int32_t main(int32_t argc, const char* argv[]) {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  return 0;
}
