#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long x, y, k, ans;
  cin >> x >> y;
  if (x > y) {
    k = x;
    x = y;
    y = k;
  }
  if (x == 1) {
    k = y / 6;
    ans = 6 * k;
    if (y % 6 == 4)
      ans += 2;
    else if (y % 6 == 5)
      ans += 4;
  } else if (x == 2) {
    if (y == 2)
      ans = 0;
    else if (y == 3)
      ans = 4;
    else if (y == 7)
      ans = 12;
    else
      ans = x * y;
  } else {
    if ((x % 2 == 0) || (y % 2 == 0))
      ans = x * y;
    else
      ans = (x * y) - 1;
  }
  cout << ans << '\n';
}
