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 w, h;
bool vis[4020][4020];
long long vrt = 0;
inline int eeq(int c, int dx, int dy) {
  dx = abs(dx);
  int ug1 = max(0, h - c * dy + 1) * max(0, w - c * dx + 1) -
            max(0, h - c * dy - (dy - 1)) * max(0, w - c * dx - (dx - 1));
  int ug2 =
      max(0, h - (c + 1) * dy + 1) * max(0, w - (c + 1) * dx + 1) -
      max(0, h - (c + 1) * dy - (dy - 1)) * max(0, w - (c + 1) * dx - (dx - 1));
  return ug1 - ug2;
}
inline long long process(int dx, int dy) {
  long long cc = 0;
  long long vrt = 0;
  if (!vis[dx][dy]) {
    for (int c = 0; dx * c <= w && dy * c <= h; c++) {
      cc++;
      vis[dx * c][dy * c] = true;
    }
    for (int i = 1; i <= cc; i++) {
      vrt +=
          (eeq(i, dx, dy) * i * (((long long)i + 1) * (i - 1))) % 1000000007LL;
      vrt %= 1000000007LL;
    }
  }
  return vrt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> w >> h;
  memset(vis, 0, sizeof vis);
  for (int dx = 0; dx <= w; dx++)
    for (int dy = dx == 0; dy <= h; dy++) {
      vrt += process(dx, dy) * (1 + (dy != 0 && dx != 0));
      vrt %= 1000000007LL;
    }
  long long ans = 0;
  for (int ki = 0; ki < 2; ki++)
    for (int kj = 0; kj < 2; kj++) {
      long long cc1 = ((w + 1 + ki) / 2) * ((h + 1 + kj) / 2);
      long long cc2 = (w + 1) * (h + 1) - cc1;
      ans += (((cc1 * cc2 * 2) % 1000000007LL) *
              ((((w + 2 - ki) / 2) * ((h + 2 - kj) / 2)) % 1000000007LL)) %
             1000000007LL;
      ans %= 1000000007LL;
    }
  long long ars = (w + 1) * (h + 1);
  cout << ((((ars * (ars - 1)) % 1000000007LL) * (ars - 2) - vrt - ans) %
               1000000007LL +
           1000000007LL) %
              1000000007LL;
}