//============================================================================
// Author      : Bissenov Anuar
//============================================================================
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define run_faster ios::sync_with_stdio (false); cin.tie (0); cout.tie (0); ios_base::sync_with_stdio(0); cin.tie(nullptr);
#define F first
#define S second
#define emb emplace_back
#define pii pair<int,int>
#define all(v) (v.begin(),v.end())
#define rall(v) (v.rbegin(),v.rend())
using namespace std;

signed main()
{
    run_faster;
//	#ifndef ONLINE_JUDGE
//        freopen( "inverse.in" , "r" , stdin );
//        freopen( "inverse.out" , "w" , stdout );
//	#endif

    ll n, m;
    cin >> n >> m;
    ll res = n*m;
    ll lg = log2(n*m);
    while( lg>=0 ) {
        res += ((n*m)/(1ll<<lg))*(1ll<<lg);
        lg--;
    }
    ll cnt = 0;
    ll tot = n*m;
    while( tot ) {
        cnt += (tot&1);
        tot >>= 1;
    }
    if( cnt == 1 ) res -= n*m;
    cout << res;

    return 0;
} 
