#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  scanf("%I64d %I64d", &n, &m);
  long long a = min(n, m);
  long long b = max(n, m);
  long long ans;
  if (a == 1) {
    ans = b / 6 * 6;
    if (b % 6 == 4)
      ans += 2;
    else if (b % 6 == 5)
      ans += 4;
  } else if (a == 2) {
    if (b == 2)
      ans = 0;
    else if (b == 3)
      ans = 4;
    else if (b == 7)
      ans = 12;
    else
      ans = a * b;
  } else {
    ans = a * b / 2 * 2;
  }
  printf("%I64d\n", ans);
  return 0;
}
