#include <bits/stdc++.h>
using namespace std;
long long ans, n, m, x, y;
int main() {
  scanf("%lld%lld", &n, &m);
  x = min(n, m);
  y = max(n, m);
  if (x > 3 || (x == 3 && y > 3)) {
    ans = x * y;
    if (ans % 2 == 1) ans -= 1;
    printf("%lld", ans);
    return 0;
  } else {
    if (x == 3 && y == 3) {
      printf("8");
      return 0;
    }
    if (x == 1) {
      long long l = y / 6, r = y % 6;
      ans = l * 6 + max(r - 3, (long long)0) * 2;
      printf("%lld", ans);
      return 0;
    }
    if (x == 2) {
      if (y == 2) {
        printf("0");
        return 0;
      }
      if (y == 3) {
        ans = 4;
        printf("%lld", ans);
        return 0;
      }
      if (y == 7) {
        ans = 12;
        printf("%lld", ans);
        return 0;
      }
      printf("%lld", x * y);
    }
  }
  return 0;
}
