#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = 1e18;
const long long MOD = 1000000007;
const double pi = 3.14159265358979323846;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int main() {
  long long h, w;
  cin >> h >> w;
  if (h > w) {
    swap(h, w);
  }
  if (h >= 3) {
    if (h * w % 2 == 0) {
      cout << h * w << endl;
    } else {
      cout << h * w - 1 << endl;
    }
  } else if (h == 2) {
    if (w == 1 || w == 2) {
      cout << 0 << endl;
    } else if (w == 3) {
      cout << 4 << endl;
    } else if (w == 7) {
      cout << 12 << endl;
    } else {
      cout << h * w << endl;
    }
  } else if (h == 1) {
    long long w2 = w % 6;
    if (w2 <= 3) {
      cout << w - w2 << endl;
    } else if (w2 == 4) {
      cout << w - 2 << endl;
    } else if (w2 == 5) {
      cout << w - 1 << endl;
    } else {
      cout << w << endl;
    }
  }
}
