#include <bits/stdc++.h>
using namespace std;
const long long mo = 1e9 + 7;
int d[4008][4008];
int solve(int x, int y) {
  if (x < y) swap(x, y);
  int tmp = 0;
  int xxx[2], yyy[2];
  xxx[0] = x >> 1;
  xxx[1] = (x - 1) >> 1;
  yyy[0] = y >> 1;
  yyy[1] = (y - 1) >> 1;
  if (x & 1 && y & 1)
    tmp += (1ll * xxx[0] * yyy[0] % mo) << 2 % mo;
  else {
    tmp += (1ll * xxx[0] * yyy[1] % mo) << 2 % mo;
    tmp += (1ll * xxx[1] * yyy[0] % mo) << 2 % mo;
    tmp += (1ll * xxx[1] * yyy[1] % mo) << 2 % mo;
  }
  if (!(x & 1) || !(y & 1)) tmp += (x - 1 + y - 1) << 1 % mo;
  int xx[2], yy[2];
  xx[0] = (x >> 1) + 1;
  xx[1] = (x + 1) >> 1;
  yy[0] = (y >> 1) + 1;
  yy[1] = (y + 1) >> 1;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (((i & y) ^ (j & x)) == 0) {
        tmp += (1ll * xx[i] * yy[j]) << 1 % mo;
      }
  tmp -= (d[x][y] + 1) << 1 % mo;
  tmp = ((tmp % mo) + mo) % mo;
  return tmp;
}
int main() {
  int t, h;
  cin >> t >> h;
  for (int i = 1; i <= 4000; ++i) d[0][i] = d[i][0] = i;
  for (int i = 1; i <= 4000; ++i)
    for (int j = 1; j <= 4000; ++j)
      if (i > j)
        d[i][j] = d[j][i - j];
      else
        d[i][j] = d[i][j - i];
  int ans = 0;
  for (int i = 1; i <= t; ++i)
    for (int j = 1; j <= h; ++j) {
      ans += 1ll * solve(i, j) * (t - i + 1) % mo * (h - j + 1) % mo;
      ans %= mo;
    }
  cout << 1ll * ans * 6 % mo << endl;
}

### Prompt

Your task is to create 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;
const long long mo = 1e9 + 7;
int d[4008][4008];
int solve(int x, int y) {
  if (x < y) swap(x, y);
  int tmp = 0;
  int xxx[2], yyy[2];
  xxx[0] = x >> 1;
  xxx[1] = (x - 1) >> 1;
  yyy[0] = y >> 1;
  yyy[1] = (y - 1) >> 1;
  if (x & 1 && y & 1)
    tmp += (1ll * xxx[0] * yyy[0] % mo) << 2 % mo;
  else {
    tmp += (1ll * xxx[0] * yyy[1] % mo) << 2 % mo;
    tmp += (1ll * xxx[1] * yyy[0] % mo) << 2 % mo;
    tmp += (1ll * xxx[1] * yyy[1] % mo) << 2 % mo;
  }
  if (!(x & 1) || !(y & 1)) tmp += (x - 1 + y - 1) << 1 % mo;
  int xx[2], yy[2];
  xx[0] = (x >> 1) + 1;
  xx[1] = (x + 1) >> 1;
  yy[0] = (y >> 1) + 1;
  yy[1] = (y + 1) >> 1;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (((i & y) ^ (j & x)) == 0) {
        tmp += (1ll * xx[i] * yy[j]) << 1 % mo;
      }
  tmp -= (d[x][y] + 1) << 1 % mo;
  tmp = ((tmp % mo) + mo) % mo;
  return tmp;
}
int main() {
  int t, h;
  cin >> t >> h;
  for (int i = 1; i <= 4000; ++i) d[0][i] = d[i][0] = i;
  for (int i = 1; i <= 4000; ++i)
    for (int j = 1; j <= 4000; ++j)
      if (i > j)
        d[i][j] = d[j][i - j];
      else
        d[i][j] = d[i][j - i];
  int ans = 0;
  for (int i = 1; i <= t; ++i)
    for (int j = 1; j <= h; ++j) {
      ans += 1ll * solve(i, j) * (t - i + 1) % mo * (h - j + 1) % mo;
      ans %= mo;
    }
  cout << 1ll * ans * 6 % mo << endl;
}

```