#include <bits/stdc++.h>
using namespace std;
int X, Y;
long long parity[10][10];
int gcd[4010][4010];
int main(void) {
  int i, j, a, b, c, d, e, f;
  cin >> X >> Y;
  X++;
  Y++;
  for ((i) = 0; (i) < (int)(2); (i)++)
    for ((j) = 0; (j) < (int)(2); (j)++)
      parity[i][j] =
          ((i == 1) ? X / 2 : (X - X / 2)) * ((j == 1) ? Y / 2 : (Y - Y / 2));
  long long ans = 0;
  for ((a) = 0; (a) < (int)(2); (a)++)
    for ((b) = 0; (b) < (int)(2); (b)++)
      for ((c) = 0; (c) < (int)(2); (c)++)
        for ((d) = 0; (d) < (int)(2); (d)++)
          for ((e) = 0; (e) < (int)(2); (e)++)
            for ((f) = 0; (f) < (int)(2); (f)++) {
              int x1 = c - a, y1 = d - b, x2 = e - a, y2 = f - b;
              int area = x1 * y2 - x2 * y1;
              if (area < 0) area = -area;
              if (area % 2 == 0) {
                long long tmp = parity[a][b] * parity[c][d] % 1000000007ll *
                                parity[e][f] % 1000000007ll;
                ans = (ans + tmp) % 1000000007ll;
              }
            }
  long long zero = 0;
  long long S = X * Y;
  zero = (zero + S) % 1000000007ll;
  zero = (zero + S * (S - 1) % 1000000007ll * 3 % 1000000007ll) % 1000000007ll;
  zero = (zero + X * Y % 1000000007ll * (Y - 1) % 1000000007ll * (Y - 2) %
                     1000000007ll) %
         1000000007ll;
  zero = (zero + Y * X % 1000000007ll * (X - 1) % 1000000007ll * (X - 2) %
                     1000000007ll) %
         1000000007ll;
  for ((i) = 0; (i) < (int)(X); (i)++)
    for ((j) = 0; (j) < (int)(Y); (j)++) {
      if (i == 0) {
        gcd[i][j] = j;
      } else if (j == 0) {
        gcd[i][j] = i;
      } else if (i < j) {
        gcd[i][j] = gcd[i][j % i];
      } else {
        gcd[i][j] = gcd[i % j][j];
      }
    }
  for (i = 1; i < X; i++)
    for (j = 1; j < Y; j++)
      if (gcd[i][j] >= 2) {
        long long tmp = (long long)(gcd[i][j] - 1) * (X - i) % 1000000007ll *
                        (Y - j) % 1000000007ll * 12 % 1000000007ll;
        zero = (zero + tmp) % 1000000007ll;
      }
  ans = (ans - zero + 1000000007ll) % 1000000007ll;
  cout << ans << endl;
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

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;
int X, Y;
long long parity[10][10];
int gcd[4010][4010];
int main(void) {
  int i, j, a, b, c, d, e, f;
  cin >> X >> Y;
  X++;
  Y++;
  for ((i) = 0; (i) < (int)(2); (i)++)
    for ((j) = 0; (j) < (int)(2); (j)++)
      parity[i][j] =
          ((i == 1) ? X / 2 : (X - X / 2)) * ((j == 1) ? Y / 2 : (Y - Y / 2));
  long long ans = 0;
  for ((a) = 0; (a) < (int)(2); (a)++)
    for ((b) = 0; (b) < (int)(2); (b)++)
      for ((c) = 0; (c) < (int)(2); (c)++)
        for ((d) = 0; (d) < (int)(2); (d)++)
          for ((e) = 0; (e) < (int)(2); (e)++)
            for ((f) = 0; (f) < (int)(2); (f)++) {
              int x1 = c - a, y1 = d - b, x2 = e - a, y2 = f - b;
              int area = x1 * y2 - x2 * y1;
              if (area < 0) area = -area;
              if (area % 2 == 0) {
                long long tmp = parity[a][b] * parity[c][d] % 1000000007ll *
                                parity[e][f] % 1000000007ll;
                ans = (ans + tmp) % 1000000007ll;
              }
            }
  long long zero = 0;
  long long S = X * Y;
  zero = (zero + S) % 1000000007ll;
  zero = (zero + S * (S - 1) % 1000000007ll * 3 % 1000000007ll) % 1000000007ll;
  zero = (zero + X * Y % 1000000007ll * (Y - 1) % 1000000007ll * (Y - 2) %
                     1000000007ll) %
         1000000007ll;
  zero = (zero + Y * X % 1000000007ll * (X - 1) % 1000000007ll * (X - 2) %
                     1000000007ll) %
         1000000007ll;
  for ((i) = 0; (i) < (int)(X); (i)++)
    for ((j) = 0; (j) < (int)(Y); (j)++) {
      if (i == 0) {
        gcd[i][j] = j;
      } else if (j == 0) {
        gcd[i][j] = i;
      } else if (i < j) {
        gcd[i][j] = gcd[i][j % i];
      } else {
        gcd[i][j] = gcd[i % j][j];
      }
    }
  for (i = 1; i < X; i++)
    for (j = 1; j < Y; j++)
      if (gcd[i][j] >= 2) {
        long long tmp = (long long)(gcd[i][j] - 1) * (X - i) % 1000000007ll *
                        (Y - j) % 1000000007ll * 12 % 1000000007ll;
        zero = (zero + tmp) % 1000000007ll;
      }
  ans = (ans - zero + 1000000007ll) % 1000000007ll;
  cout << ans << endl;
  return 0;
}

```