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;
long long W, H, w[2], h[2], c[4001][4001];
int main() {
  cin >> W >> H;
  w[1] = (W - 1) / 2 + 1, h[1] = (H - 1) / 2 + 1;
  w[0] = W - w[1] + 1, h[0] = H - h[1] + 1;
  for (int i = 0; i <= 4000; i++) c[0][i] = c[i][0] = i;
  for (int i = 1; i <= 4000; i++)
    for (int j = 1; j <= 4000; j++) {
      if (i <= j)
        c[i][j] = c[i][j - i];
      else
        c[i][j] = c[i - j][j];
    }
  long long ret = 0;
  for (int x = 0; x < 2; x++)
    for (int y = 0; y < 2; y++)
      for (int x0 = 0; x0 < 2; x0++)
        for (int y0 = 0; y0 < 2; y0++)
          for (int x1 = 0; x1 < 2; x1++)
            for (int y1 = 0; y1 < 2; y1++) {
              int t = (x0 - x) * (y1 - y) - (y0 - y) * (x1 - x);
              if (t % 2 == 0) {
                ret = ret + w[x] * w[x0] * w[x1] % 1000000007 *
                                (h[y] * h[y0] * h[y1] % 1000000007) %
                                1000000007;
                if (ret >= 1000000007) ret %= 1000000007;
              }
            }
  long long t = (W + 1) * (H + 1);
  ret = (ret - t) % 1000000007;
  if (ret < 0) ret += 1000000007;
  ret = (ret - t * (t - 1) * 3 % 1000000007) % 1000000007;
  if (ret < 0) ret += 1000000007;
  for (int i = 0; i <= W; i++)
    for (int j = 0; j <= H; j++) {
      if (i == 0 && j == 0) continue;
      t = c[i][j];
      t = (W - i + 1) * (H - j + 1) * 6 * (t - 1) * ((i && j) ? 2 : 1) %
          1000000007;
      ret = (ret - t) % 1000000007;
      if (ret < 0) ret += 1000000007;
    }
  cout << ret << endl;
}