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 long long MOD = 1000000007;
int gg[4001][4001];
int main() {
  if (0)
    freopen(
        ""
        ".in",
        "r", stdin);
  if (0)
    freopen(
        ""
        ".out",
        "w", stdout);
  int i, j, k, _T;
  int W, H;
  for (i = 0; i <= 4000; i++) gg[i][0] = gg[0][i] = i;
  for (i = 1; i <= 4000; i++)
    for (j = 1; j <= 4000; j++) {
      if (j < i)
        gg[i][j] = gg[j][i];
      else
        gg[i][j] = gg[i][j - i];
    }
  while (~scanf("%d%d", &W, &H)) {
    long long ans = 0;
    for (long long w = 1; w <= W; w++)
      for (long long h = 1; h <= H; h++) {
        long long mul = (W + 1 - w) * (H + 1 - h);
        long long now = 0;
        int ox = w / 2, ex = (w - 1) / 2;
        int oy = h / 2, ey = (h - 1) / 2;
        if (((w + 0) * (h + 0) + w * h) % 2 == 0) now += 4 * ex * ey;
        if (((w + 1) * (h + 0) + w * h) % 2 == 0) now += 4 * ox * ey;
        if (((w + 0) * (h + 1) + w * h) % 2 == 0) now += 4 * ex * oy;
        if (((w + 1) * (h + 1) + w * h) % 2 == 0) now += 4 * ox * oy;
        if ((h * w) % 2 == 0) now += 2 * (h - 1 + w - 1);
        ox = (w + 1) / 2, ex = (w / 2 + 1);
        oy = (h + 1) / 2, ey = (h / 2 + 1);
        if ((h * 0 + w * 0 + h * w) % 2 == 0) now += 2 * ex * ey;
        if ((h * 1 + w * 0 + h * w) % 2 == 0) now += 2 * ox * ey;
        if ((h * 0 + w * 1 + h * w) % 2 == 0) now += 2 * ex * oy;
        if ((h * 1 + w * 1 + h * w) % 2 == 0) now += 2 * ox * oy;
        int g = gg[h][w];
        now -= 2 * (g + 1);
        ans += now % MOD * mul % MOD;
      }
    ans %= MOD;
    ans += MOD;
    ans %= MOD;
    cout << ans * 6 % MOD << "\n";
  }
  return 0;
}