#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  if (n > m) swap(n, m);
  if (n == 1) {
    printf("%d\n", m / 6 * 6 + max(m % 6 - 3, 0) * 2);
  } else if (n == 2) {
    printf("%d\n", (m == 2) ? 0 : (m == 3) ? 4 : (m == 7) ? 12 : 2 * m);
  } else {
    printf("%I64d\n", (1ll * n * m) & (~1));
  }
  return 0;
}
