#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <numeric>

#define rep(i,n) for(int i = 0;i < (n);i++)
#define repp(i,j, n) for(int i = (j);i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define INF 1e9

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int oddeven(int odd, int even){
  return abs(((even/2)*((odd/2)+1))-(even*(odd/2)));
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  if(h%3==0 || w%3==0){
    cout << 0 << endl;
  }else if(h%2==0 && w%2==0){
    cout << min(h, w)/2 << endl;
  }else if(h%2!=0 && w%2!=0){
    cout << w/2 + h/2 << endl;
  }else{
    if(h%2!=0) cout << oddeven(h, w) << endl;
    else cout << oddeven(w, h) << endl;
  }
  return 0;
}
