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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MOD = 1000000007;
long long powMod(long long x, int y) {
  int ret = 1;
  for (; y; y >>= 1) {
    if (y & 1) ret = ret * x % MOD;
    x = x * x % MOD;
  }
  return ret;
}
long long C2(int n) { return n * (long long)(n - 1) / 2 % MOD; }
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
struct pt {
  int a, b, c, d;
  pt(int ta, int tb, int tc, int td) : a(ta), b(tb), c(tc), d(td) {}
  pt() {}
  bool operator<(const pt &x) const {
    if (a != x.a) return a < x.a;
    if (b != x.b) return b < x.b;
    if (c != x.c) return c < x.c;
    return d < x.d;
  }
};
int main() {
  int h, w;
  cin >> h >> w;
  ++h, ++w;
  int ways = 0;
  map<pt, int> m;
  for (int i = 1; i <= h; ++i)
    for (int j = 1; j <= w; ++j) {
      int xodd = (i - 1 + 1) / 2 + (h - i + 1) / 2, xeven = h - xodd;
      int yodd = (j - 1 + 1) / 2 + (w - j + 1) / 2, yeven = w - yodd;
      ++m[pt(xodd, xeven, yodd, yeven)];
    }
  for (typeof(m.begin()) it = m.begin(); it != m.end(); it++) {
    int x[2] = {it->first.b, it->first.a}, y[2] = {it->first.d, it->first.c};
    int all = it->second;
    for (int a = 0; a < 2; a++)
      for (int b = 0; b < 2; b++)
        for (int c = 0; c < 2; c++)
          for (int d = 0; d < 2; d++)
            if ((a * d - b * c) % 2 == 0) {
              int plan1 = x[a] * y[b], plan2 = x[c] * y[d];
              if (a == b && a == 0) --plan1;
              if (c == d && c == 0) --plan2;
              ways = (ways + plan1 * (long long)plan2 % MOD * all) % MOD;
              if (a == c && b == d) {
                ways = (ways - plan1 % MOD * (long long)all) % MOD;
                if (ways < 0) ways += MOD;
              }
            }
  }
  for (int dx = 0; dx < h; ++dx)
    for (int dy = 0; dy < w; ++dy) {
      if (!dx && !dy) continue;
      int num = gcd(dx, dy);
      if (1 == num) continue;
      --num;
      ways =
          (ways - num * (h - dx) % MOD * (long long)(w - dy) % MOD * 6) % MOD;
      if (dx != 0 && dy != 0)
        ways =
            (ways - num * (h - dx) % MOD * (long long)(w - dy) % MOD * 6) % MOD;
    }
  cout << (ways + MOD) % MOD << endl;
  return 0;
}