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