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>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T x) {
  return (x >= 0) ? x : -x;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 4050;
const long long MOD = INF + 7;
int n, m, g[MAXN][MAXN];
long long num[2][2];
int get(int mod, int n) {
  if (n % 2 == 0 || mod == 1) return n / 2;
  return n / 2 + 1;
}
int gcd(int a, int b) {
  if (min(a, b) == 0) return a + b;
  return gcd(b % a, a);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < (int)(2); i++)
    for (int j = 0; j < (int)(2); j++)
      num[i][j] = get(i, n + 1) * get(j, m + 1);
  long long ans = 0;
  for (int x = 0; x < (int)(2); x++)
    for (int y = 0; y < (int)(2); y++)
      for (int x1 = 0; x1 < (int)(2); x1++)
        for (int YYYYYYYYYYYY1 = 0; YYYYYYYYYYYY1 < (int)(2); YYYYYYYYYYYY1++)
          for (int x2 = 0; x2 < (int)(2); x2++)
            for (int y2 = 0; y2 < (int)(2); y2++) {
              int value = (x2 - x) * (YYYYYYYYYYYY1 - y) - (x1 - x) * (y2 - y);
              if (value % 2 == 0) {
                long long cur = (num[x][y] * num[x1][YYYYYYYYYYYY1]) % MOD;
                cur = (cur * num[x2][y2]) % MOD;
                ans = (ans + cur) % MOD;
              }
            }
  long long ans2 = (n + 1) * (m + 1);
  for (int dx = 0; dx < (int)(n + 1); dx++)
    for (int dy = 0; dy < (int)(m + 1); dy++) {
      if (dx == 0 && dy == 0) continue;
      long long cur = (n - dx + 1) * (m - dy + 1);
      cur = (cur * (gcd(dx, dy) - 1) * 6) % MOD;
      if (dx > 0 && dy > 0) cur *= 2;
      ans2 = (ans2 + cur) % MOD;
    }
  ans2 += 1LL * ((n + 1) * (m + 1) - 1) * (n + 1) * (m + 1) * 3;
  ans %= MOD;
  ans2 %= MOD;
  cout << (ans + MOD - ans2) % MOD << endl;
  return 0;
}