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