Triangles

Time Limit: 10000ms

Memory Limit: 65535kb

Description

How many triple of points A(xA,yA),B(xB,yB),C(xC,yC) which:

  •   xA,yA,xB,yB,xC,yC∈Z , Z means integers.

  •   0≤xA,xB,xC<n,0≤yA,yB,yC<m

  •   S△ABC∉Z? (S△ denotes the area of triangle)


Input

Input ends with EOF.

Each test case contains two integers n and m. (1≤n,m≤10^9)


Output

The only integer denotes the number possible triples, modulo 10^9+7.

Sample Input

2 2

Sample Output

24

Hint

There are 4 triangles. Each of them is counted 6 times.

Source

gxx

提交代码