#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int tb1[6] = {0, 0, 0, 0, 2, 4};
int tb2[8] = {0, 0, 0, 4, 8, 10, 12, 12};
int main() {
  long long n, m;
  scanf("%lld%lld", &n, &m);
  if (n > m) swap(n, m);
  long long ans = 0;
  if (n == 1)
    ans = m / 6 * 6 + tb1[m % 6];
  else if (n == 2 && m <= 7)
    ans = tb2[m];
  else
    ans = n * m / 2 * 2;
  printf("%lld\n", ans);
  return 0;
}
