#include <bits/stdc++.h>
using namespace std;
int64_t solve(int m, int n) {
  if (m > n) swap(m, n);
  if (m == 1) {
    if (n <= 3) return 0;
    if (n % 6 == 2 || n % 6 == 4) return n - 2;
    if (n % 6 == 1 || n % 6 == 5) return n - 1;
    if (n % 6 == 3) return n - 3;
    return n;
  }
  if (m == 2) {
    if (n <= 2) return 0;
    if (n == 3) return 4;
    if (n == 4) return 8;
    if (n == 7) return 12;
    return n * 2;
  }
  int64_t res = 1LL * m * n;
  if (res % 2 == 1) res -= 1;
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  cout << solve(n, m) << endl;
  return 0;
}
