// By ObeliX
#include <bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#include <unordered_map>
#include <cstddef>
#include <cassert>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>

using namespace std;
const long long INF = 1e18;
const long long mod = 998244353;
const long long N = 1e6;
const long long M = 1ll << 32 ;
const double eps = 1e-6;
string alph = "abcdefghijklmnopqrstuvwxyz";
// ||

long long h , w;

map<long long , long long> mp[N+5];

int main(){
    //freopen( "cinema.in" , "r" , stdin );
    //freopen( "cinema.out" , "w" , stdout );
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> h >> w;
    long long ans = 0;
    set <pair<long long , long long>> q;
    q.insert( { h , w } );
    mp[h][w] = 1;
    while ( !q.empty() ) {
        pair <long long , long long> pr = *q.begin();
        long long h1 = pr.first;
        long long w1 = pr.second;
        if ( h1 == 1 && w1 == 1 ) {
            ans+=mp[1][1];
            mp[h1][w1] = 0;
            q.erase( pr );
            continue;
        }
        if ( h1 > w1 ) {
            if ( h1 % 2 == 1 ) {
                q.insert( { h1 / 2 , w1} );
                q.insert( { h1 / 2 + 1 , w1} );
                ans += h1 * w1 * mp[h1][w1];
                mp[h1/2][w1]+=mp[h1][w1];
                mp[h1/2+1][w1]+=mp[h1][w1];
                mp[h1][w1] = 0;
            }
            else {
                q.insert( { h1 / 2 , w1} );
                ans += h1 * w1 * mp[h1][w1];
                mp[h1/2][w1]+=2*mp[h1][w1];
                mp[h1][w1] = 0;
            }
        }
        else {
            if ( w1 % 2 == 1 ) {
                q.insert( { h1 , w1 / 2 } );
                q.insert( { h1 , w1 / 2 + 1 } );
                ans += h1 * w1 * mp[h1][w1];
                mp[h1][w1/2]+=mp[h1][w1];
                mp[h1][w1/2+1]+=mp[h1][w1];
                mp[h1][w1] = 0;
            }
            else {
                q.insert( { h1 , w1 / 2 } );
                ans += h1 * w1 * mp[h1][w1];
                mp[h1][w1/2] += 2 * mp[h1][w1];
                mp[h1][w1] = 0;
            }
        }
        q.erase( pr );
    }
    cout << ans;
}
