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 JAVA):

Solution:
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    int MOD = (int) (1e9+7);
    public void solve(int testNumber, MyScanner in, PrintWriter out) {
        int h = in.nextInt(), w = in.nextInt();
        long res = solve(h,w);
        out.println(res);
    }

    private long solve(long h, long w) {
        h++; w++;
        long[][] num = new long[2][2];
        for (int i = 0; i < h; i++) for (int j = 0; j < w; j++)num[i%2][j%2]++;
        long numInt = 0;
        for (int x0 = 0; x0 < 2; x0++) for (int y0 = 0; y0 < 2; y0++) for (int x1 = 0; x1 < 2; x1++)
            for (int y1 = 0; y1 < 2; y1++) for (int x2 = 0; x2 < 2; x2++) for (int y2 = 0; y2 < 2; y2++){
                int dx1 = (x1-x0)&1, dy1 = (y1-y0)&1;
                int dx2 = (x2-x0)&1, dy2 = (y2-y0)&1;
                if((dx1*dy2-dx2*dy1&1)==0){
                    numInt = (numInt + num[x0][y0] * num[x1][y1] % MOD * num[x2][y2]) % MOD;
                }
            }

        long zero = 0;
        long S = h * w;
        zero += S;
        zero += S*(S-1)*3; zero %= MOD;

        zero += h*(h-1)%MOD*(h-2)*w;
        zero += w*(w-1)%MOD*(w-2)*h;
        zero %= MOD;

        for(int x=1;x<h;x++)for(int y=1;y<w;y++){
            int g = MathUtils.gcd(x,y);
            zero = (zero + (g-1) * (h-x) * (w-y) * 12) % MOD;
        }
        return (numInt - zero + MOD)  % MOD;
    }
}

class MyScanner {
    private final InputStream in;
    public MyScanner(InputStream in){
        this.in = in;
    }

    public int nextInt(){
        try{
            int c=in.read();
            if(c==-1) return c;
            while(c!='-'&&(c<'0'||'9'<c)){
                c=in.read();
                if(c==-1) return c;
            }
            if(c=='-') return -nextInt();
            int res=0;
            do{
                res*=10;
                res+=c-'0';
                c=in.read();
            }while('0'<=c&&c<='9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }


    }

class MathUtils {

    public static int gcd(int x,int y){
        while (y != 0) {
            x %= y;
            if (x == 0) return y;
            y %= x;
        }
        return x;
    }

    }