#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, x, y, r, m = 0;
  cin >> x >> y;
  if ((x == 2 && y == 2)) {
    cout << "0" << endl;
  } else if (x == 1) {
    n = (y / 6) * 6;
    if (y % 6 == 4)
      n += 2;
    else if (y % 6 == 5)
      n += 4;
    cout << n << endl;
  } else if (y == 1) {
    n = (x / 6) * 6;
    if (x % 6 == 4)
      n += 2;
    else if (x % 6 == 5)
      n += 4;
    cout << n << endl;
  } else if (x % 2 == 1 && y % 2 == 1) {
    cout << (x * y - 1) << endl;
  } else if (x % 2 == 0 && y % 2 == 0) {
    cout << (x * y) << endl;
  } else if (x % 2 == 0 && y % 2 == 1) {
    if (x == 2 && y == 3) {
      cout << "4" << endl;
    } else if (x == 2 && y == 7) {
      cout << "12" << endl;
    } else {
      cout << (x * y) << endl;
    }
  } else if (x % 2 == 1 && y % 2 == 0) {
    if (y == 2 && x == 3) {
      cout << "4" << endl;
    }
    if (y == 2 && x == 7) {
      cout << "12" << endl;
    } else {
      cout << (x * y) << endl;
    }
  }
  return 0;
}
