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 n, m;
long long ans = 0;
long long mod = 1000000007;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int f1(int x, int y) {
  return 4 * (x - 1) / 2 * (y - 1) / 2 +
         ((x + 1) / 2 * (y + 1) / 2 * 2 - (gcd(x, y) + 1)) * 2;
}
int f2(int x, int y) {
  return 4 * ((x - 1) * (y - 1) - x / 2 * y / 2) +
         ((x + 1) * ((y + 1) / 2 + 1) - (gcd(x, y) + 1) - 2) * 2;
}
int f3(int x, int y) {
  return 4 * ((x - 1) * (y - 1) - x / 2 * y / 2) +
         ((x + 1) * (y + 1) - (gcd(x, y) + 1) - 2) * 2;
}
int calc(int x, int y) {
  if (x % 2 == 1 && y % 2 == 1) return f1(x, y);
  if (x % 2 == 0 && y % 2 == 1) return f2(y, x);
  if (x % 2 == 1 && y % 2 == 0) return f2(x, y);
  if (x % 2 == 0 && y % 2 == 0) return f3(x, y);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      long long res = 0;
      long long size = (n - i + 1) * (m - j + 1);
      if (i % 2 == 1 && j % 2 == 1)
        res = 0;
      else
        res = 4 + (i - 1) * 2 + (j - 1) * 2;
      res = (res + calc(i, j)) % mod;
      res = res * size % mod;
      ans = (ans + res) % mod;
    }
  cout << ans * 6 % mod << endl;
}