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 int MOD = 1000000007;
int n, m, Gcd[4100][4100];
long long C(int n, int d) { return d ? ((n + 1) / 2) : (n / 2 + 1); }
int gcd(int x, int y) {
  if (y == 0) return x;
  if (Gcd[x][y]) return Gcd[x][y];
  return Gcd[x][y] = gcd(y, x % y);
}
int main() {
  cin >> n >> m;
  long long ans = 0;
  for (int x = (0); x <= (1); x++)
    for (int y = (0); y <= (1); y++)
      for (int da = (0); da <= (1); da++)
        for (int db = (0); db <= (1); db++)
          for (int dc = (0); dc <= (1); dc++)
            for (int dd = (0); dd <= (1); dd++)
              if (((x + da) * (y + dd) + (x + dc) * (y + db)) % 2 == 0)
                ans = (C(n, da) * C(m, db) * C(n, dc) * C(m, dd) % MOD *
                           C(n, x) * C(m, y) +
                       ans) %
                      MOD;
  for (long long dx = 0; dx <= n; dx++)
    for (long long dy = 0; dy <= m; dy++) {
      long long ret = 0;
      if (dx || dy)
        ret = 6;
      else
        ret = 1;
      ret += max(0, gcd(dx, dy) - 1) * 6;
      ret = ret * ((n - dx + 1) * (m - dy + 1)) % MOD;
      if (dx && dy) ret <<= 1;
      if (ret >= MOD) ret -= MOD;
      ans = ans - ret;
      if (ans < 0) ans += MOD;
    }
  cout << (ans + MOD) % MOD << endl;
  return 0;
}