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