#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>

#define ssort(arr) sort(arr.begin(), arr.end())

using namespace std;


using ll = long long;

const ll INF = 1e9;


map<ll, ll> chache;


ll f(ll n){
    ll cnt = n;

    if(chache[n] != 0){
        return chache[n];
    }


    cnt += f(n / 2);
    cnt += f(n - (n / 2));

    chache[n] = cnt;
    return cnt;
}


ll f1(ll n, ll m){
    ll N = n * m;
    ll cnt = N;

    if(n % 2 == 0 || m % 2 == 0 || min(n, m) == 1){
        return f(N);
    }else{
        cout << min(n, m) << " " << max(n, m) - max(n, m) / 2 << "\n";
        cnt += f1(min(n, m), max(n, m) / 2);
        cnt += f1(min(n, m), max(n, m) - max(n, m) / 2);
    }

    return cnt;
}

ll f3(ll n, ll m){
    ll N = n * m, cnt = N;
    if(N == 1){
        return 1;
    }
    if(m % 2 == 0){
        cnt += f3(n, m / 2) * 2;
    }else if(n % 2 == 0){
        cnt += f3(n / 2, m) * 2;
    }else{
        cnt += f3(min(n, m), max(n, m) / 2);
        cnt += f3(min(n, m), max(n, m) - max(n, m) / 2);
    }
    return cnt;
}

int main()
{
    ll cnt = 0;
    chache[1] = 1;
    ll n, m, N;
    cin >> n >> m;
    N = n * m;

    cout << f3(n, m);


    return 0;
}
