// Bismi ALlah
#include "bits/stdc++.h"

using namespace std;

#define int long long

map <pair <int,int>,int> mp;
int ans;

void f(int n, int m) {
	if(mp.count({n, m})) {
		ans += mp[{n, m}];
		return;
	}
	if(n == 1 && m == 1) {
		mp[{n, m}] = 1;
		ans ++;
		return;
	}
	if(n % 2 == 0) {
		f(n/2, m);
		f(n/2, m);
		mp[{n, m}] = mp[{n/2, m}] + mp[{n/2, m}] + n * m;
		ans += n*m;
	}else if(m % 2 == 0) {
		f(n, m/2);
		f(n, m/2);
		mp[{n, m}] = mp[{n, m/2}] + mp[{n, m/2}] + n * m;
		ans += n*m;
	}else if(n > m) {
		f(n/2+1, m);
		f(n/2, m);
		mp[{n, m}] = mp[{n/2+1, m}] + mp[{n/2, m}] + n * m;
		ans += n * m;
	}else {
		f(n, m/2+1);
		f(n, m/2);
		mp[{n, m}] = mp[{n, m/2+1}] + mp[{n, m/2}] + n * m;
		ans += n * m;
	}
}

signed main () {
	ans = 0;
	int n, m;
	cin >> n >> m;
	f(n, m);
	cout << ans;
	return 0;
}