#include <bits/stdc++.h>
using namespace std;
int INP, AM, REACHEOF;
char BUF[(1 << 12) + 1], *inp = BUF;
const long double PI = acos((long double)-1.0);
const long long MOD = 1000000007LL;
int area(int x1, int y1, int x2, int y2) { return x1 * y2 - x2 * y1; }
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long x, int k) {
  if (k == 0) return 1;
  if (k == 1) return x % MOD;
  long long mid = power(x, k >> 1);
  mid = mid * mid % MOD;
  if (k & 1)
    return mid * x % MOD;
  else
    return mid;
}
long long inv(long long x) { return power(x, MOD - 2); }
int get(int x, int n) {
  if (n % 2 != x) --n;
  return (n - x) / 2 + 1;
}
int main() {
  int w, h;
  while (cin >> w >> h) {
    long long res = 0;
    for (int x1 = 0, _a = (2); x1 < _a; x1++)
      for (int y1 = 0, _a = (2); y1 < _a; y1++)
        for (int x2 = 0, _a = (2); x2 < _a; x2++)
          for (int y2 = 0, _a = (2); y2 < _a; y2++)
            for (int x3 = 0, _a = (2); x3 < _a; x3++)
              for (int y3 = 0, _a = (2); y3 < _a; y3++)
                if (make_pair(x1, y1) <= make_pair(x2, y2) &&
                    make_pair(x2, y2) <= make_pair(x3, y3))
                  if (area(x2 - x1, y2 - y1, x3 - x1, y3 - y1) % 2 == 0) {
                    long long can1 = get(x1, w) * get(y1, h);
                    long long can2 = get(x2, w) * get(y2, h);
                    long long can3 = get(x3, w) * get(y3, h);
                    if (make_pair(x1, y1) == make_pair(x2, y2)) --can2;
                    if (make_pair(x1, y1) == make_pair(x3, y3)) --can3;
                    if (make_pair(x2, y2) == make_pair(x3, y3)) --can3;
                    if (can2 <= 0) continue;
                    if (can3 <= 0) continue;
                    if (make_pair(x1, y1) == make_pair(x2, y2) &&
                        make_pair(x1, y1) == make_pair(x3, y3))
                      res = (res + can1 * can2 % MOD * can3) % MOD;
                    else if (make_pair(x1, y1) == make_pair(x2, y2) ||
                             make_pair(x1, y1) == make_pair(x3, y3) ||
                             make_pair(x2, y2) == make_pair(x3, y3))
                      res = (res + can1 * can2 % MOD * can3 % MOD * 3) % MOD;
                    else
                      res = (res + can1 * can2 % MOD * can3 % MOD * 6) % MOD;
                  }
    for (int x = (-w), _b = (w); x <= _b; x++)
      for (int y = (0), _b = (h); y <= _b; y++)
        if (y > 0 || x > 0) {
          int g = gcd(abs(x), y) - 1;
          if (g > 0) {
            res -= (w - abs(x) + 1) * (h - abs(y) + 1) % MOD * g * 6 % MOD;
            if (res < 0) res += MOD;
          }
        }
    cout << res << endl;
  }
  return 0;
}

### Prompt

Generate 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;
int INP, AM, REACHEOF;
char BUF[(1 << 12) + 1], *inp = BUF;
const long double PI = acos((long double)-1.0);
const long long MOD = 1000000007LL;
int area(int x1, int y1, int x2, int y2) { return x1 * y2 - x2 * y1; }
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long x, int k) {
  if (k == 0) return 1;
  if (k == 1) return x % MOD;
  long long mid = power(x, k >> 1);
  mid = mid * mid % MOD;
  if (k & 1)
    return mid * x % MOD;
  else
    return mid;
}
long long inv(long long x) { return power(x, MOD - 2); }
int get(int x, int n) {
  if (n % 2 != x) --n;
  return (n - x) / 2 + 1;
}
int main() {
  int w, h;
  while (cin >> w >> h) {
    long long res = 0;
    for (int x1 = 0, _a = (2); x1 < _a; x1++)
      for (int y1 = 0, _a = (2); y1 < _a; y1++)
        for (int x2 = 0, _a = (2); x2 < _a; x2++)
          for (int y2 = 0, _a = (2); y2 < _a; y2++)
            for (int x3 = 0, _a = (2); x3 < _a; x3++)
              for (int y3 = 0, _a = (2); y3 < _a; y3++)
                if (make_pair(x1, y1) <= make_pair(x2, y2) &&
                    make_pair(x2, y2) <= make_pair(x3, y3))
                  if (area(x2 - x1, y2 - y1, x3 - x1, y3 - y1) % 2 == 0) {
                    long long can1 = get(x1, w) * get(y1, h);
                    long long can2 = get(x2, w) * get(y2, h);
                    long long can3 = get(x3, w) * get(y3, h);
                    if (make_pair(x1, y1) == make_pair(x2, y2)) --can2;
                    if (make_pair(x1, y1) == make_pair(x3, y3)) --can3;
                    if (make_pair(x2, y2) == make_pair(x3, y3)) --can3;
                    if (can2 <= 0) continue;
                    if (can3 <= 0) continue;
                    if (make_pair(x1, y1) == make_pair(x2, y2) &&
                        make_pair(x1, y1) == make_pair(x3, y3))
                      res = (res + can1 * can2 % MOD * can3) % MOD;
                    else if (make_pair(x1, y1) == make_pair(x2, y2) ||
                             make_pair(x1, y1) == make_pair(x3, y3) ||
                             make_pair(x2, y2) == make_pair(x3, y3))
                      res = (res + can1 * can2 % MOD * can3 % MOD * 3) % MOD;
                    else
                      res = (res + can1 * can2 % MOD * can3 % MOD * 6) % MOD;
                  }
    for (int x = (-w), _b = (w); x <= _b; x++)
      for (int y = (0), _b = (h); y <= _b; y++)
        if (y > 0 || x > 0) {
          int g = gcd(abs(x), y) - 1;
          if (g > 0) {
            res -= (w - abs(x) + 1) * (h - abs(y) + 1) % MOD * g * 6 % MOD;
            if (res < 0) res += MOD;
          }
        }
    cout << res << endl;
  }
  return 0;
}

```