#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int x, y, z, n, i, j, c = 0;
  cin >> x >> y;
  if (x > y) {
    n = x;
    x = y;
    y = n;
  }
  z = x * y;
  if (x <= 2 && y <= 2)
    cout << 0;
  else if (x == 1 && y == 3)
    cout << 0;
  else if (x == 1) {
    if (y % 6 < 4 && y % 6 != 0)
      cout << (y / 6) * 6;
    else if (y % 6 == 4)
      cout << (y / 6) * 6 + 2;
    else if (y % 6 == 5)
      cout << (y / 6) * 6 + 4;
    else if (y % 6 == 0)
      cout << y;
  } else if ((x == 2 && y == 3) || x == 2 && y == 7)
    cout << z - 2;
  else if (z % 2 == 0)
    cout << z;
  else if (z % 2 != 0)
    cout << z - 1;
}
