#include <bits/stdc++.h>
#define ent '\n'
#define f first
#define s second

using namespace std;
typedef long long ll;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

const int N = 3e5 + 100;
const int mod = 1e9 + 7;

ll n , m , a[N] , cnt[N] , used[N];

void solve(){
	cin >> n >> m ;
	ll mx = max(n , m);
	ll mn = min(n,  m);
	ll ans = 0 ;
	while(mx){
		if(mx < mn){
			ll x = (n * m) / (mx * mx);
			ans += (x * mx * mx);
		}
		ll x = (n * m) / (mx * mn);
		ans += (x * mx * mn);
		mx--;
	}	
	cout << ans ;
}

int main(){ 
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int i = 1;i <= T;i++){
        solve();
    }
}
