#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
const int inf = 15000000 + 10;
inline int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long N, M;
int main() {
  cin >> N >> M;
  if (N > M) swap(N, M);
  if (N == 1) {
    if (M % 6 == 0)
      cout << M << endl;
    else if (M % 6 <= 3)
      cout << M - (M % 6) << endl;
    else
      cout << M - (6 - M % 6) << endl;
  } else if (N == 2 && M == 2)
    cout << 0 << endl;
  else if (N == 2 && M == 3)
    cout << 4 << endl;
  else if (N == 2 && M == 7)
    cout << 12 << endl;
  else {
    if ((N & 1) && (M & 1))
      cout << N * M - 1 << endl;
    else
      cout << N * M << endl;
  }
  return 0;
}
