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