#include<bits\stdc++.h>
#define ll long long
using namespace std;

map<int, ll> was[1000001];

ll f(ll h, ll w) {
  if (h > w) swap(h, w);
  if (h == 1) return w * (w + 1) / 2 - 1 + w;
  if (was[h].count(w)) return was[h][w];
  int x = w / 2;
  was[h][w] = f(h, x) + f(h, w - x) + h * w;
  return was[h][w];
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  /*if (h < w) swap(h, w);
  if (w == 1) {
    cout << h * (h + 1) / 2 - 1 + h;
    return 0;
  }
  ll x = h + 1;
  ll ans = x * (x + 1) / 2 - 3;
  ll lst = ans;
  for (int i = 2; i < w; i++) {  
    lst += h;
    ans += lst;
  }
  for (int i = h + 1; i < h + w; i++) ans += i;
  for (int i = w + 1; i < h + w; i++) ans += i;*/
  cout << f(h, w);
}
