    /*
Muqalzhar taui
*/
#include <bits/stdc++.h>
#include <iomanip>
   
#define ll long long
#define pb push_back
#define F first
#define S second
#define nl '\n'
#define all(x) x.begin(), x.end()
   
const int N = 3e5 + 7;
const int modd = 1e9 + 7;
const int INF = 1e9 + 7;
const double pi = 3.141592653589793238462643383279502884197;
using namespace std;

ll n, m;

void solve(){
	cin >> n >> m;
	if(n < m) swap(n, m);

	cout << ((n - 1) * m) * (log2((n - 1) * m) + 1) + m * (log2(m) + 1) + (n * m);
	// cout << ((n - 1) * m) * (log2((n - 1) * m) + 1);
	return;
}
   
int main(){
    // freopen("pails.in", "r", stdin);
    //  freopen("pails.out", "w", stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
      
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}