#include <bits/stdc++.h>
using namespace std;
long long int modulo = 1000000007;
long long int mcd(long long int a, long long int b) {
  if (a < b) return mcd(b, a);
  if (b == 0) return a;
  return mcd(a % b, b);
}
long long int cuantos(int p, int tope) {
  if (p == 1) return (tope + 1) / 2;
  return (tope + 2) / 2;
}
int main() {
  long long int w, h;
  cin >> w >> h;
  long long int count = 0;
  for (int c = 0; c < 16; c++) {
    int x1 = c & 1;
    int x2 = (c & 2) / 2;
    int x3 = (c & 4) / 4;
    int x4 = (c & 8) / 8;
    int p = (max(x1, x2) + max(x3, x4) + max((x1 + x3) % 2, (x2 + x4) % 2)) % 2;
    if (p == 0) {
      for (long long int pi = 0; pi < 2; pi++) {
        for (long long int pj = 0; pj < 2; pj++) {
          long long int cp1 =
              cuantos((x1 + pi) % 2, h) * cuantos((x2 + pj) % 2, w);
          if (x1 == 0 and x2 == 0) cp1--;
          long long int cp2 =
              cuantos((x3 + pi) % 2, h) * cuantos((x4 + pj) % 2, w);
          if (x3 == 0 and x4 == 0) cp2--;
          long long int adicion;
          if (x1 == x3 and x2 == x4)
            adicion = (cp1 * cp2 - cp1) % modulo;
          else
            adicion = (cp1 * cp2) % modulo;
          count += cuantos(pi, h) * cuantos(pj, w) * adicion;
        }
      }
    }
  }
  count %= modulo;
  long long int degen = 0;
  for (long long int i = 1; i <= h; i++)
    for (long long int j = 1; j <= w; j++)
      degen += 12 * (mcd(i, j) - 1) * (h - i + 1) * (w - j + 1);
  degen = (degen + (w + 1) * w * (w - 1) * (h + 1) +
           (h + 1) * h * (h - 1) * (w + 1)) %
          modulo;
  cout << (count + modulo - degen) % modulo << endl;
}

### Prompt

Please formulate 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;
long long int modulo = 1000000007;
long long int mcd(long long int a, long long int b) {
  if (a < b) return mcd(b, a);
  if (b == 0) return a;
  return mcd(a % b, b);
}
long long int cuantos(int p, int tope) {
  if (p == 1) return (tope + 1) / 2;
  return (tope + 2) / 2;
}
int main() {
  long long int w, h;
  cin >> w >> h;
  long long int count = 0;
  for (int c = 0; c < 16; c++) {
    int x1 = c & 1;
    int x2 = (c & 2) / 2;
    int x3 = (c & 4) / 4;
    int x4 = (c & 8) / 8;
    int p = (max(x1, x2) + max(x3, x4) + max((x1 + x3) % 2, (x2 + x4) % 2)) % 2;
    if (p == 0) {
      for (long long int pi = 0; pi < 2; pi++) {
        for (long long int pj = 0; pj < 2; pj++) {
          long long int cp1 =
              cuantos((x1 + pi) % 2, h) * cuantos((x2 + pj) % 2, w);
          if (x1 == 0 and x2 == 0) cp1--;
          long long int cp2 =
              cuantos((x3 + pi) % 2, h) * cuantos((x4 + pj) % 2, w);
          if (x3 == 0 and x4 == 0) cp2--;
          long long int adicion;
          if (x1 == x3 and x2 == x4)
            adicion = (cp1 * cp2 - cp1) % modulo;
          else
            adicion = (cp1 * cp2) % modulo;
          count += cuantos(pi, h) * cuantos(pj, w) * adicion;
        }
      }
    }
  }
  count %= modulo;
  long long int degen = 0;
  for (long long int i = 1; i <= h; i++)
    for (long long int j = 1; j <= w; j++)
      degen += 12 * (mcd(i, j) - 1) * (h - i + 1) * (w - j + 1);
  degen = (degen + (w + 1) * w * (w - 1) * (h + 1) +
           (h + 1) * h * (h - 1) * (w + 1)) %
          modulo;
  cout << (count + modulo - degen) % modulo << endl;
}

```