#include <bits/stdc++.h>

#define attan ios::sync_with_stdio(false);
#define alash cin.tie(0), cout.tie(0);
#define ll long long
#define all(x) x.begin(),x.end()
#define pb push_back
using namespace std;
const ll N=1e4+10;


void solve() {
 ll h,w;
 cin>>h>>w;
 ll mx=max(h,w),mn=min(h,w);
 ll sm=0,last=h*w,count=1;
 vector<ll>p{mx,mn};
 while(p[0]>0 && p[1]>0){
  sm+=p[0]*p[1]*count;

  p[0]--;
  if(p[0]<p[1]){
     swap(p[0],p[1]);
  }
  if(p[0]==0 || p[1]==0)break;
  count=last/(p[0]*p[1]);
  if(p[1]%2==1 &&  p[0]>1 && p[1]>1 || p[0]%2==1 && p[0]>1 && p[1]>1)count=0;
  

 }
 cout<<sm<<'\n';
}

int main() {
    attan
    alash
    ll q = 1;
    //cin >> q;
    while (q--) {
        solve();
    }
    return 0;
}