#include <bits/stdc++.h>
using namespace std;
long long int n;
int main() {
  long long int a, b;
  long long int arr[10] = {0};
  arr[4] = 2;
  arr[5] = 4;
  long long int brr[10] = {0};
  cin >> a >> b;
  if (a > b) swap(a, b);
  if (a == 1) {
    if (b < 6)
      cout << arr[b] << endl;
    else {
      cout << ((b / 6) * 6) + arr[b % 6] << endl;
    }
  } else if (a == 2) {
    if (b == 2)
      cout << 0 << endl;
    else if (b == 3 || b == 7) {
      cout << a * b - 2 << endl;
    } else {
      cout << a * b << endl;
    }
  } else {
    cout << (a * b) - ((a * b) % 2ll) << endl;
  }
  return 0;
}
