#include <bits/stdc++.h>
using namespace std;
template <class F, class T>
T convert(F a, int p = -1) {
  stringstream ss;
  if (p >= 0) ss << fixed << setprecision(p);
  ss << a;
  T r;
  ss >> r;
  return r;
}
template <class T>
void db(T a, int p = -1) {
  if (p >= 0) cout << fixed << setprecision(p);
  cout << a << " ";
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
template <class T>
struct Triple {
  T x, y, z;
  Triple() {}
  Triple(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {}
};
template <class T>
Triple<T> euclid(T a, T b) {
  if (b == 0) return Triple<T>(1, 0, a);
  Triple<T> r = euclid(b, a % b);
  return Triple<T>(r.y, r.x - a / b * r.y, r.z);
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
const int bfsz = 1 << 16;
char bf[bfsz + 5];
int rsz = 0;
int ptr = 0;
char gc() {
  if (rsz <= 0) {
    ptr = 0;
    rsz = fread(bf, 1, bfsz, stdin);
    if (rsz <= 0) return EOF;
  }
  --rsz;
  return bf[ptr++];
}
void ga(char &c) {
  c = EOF;
  while (!isalpha(c)) c = gc();
}
int gs(char s[]) {
  int l = 0;
  char c = gc();
  while (isspace(c)) c = gc();
  while (c != EOF && !isspace(c)) {
    s[l++] = c;
    c = gc();
  }
  s[l] = '\0';
  return l;
}
template <class T>
bool gi(T &v) {
  v = 0;
  char c = gc();
  while (c != EOF && c != '-' && !isdigit(c)) c = gc();
  if (c == EOF) return false;
  bool neg = c == '-';
  if (neg) c = gc();
  while (isdigit(c)) {
    v = v * 10 + c - '0';
    c = gc();
  }
  if (neg) v = -v;
  return true;
}
const double PI = 2 * acos(0);
const string months[] = {"January",   "February", "March",    "April",
                         "May",       "June",     "July",     "August",
                         "September", "October",  "November", "December"};
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dr[] = {0, 0, -1, +1};
const int dc[] = {-1, +1, 0, 0};
const int inf = (int)1e9 + 5;
const long long linf = (long long)1e16 + 5;
const double eps = double(1e-9);
const long long mod = 1000000007;
long long w, h;
long long cal0() {
  long long res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long temp = 0;
      if ((i & 1) && (j & 1)) {
        temp = 12 * (i + j) * (w - i + 1) * (h - j + 1) % mod;
        res = (res + temp) % mod;
      }
      if (i & 1) {
        temp = 24 * (j >> 1) * ((w - i + 1) * 1ll * (h - j + 1) % mod) % mod;
        res = (res + temp) % mod;
      }
      if (j & 1) {
        temp = 24 * (i >> 1) * ((w - i + 1) * 1ll * (h - j + 1) % mod) % mod;
        res = (res + temp) % mod;
      }
    }
  return res;
}
long long cal1() {
  long long Res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long res = 0;
      if (i % 2 == 1 && j % 2 == 1) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else if (i % 2 == 0 && j % 2 == 0) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else {
        res = (res + (i >> 1) * (j >> 1)) % mod;
      }
      res = (res * (w - i + 1) * (h - j + 1)) % mod;
      Res = (Res + res) % mod;
    }
  Res = (Res * 24) % mod;
  return Res;
}
long long cal2() {
  long long Res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long res = 0;
      if (i % 2 == 1 && j % 2 == 1) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else if (i % 2 == 0 && j % 2 == 1) {
        res = (res + (i >> 1) * (j - 1)) % mod;
      } else if (i % 2 == 1 && j % 2 == 0) {
        res = (res + (i - 1) * (j >> 1)) % mod;
      }
      res = (res * (w - i + 1) * (h - j + 1)) % mod;
      Res = (Res + res) % mod;
    }
  Res = (Res * 12) % mod;
  return Res;
}
bool f[4005][4005] = {0};
long long cal3() {
  long long res = 0;
  if (h > 1) {
    res = (res + (h + 1) * 1ll * (h) * (h - 1) * (w + 1)) % mod;
  }
  if (w > 1) {
    res = (res + (w + 1) * 1ll * (w) * (w - 1) * (h + 1)) % mod;
  }
  long long temp;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j)
      if (!f[i][j]) {
        for (int k = 2; k * i <= w && k * j <= h; k++) {
          f[i * k][j * k] = 1;
          temp = ((k - 1) * 12ll) % mod;
          res = (res + temp * (w - i * k + 1) * (h - j * k + 1)) % mod;
        }
      }
  return res;
}
bool good(int x1, int y1, int x2, int y2, int x3, int y3) {
  int dx1 = x1 - x3, dy1 = y1 - y3;
  int dx2 = x2 - x3, dy2 = y2 - y3;
  if (dx1 * dy2 == dx2 * dy1) return false;
  int s = abs((x1 - x2) * (y1 + y2) + (x2 - x3) * (y2 + y3) +
              (x3 - x1) * (y3 + y1));
  return s % 2 == 0;
}
int triangle(int w, int h) {
  int ret = 0;
  ++w;
  ++h;
  for (__typeof(w) x1 = 0; x1 < (w); ++x1)
    for (__typeof(h) y1 = 0; y1 < (h); ++y1)
      for (__typeof(w) x2 = 0; x2 < (w); ++x2)
        for (__typeof(h) y2 = 0; y2 < (h); ++y2)
          for (__typeof(w) x3 = 0; x3 < (w); ++x3)
            for (__typeof(h) y3 = 0; y3 < (h); ++y3)
              if (good(x1, y1, x2, y2, x3, y3)) ++ret;
  return ret;
}
int main() {
  cin >> w >> h;
  long long cnt = (w + 1) * (h + 1);
  long long res = ((cnt * (cnt - 1)) % mod) * (cnt - 2) % mod;
  res = (res - cal0() + mod) % mod;
  res = (res - cal1() + mod) % mod;
  res = (res - cal2() + mod) % mod;
  res = (res - cal3() + mod) % mod;
  cout << res << endl;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

The Little Elephant is playing with the Cartesian coordinates' system. Most of all he likes playing with integer points. The Little Elephant defines an integer point as a pair of integers (x; y), such that 0 ≤ x ≤ w and 0 ≤ y ≤ h. Thus, the Little Elephant knows only (w + 1)·(h + 1) distinct integer points.

The Little Elephant wants to paint a triangle with vertexes at integer points, the triangle's area must be a positive integer. For that, he needs to find the number of groups of three points that form such triangle. At that, the order of points in a group matters, that is, the group of three points (0;0), (0;2), (2;2) isn't equal to the group (0;2), (0;0), (2;2).

Help the Little Elephant to find the number of groups of three integer points that form a nondegenerate triangle with integer area.

Input

A single line contains two integers w and h (1 ≤ w, h ≤ 4000).

Output

In a single output line print an integer — the remainder of dividing the answer to the problem by 1000000007 (109 + 7).

Examples

Input

2 1


Output

36


Input

2 2


Output

240

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class F, class T>
T convert(F a, int p = -1) {
  stringstream ss;
  if (p >= 0) ss << fixed << setprecision(p);
  ss << a;
  T r;
  ss >> r;
  return r;
}
template <class T>
void db(T a, int p = -1) {
  if (p >= 0) cout << fixed << setprecision(p);
  cout << a << " ";
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
template <class T>
struct Triple {
  T x, y, z;
  Triple() {}
  Triple(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {}
};
template <class T>
Triple<T> euclid(T a, T b) {
  if (b == 0) return Triple<T>(1, 0, a);
  Triple<T> r = euclid(b, a % b);
  return Triple<T>(r.y, r.x - a / b * r.y, r.z);
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
const int bfsz = 1 << 16;
char bf[bfsz + 5];
int rsz = 0;
int ptr = 0;
char gc() {
  if (rsz <= 0) {
    ptr = 0;
    rsz = fread(bf, 1, bfsz, stdin);
    if (rsz <= 0) return EOF;
  }
  --rsz;
  return bf[ptr++];
}
void ga(char &c) {
  c = EOF;
  while (!isalpha(c)) c = gc();
}
int gs(char s[]) {
  int l = 0;
  char c = gc();
  while (isspace(c)) c = gc();
  while (c != EOF && !isspace(c)) {
    s[l++] = c;
    c = gc();
  }
  s[l] = '\0';
  return l;
}
template <class T>
bool gi(T &v) {
  v = 0;
  char c = gc();
  while (c != EOF && c != '-' && !isdigit(c)) c = gc();
  if (c == EOF) return false;
  bool neg = c == '-';
  if (neg) c = gc();
  while (isdigit(c)) {
    v = v * 10 + c - '0';
    c = gc();
  }
  if (neg) v = -v;
  return true;
}
const double PI = 2 * acos(0);
const string months[] = {"January",   "February", "March",    "April",
                         "May",       "June",     "July",     "August",
                         "September", "October",  "November", "December"};
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dr[] = {0, 0, -1, +1};
const int dc[] = {-1, +1, 0, 0};
const int inf = (int)1e9 + 5;
const long long linf = (long long)1e16 + 5;
const double eps = double(1e-9);
const long long mod = 1000000007;
long long w, h;
long long cal0() {
  long long res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long temp = 0;
      if ((i & 1) && (j & 1)) {
        temp = 12 * (i + j) * (w - i + 1) * (h - j + 1) % mod;
        res = (res + temp) % mod;
      }
      if (i & 1) {
        temp = 24 * (j >> 1) * ((w - i + 1) * 1ll * (h - j + 1) % mod) % mod;
        res = (res + temp) % mod;
      }
      if (j & 1) {
        temp = 24 * (i >> 1) * ((w - i + 1) * 1ll * (h - j + 1) % mod) % mod;
        res = (res + temp) % mod;
      }
    }
  return res;
}
long long cal1() {
  long long Res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long res = 0;
      if (i % 2 == 1 && j % 2 == 1) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else if (i % 2 == 0 && j % 2 == 0) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else {
        res = (res + (i >> 1) * (j >> 1)) % mod;
      }
      res = (res * (w - i + 1) * (h - j + 1)) % mod;
      Res = (Res + res) % mod;
    }
  Res = (Res * 24) % mod;
  return Res;
}
long long cal2() {
  long long Res = 0;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j) {
      long long res = 0;
      if (i % 2 == 1 && j % 2 == 1) {
        res = (res + (i >> 1) * (j >> 1)) % mod;
        res = (res + (i >> 1) * (j >> 1)) % mod;
      } else if (i % 2 == 0 && j % 2 == 1) {
        res = (res + (i >> 1) * (j - 1)) % mod;
      } else if (i % 2 == 1 && j % 2 == 0) {
        res = (res + (i - 1) * (j >> 1)) % mod;
      }
      res = (res * (w - i + 1) * (h - j + 1)) % mod;
      Res = (Res + res) % mod;
    }
  Res = (Res * 12) % mod;
  return Res;
}
bool f[4005][4005] = {0};
long long cal3() {
  long long res = 0;
  if (h > 1) {
    res = (res + (h + 1) * 1ll * (h) * (h - 1) * (w + 1)) % mod;
  }
  if (w > 1) {
    res = (res + (w + 1) * 1ll * (w) * (w - 1) * (h + 1)) % mod;
  }
  long long temp;
  for (__typeof(w) i = (1); i <= (w); ++i)
    for (__typeof(h) j = (1); j <= (h); ++j)
      if (!f[i][j]) {
        for (int k = 2; k * i <= w && k * j <= h; k++) {
          f[i * k][j * k] = 1;
          temp = ((k - 1) * 12ll) % mod;
          res = (res + temp * (w - i * k + 1) * (h - j * k + 1)) % mod;
        }
      }
  return res;
}
bool good(int x1, int y1, int x2, int y2, int x3, int y3) {
  int dx1 = x1 - x3, dy1 = y1 - y3;
  int dx2 = x2 - x3, dy2 = y2 - y3;
  if (dx1 * dy2 == dx2 * dy1) return false;
  int s = abs((x1 - x2) * (y1 + y2) + (x2 - x3) * (y2 + y3) +
              (x3 - x1) * (y3 + y1));
  return s % 2 == 0;
}
int triangle(int w, int h) {
  int ret = 0;
  ++w;
  ++h;
  for (__typeof(w) x1 = 0; x1 < (w); ++x1)
    for (__typeof(h) y1 = 0; y1 < (h); ++y1)
      for (__typeof(w) x2 = 0; x2 < (w); ++x2)
        for (__typeof(h) y2 = 0; y2 < (h); ++y2)
          for (__typeof(w) x3 = 0; x3 < (w); ++x3)
            for (__typeof(h) y3 = 0; y3 < (h); ++y3)
              if (good(x1, y1, x2, y2, x3, y3)) ++ret;
  return ret;
}
int main() {
  cin >> w >> h;
  long long cnt = (w + 1) * (h + 1);
  long long res = ((cnt * (cnt - 1)) % mod) * (cnt - 2) % mod;
  res = (res - cal0() + mod) % mod;
  res = (res - cal1() + mod) % mod;
  res = (res - cal2() + mod) % mod;
  res = (res - cal3() + mod) % mod;
  cout << res << endl;
}

```