#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n, m, s = 0, mn, mx, b,k = 0,c;
    cin >> n >> m;
    if(n > m)
    {
        mn = m;
        mx = n;
    }else{
        mn = n;
        mx = m;
    }
    b = mx;
    c = mn;
    while (mx > 1)
    {
        mx = mx - 1;
        k = b / mx;
        s += (mx * mn)*k;
    }
    while (mn > 1)
    {
        mn = mn - 1;
        k = c / mn;
        s += (mx * mn)*k;
    }
    cout << s+2*(n*m)-2 << endl;

}
