#include <bits/stdc++.h>
using namespace std;
long long int const mod = 1000000007;
long long int const MAXN = 200009;
const int inf_int = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  if (n > m) swap(n, m);
  if (n == 1) {
    switch (m % 6) {
      case 0:
        cout << (n * m) - 0;
        break;
      case 1:
        cout << (n * m) - 1;
        break;
      case 2:
        cout << (n * m) - 2;
        break;
      case 3:
        cout << (n * m) - 3;
        break;
      case 4:
        cout << (n * m) - 2;
        break;
      case 5:
        cout << (n * m) - 1;
        break;
    }
  } else if (n == 2) {
    if (m == 2)
      cout << 0;
    else if (m == 3)
      cout << (n * m) - 2;
    else if (m == 7)
      cout << (n * m) - 2;
    else
      cout << (n * m);
  } else {
    if ((n * m) % 2) {
      cout << (n * m) - 1;
    } else {
      cout << n * m;
    }
  }
}
