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;
int mod = 1000000007;
int r = 0, w, h;
int ans[2][2], x[2], y[2];
int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
int mul(int a, int b) { return (a * 1LL * b) % mod; }
int go1() {
  int r = 0;
  for (int i = 0; i <= w; i++)
    for (int j = 0; j <= h; j++)
      for (int i1 = 0; i1 <= w; i1++)
        for (int j1 = 0; j1 <= h; j1++)
          for (int i2 = 0; i2 <= w; i2++)
            for (int j2 = 0; j2 <= h; j2++) {
              if (i == i1 && j == j1) continue;
              if (i == i2 && j == j2) continue;
              if (i2 == i1 && j2 == j1) continue;
              int s = ((i1 - i) * (j2 - j) - (j1 - j) * (i2 - i));
              if (s < 0) s = -s;
              if (s == 0 || s % 2) continue;
              r++;
            }
  return r;
}
int gcd(int a, int b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}
int main(void) {
  scanf("%d %d", &w, &h);
  for (int i = 0; i <= w; i++) x[i % 2]++;
  for (int i = 0; i <= h; i++) y[i % 2]++;
  for (int dx = 0; dx <= w; dx++)
    for (int dy = 0; dy <= h; dy++) {
      if (dx == 0 && dy == 0) continue;
      int q1 = (w - dx + 1), q2 = (h - dy + 1), q = mul(q1, q2);
      q = mul(q, 6);
      if (dx && dy) q = mul(q, 2);
      r = sub(r, q);
      int in = gcd(dx, dy) - 1;
      if (in < 0) in = 0;
      in = mul(in, q);
      r = sub(r, in);
    }
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      for (int i1 = 0; i1 < 2; i1++)
        for (int j1 = 0; j1 < 2; j1++)
          for (int i2 = 0; i2 < 2; i2++)
            for (int j2 = 0; j2 < 2; j2++) {
              if (((i1 - i) * (j2 - j) - (j1 - j) * (i2 - i)) % 2) continue;
              int q1 = mul(x[i1], y[j1]), q2 = mul(x[i2], y[j2]),
                  q = mul(q1, q2);
              ans[i][j] = add(ans[i][j], q);
            }
      ans[i][j] = sub(ans[i][j], 1);
    }
  int t = 0;
  for (int i = 0; i <= w; i++)
    for (int j = 0; j <= h; j++) {
      r = add(r, ans[i % 2][j % 2]);
    }
  printf("%d\n", r);
  return 0;
}