#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long n, m;
    cin >> n >> m;
    if (min(m, n) == 1) {
      if (max(m, n) % 6 == 0)
        cout << m * n;
      else if (max(m, n) % 6 == 1 || max(m, n) % 6 == 5)
        cout << m * n - 1;
      else if (max(m, n) % 6 == 2 || max(m, n) % 6 == 4)
        cout << m * n - 2;
      else
        cout << m * n - 3;
    } else if (min(m, n) == 2) {
      if (max(m, n) == 2)
        cout << 0;
      else if (max(m, n) == 7)
        cout << 12;
      else if (max(m, n) == 3)
        cout << 4;
      else
        cout << m * n;
    } else if (m % 2 == 0 || n % 2 == 0)
      cout << m * n;
    else
      cout << m * n - 1;
  }
  return 0;
}
