#include <bits/stdc++.h>
using namespace std;
unsigned long long solve(long long n, long long m){
    if(n==1&&m==1){
        return 1;
    }
    unsigned long long sum=0;
    if(n<m){
        long long tmp=m;
        m=n;
        n=tmp;
    }
    if(n%2==0){
        sum+=solve(n/2, m)*2+n*m * 1LL;
    }else{
        if(m%2==0){
            sum+=solve(n, m/2)*2+n*m * 1LL;
        }else{
            sum+=solve(n-1, m)+solve(1, m)+n*m * 1LL;
        }
    }
    return sum;
}
int main(){
    long long n, m;
    cin >> n >> m;
    cout << solve(n, m);
    return 0;
}