///Shapo4ka
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vii;
typedef vector<ll> vll;

ll bpow(ll a, int n)
{
    ll ans=1;
    while(n)
    {
        if (n & 1)ans*=a;
        a*=a;
        n/=2;
    }
    return ans;
}
ll n,m,x,y;
int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    cin >> n >> m;
    if (m > n)swap(n,m);
    x=n,y=1;
    ll ans=x*m;
    if (n == 1 && m == 1)ans=1;

//    cout << sum << "\n";
    ll sum=m+m;
    x=m;
    y=1;

    while (x >= 1)
    {
        if (x % 2 == 1)
        {
//            if (x != 1 m%2!=1)sum+=y;
            x--;
        }
        else x/=2,y*=2,sum+=x*y;
    }
    if(__builtin_popcountll(m) == 1)sum -=m;
    if(__builtin_popcountll(n) == 1)ans -=n*m;
//    cout << sum << "\n\n";
    y=1;
    x=n;
    while(x >= 1) {
        if(x % 2 == 1) {
//            cout << "bg\n";
//            cout << y*sum << " " << x << " " << y << "\n";
            ans+=y*sum;
            x--;
        }
        else{

         x/=2;y*=2;
         ans+=x*y*m;

        }
//        if (x == 1 && m == 1)break;
//        if (x == 0)break;
//        if (x == 1 && m == 1)break;
//        cout << x << " " << y << "\n";
//        ans+=x*y*m;
    }
//    cout << ans << "\n";


    cout << ans << "\n";
    return 0;
}
