#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
#include <numeric>
#include <map>
#include <set>
#include <string>

using namespace std;
using ll = long long;
using ld = long double;

#define deb(x) cerr << #x << ":\t" << x << '\n';
#define len(x) (ll) x.size()

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

map<pair<ll, ll>, ll>kek;

ll f(ll n, ll m) {
    if (n < m) {
        swap(n, m);
    }
    if (kek.find({n ,m}) != kek.end()) {
        return kek[{n, m}];
    }
    return kek[{n, m}] = (f(n / 2, m) + f(n - n / 2, m) + n * m);
}


void solve() {
    ll n, m; cin >> n >> m;
    kek[{1, 1}] = 1;
    cout << f(n, m);
}

int main() {
    int T = 1;
//    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
