#include <bits/stdc++.h>
using namespace std;
long long work(long long x, long long y) {
  long long q = (long long)x * y;
  if (x > y) swap(x, y);
  long long arr[6] = {0, 1, 2, 3, 2, 1};
  if (x == 1) return (y - arr[y % 6]) / 2;
  if (x == 2 && y == 2) return 0;
  if (x == 2 && y == 3) return 2;
  if (x == 2 && y == 7) return 6;
  return q / 2;
}
int main() {
  long long n, m;
  cin >> n >> m;
  cout << work(n, m) * 2;
  return 0;
}
