#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  if (n > m) {
    int t = n;
    n = m;
    m = t;
  }
  long long ans;
  if (n == 1) {
    ans = m / 6 * 6;
    m %= 6;
    if (m == 4) {
      ans += 2;
    } else if (m == 5) {
      ans += 4;
    }
  } else if (n == 2) {
    if (m == 2) {
      ans = 0;
    } else if (m == 3) {
      ans = 4;
    } else if (m == 7) {
      ans = 12;
    } else {
      ans = 1ll * n * m;
    }
  } else if (n % 2 == 0 || m % 2 == 0) {
    ans = 1ll * n * m;
  } else {
    ans = 1ll * n * m - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
