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