///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 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;

    ll sum=m+m;
    x=m;
    y=1;

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



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