#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, m;
void Load() {
  ll a, b;
  scanf("%lld%lld", &a, &b);
  n = min(a, b);
  m = max(a, b);
}
ll GetNumEmpty() {
  if (n == 1) {
    if (m % 6 == 4)
      return 2;
    else if (m % 6 == 5)
      return 1;
    return m % 6;
  }
  if (n == 2) {
    if (m == 2) return 4;
    if (m == 3 || m == 7) return 2;
    return 0;
  }
  if (n == 3) {
    return m % 2;
  }
  return n * m % 2;
}
void Solve() { printf("%lld\n", n * m - GetNumEmpty()); }
int main() {
  Load();
  Solve();
}
