#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define no1 cout<<"-1\n"

using namespace std;

const int N = 15;
const int INF = 1e18;
const int mod = 1e9+7;

// int binpow (int a, int n) {
// 	if (n == 0)
// 		return 1;
// 	if (n % 2 == 1)
// 		return (binpow (a, n-1)%mod * a%mod)%mod;
// 	else {
// 		int b = binpow (a, n/2) % mod;
// 		return (b%mod * b%mod)%mod;
// 	}
// }

int h,w;

bool check(int x){
    while(x%2 == 0){
        x/=2;
    }
    if(x==1) return 1;
    return 0;
}

int get(int x){
    int cnt = 0;
    while(x!=1){
        x/=2;
        cnt++;
    }
    return cnt;
}

int rec(int a, int b, int lay){
    if(a == 0 || b == 0){
        return 0;
    }
    int x = 1;
    int y = 1;
    int cnt = 0;
    while(x*2<=a && y*2<=b){
        x*=2;
        y*=2;
        cnt++;
    }
    int s1;
    int s2;
    int s3;
    if(a-x!=0 && a-x == b && check(a-x)){
        s1 = (get(a-x)*2+1)*(a-x*b)+(a-x*b)*lay;
    }
    else s1 = rec(a-x,b,lay+1);
    if(a != 0 && a == b-y && check(b-y)){
        s2 = (get(a)*2+1)*(a*b-y)+(a*b-y)*lay;
    }
    else s2 = rec(a,b-y,lay+1);
    if(a-x !=0 && a-x == b-y && check(b-y)){
        s3 = (get(a-x)*2+1)*(a-x*b-y)+(a-x*b-y)*lay;
    }
    else s3 = rec(a-x,b-y,lay+1);
    return s1+s2+s3+(cnt*2+1)*(x*y)+(x*y)*lay;
}

void solve(){
    cin>>h>>w;
    if(h == w && check(h)){
        cout<<(get(h)*2+1)*(h*w);
        return;
    }
    cout<<h*w+rec(h,w,0)<<"\n";
}       



signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    // cout.tie(nullptr);
    int t = 1; 
    // cin>>t;
    // cout<<"";
    for(int i = 1;i<=t;i++){
        solve();
    }
}