#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  long long int ans = 1LL * n * m;
  if (n == 1) {
    int ar[] = {0, 1, 2, 3, 2, 1};
    ans -= ar[m % 6];
  } else if (n == 2) {
    if (m == 2)
      ans -= 4;
    else if (m == 3 || m == 7)
      ans -= 2;
  } else if (n % 2 == 1) {
    if (m % 2 == 1) ans--;
  }
  cout << ans << endl;
  return 0;
}
