#include <bits/stdc++.h>
using namespace std;
long long m,n,i,a,s,b,x,y;
int main()
{
    cin >> n >> m;
    x=n;
    y=m;
    if(n<m) b=n,a=m,swap(n,m);
    else b=m,a=n;
    while(b!=0)
    {
        s+=a*b*(m/b);
        b--;
    }
    b=1;
    a--;
        for(i=0; i<m; i++)
        {
            while(a>1)
            {
                s+=a;
                a--;
            }
            a=n-1;
        }
        n=x;
        m=y;
        if(n!=1 or m!=1)cout << "\n" << s+n*m << "\n";
        else cout << "\n" << 1 << "\n";
    return 0;
}
