#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
long long N, M;
void MAIN() {
  scanf("%lld%lld", &N, &M);
  if (N > M) swap(N, M);
  long long ans;
  if (M <= 2) {
    ans = 0;
  } else if (M == 3) {
    if (N == 1) {
      ans = 0;
    } else if (N == 2) {
      ans = 4;
    } else {
      ans = 8;
    }
  } else if (N == 1) {
    long long q = M / 6, r = M % 6;
    ans = q * 6;
    if (r == 4) ans += 2;
    if (r == 5) ans += 4;
  } else if (N == 2 && M == 7) {
    ans = 12;
  } else {
    ans = M * N;
    if (ans & 1) ans--;
  }
  printf("%lld\n", ans);
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
