#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define int long long
#define ll long long
#define con continue
#define fir first
#define sec second
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define rev reverse
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define endl "\n"
using namespace std;
main()
{
    FAST
    int n,m;
    cin>>n>>m;
    int k=n*m,o=2;
    for(o;o<=n*m;o++)
    {
        if(n%o==0)
        {
            k+=(n*o);
        }
        if(m%o==0)
        {
            k+=(m*o);
        }
    }
    if(n%2==m%2)
        cout<<k<<endl;
    else
    {
        if(max(n, m)%2==1)
            cout<<k+max(n, m);
        else
            cout<<k-max(n, m);
    }
}
