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;
long long p[2][2];
int g[4003][4003];
int main() {
  int x, y, i, j;
  while (~scanf("%d%d", &x, &y)) {
    x++, y++;
    for (i = 0; i < 2; i++)
      for (j = 0; j < 2; j++)
        p[i][j] =
            ((i == 1) ? x / 2 : x - x / 2) * ((j == 1) ? y / 2 : y - y / 2);
    int a, b, c, d, e, f;
    long long ans = 0, zero = 0;
    for (a = 0; a < 2; a++)
      for (b = 0; b < 2; b++)
        for (c = 0; c < 2; c++)
          for (d = 0; d < 2; d++)
            for (e = 0; e < 2; e++)
              for (f = 0; f < 2; f++) {
                int x1 = c - a, y1 = d - b, x2 = e - a, y2 = f - b;
                int s = x1 * y2 - x2 * y1;
                if (s < 0) s = -s;
                if (s % 2 == 0) {
                  long long tmp = (p[a][b] * p[c][d] % 1000000007ll) * p[e][f] %
                                  1000000007ll;
                  ans = (ans + tmp) % 1000000007ll;
                }
              }
    long long s = x * y;
    zero += s;
    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 < x; i++)
      for (j = 0; j < y; j++) {
        if (i == 0)
          g[i][j] = j;
        else if (j == 0)
          g[i][j] = i;
        else if (i > j)
          g[i][j] = g[i % j][j];
        else
          g[i][j] = g[i][j % i];
      }
    for (i = 1; i < x; i++)
      for (j = 1; j < y; j++)
        if (g[i][j] >= 2) {
          long long tmp = (long long)((g[i][j] - 1) * (x - i) % 1000000007ll *
                                      (y - j) * 12 % 1000000007ll);
          zero = (zero + tmp) % 1000000007ll;
        }
    ans = (ans - zero + 1000000007ll) % 1000000007ll;
    printf("%lld\n", ans);
  }
  return 0;
}