#include <bits/stdc++.h>
using namespace std;
const int N = 300000 + 77;
int n, m;
int T1[6] = {0, 0, 0, 0, 2, 4};
int main() {
  scanf("%d %d", &n, &m);
  if (n > m) swap(n, m);
  if (m <= 2) return !printf("0\n");
  if (n == 1) return !printf("%d\n", (m / 6) * 6 + T1[m % 6]);
  if (n == 2 && m == 3) return !printf("4\n");
  if (n == 2 && m == 7) return !printf("12\n");
  if (n == 2) return !printf("%d\n", n * m);
  printf("%lld\n", n * 1ll * m - (1 & m & n));
  return 0;
}
