#include <bits/stdc++.h>
using namespace std;
#define ll long long

signed main () {
    ll n, m;
    cin >> n >> m;
    ll S=n*m*2;
    if (n>m) swap(n, m);
    int x=1, y=2;
    while (x<=n && y<=m && x*y<n*m) {
        S+=((n*m)/(x*y))*x*y;
        if (x<y && x<n) x++;
        else if (x>=y && y<m) y++;
    } cout << S;
}