#include <bits/stdc++.h>
using namespace std;
void print_Qbey() {
  cout << "           H                                           M#5J~d       "
          "       "
       << endl
       << "         Hm.?WMM                                   MMB^ .Z  d       "
          "       "
       << endl
       << "         MZS.` ?7WMM                             M#=`` (!`` d       "
          "       "
       << endl
       << "         HP?X,```  ?TMM                       MMY! ` .d: `` d       "
          "       "
       << endl
       << "         Hb;<U,`````` (TMM                 HM ^ ``` .V>_` `.W       "
          "       "
       << endl
       << "           ;><?n. `` ````?WHHMMHHHMMMMMM MMY```` ` (3<< `` .M       "
          "       "
       << endl
       << "         HN<>>>?W,`` `` ` (77!~`  ```~!?7'``` `` .d>>><``  .M       "
          "       "
       << endl
       << "          M2<>>>>?n.`` `` `` `` ``` `` ```` `` `.X>1++< `` (H       "
          "       "
       << endl
       << "          MK<>>>>+?S.``` `` ```` ``` ``` `` `` .Z``` ?4-.` jM       "
          "       "
       << endl
       << "           N2><+d=(Y^ `` `` ` ` ` ` `` `` `` `` T~.`````?=(dM       "
          "       "
       << endl
       << "           MR;JY~`~``` `` `` ``` ``` `` `` `` ``` u, `` `` 7M       "
          "       "
       << endl
       << "            NV!_`` `` `` ```` ``` `` `` `` ``` ``` C& ` ```` TMM    "
          "       "
       << endl
       << "           MY.(-`` ` `` ``  `` ` `` `` `` `` ``  `` (n ` ` ``` 7M   "
          "       "
       << endl
       << "         HMD-(D`` ``` `` ``` `` `` `` `` `` ` ``` ```(n ` `` `` (WM "
          "       "
       << endl
       << "         M _(d```` `` ``` ``` ``` `` `` `` ``` ``` `` .b.`` `` "
          "```?MH      "
       << endl
       << "        MM!_(%` `` `` `` ` ` `` `` `` ``` `` `` ` `` ` (l`` ``````` "
          "TMH    "
       << endl
       << "       H#>__d:`` .JXVS, ``` `` ` `` `` `.JXWH&.``` ```` O; `` ` ` "
          "`` -WM   "
       << endl
       << "       M%.~(k ``.HXH[ dr ```` ``` `` `` dWWN- u. `` ``` ,M,``` ``` "
          "``` ?MMM"
       << endl
       << "      MF_~~($`` .WXMMWX$ ` ``` `` ``` ` dXM HHK````` `` "
          ",HN-``````````.-=jg"
       << endl
       << "MMMMHMY.~~~(R ``` 799Y!```` ``` `` `` `` ?UUUY!`` ````` (M N, `` "
          "```.Z3J=``"
       << endl
       << "gaJJdD.~~::_X|`````````````` `````` `` ` ``` ````` ``` .H  MN,``` "
          ".Yiv! ```"
       << endl
       << "   MD_:~:~:~(T.`````````` ``` ` ` ````` ``` ``` ``````.M     N, "
          ".Ziv!`` ._~"
       << endl
       << " MM'_:::::::~(N+.`````````` .`.(.` .` ``` ```` ```` .dM       NZ1v! "
          ".-_~~``"
       << endl
       << " #:(::::::::~(HMNa..  ``````_?!`?7! `` ````  ...-(+7WMM     HM3(b "
          "_:<``..`."
       << endl
       << "=_;::::::::<(H    MMHaJ--_--........-.__~~~~(&v7<~``` ?MM   "
          "M>gM9h,_......."
       << endl
       << ";;;;;;;:;::(drWM          HHmgggg&gzOtOzz<<~~~~~_`` ``` ?MMMH+ggM "
          "Mm-......"
       << endl
       << "e<>>;>>;;><dMMJM                  Nc_~~~~~~~~~~_ ``  ` `` "
          "7H&-...?THNe-_._("
       << endl
       << ",4m+>>>>>>j MM(W                   N-~~~~~~~~:_`` ``` ` ``  "
          "?7UHHqqHWHMm+__"
       << endl
       << "vX+vT4k&&dMMD!+M                   MR_~~~~~:_````` ```` ````````` "
          "````  ?We"
       << endl
       << "???zTwiJ-(((JdM                    MK_~~~~:_``` ` ` ` `` ` ` ` ``` "
          "```````?"
       << endl
       << "1uukgHM                            MH_~~~_``` `` ``` `` `` `` ` `` "
          "` `  ```"
       << endl
       << "CugM                                N;~~:_ ` `` `` ``` `` ````` ``` "
          "``` ` `"
       << endl
       << "H                                   M[~~~_4, `   ` `` `` ``  ``` `` "
          "`` ``` "
       << endl
       << "                                    Hb~~~~~?n  (: `` `` `` `` ` ` "
          "`` `` ```"
       << endl
       << "                                    Hb~~~~~~(4,J_ `` ```  ```` ``` "
          "`` `` ` "
       << endl
       << "                                     N-~~~~~~(MM_` `` ` (}  `` `` "
          "`` `` ```"
       << endl
       << "                                     Mr_~~~~~(HH: `` `` j!`` `` `` "
          "`` `` ``"
       << endl
       << "                                     Mb~~~~~~(WH:`` `` .Z `` `` `` "
          "``` `` `"
       << endl
       << "                                      N:~~~~~(WM{ `` ` .H+.. `` `  "
          ".``` `` "
       << endl;
}
const int INF = 1145141919;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-12;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
template <class T>
long long upper(T n, T m) {
  return (n + m - 1) / m;
};
template <class T>
long long rounding(T n) {
  return (long double)n + 0.5;
};
template <class T>
bool inG(T x, T n) {
  return 0 <= x && 0 < n;
}
template <class T>
bool outG(T x, T n) {
  return x < 0 || n <= x;
}
inline int qp(int a, long long b) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a;
    a = 1ll * a * a;
  } while (b >>= 1);
  return ans;
}
inline int qp(int a, long long b, int mo) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
struct Arithmetic {
  Arithmetic() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  }
};
template <typename T>
void deb(T a) {}
void what_cr() {}
void t_t() {}
signed main() {
  Arithmetic Exception;
  int n, m;
  cin >> n >> m;
  int spn = n - 1, spm = m - 1;
  long long anhow[spn], amhow[spm];
  for (int i = int(0); i < int(spn); ++i) {
    int mx = max(spn - i, i + 1);
    int dis = min(spn - i, i + 1);
    anhow[i] = mx * dis;
  }
  for (int i = int(0); i < int(spm); ++i) {
    int mx = max(spm - i, i + 1);
    int dis = min(spm - i, i + 1);
    amhow[i] = mx * dis;
  }
  long long an[n], am[m];
  for (int i = int(0); i < int(n); ++i) cin >> an[i];
  for (int i = int(0); i < int(m); ++i) cin >> am[i];
  for (int i = int(0); i < int(n - 1); ++i) an[i] = abs(an[i] - an[i + 1]);
  for (int i = int(0); i < int(m - 1); ++i) am[i] = abs(am[i] - am[i + 1]);
  long long ansn = 0;
  for (int i = int(0); i < int(spn); ++i) ansn += an[i] * anhow[i], ansn %= MOD;
  long long ansm = 0;
  for (int i = int(0); i < int(spm); ++i) ansm += am[i] * amhow[i], ansm %= MOD;
  cout << ansn * ansm % MOD << endl;
  return 0;
}
