#include <bits/stdc++.h>
using namespace std;
int val[8];
long long n, m, a, b, c, d;
int fin = 0, ini = 0;
int n1 = 0, n2 = 0;
int zero = 0;
int eq = 1;
int main() {
  scanf("%I64d %I64d", &n, &m);
  if (m < n) {
    swap(m, n);
  }
  if (n == 1) {
    if (m % 6 <= 3) {
      printf("%I64d\n", 0 + (m / 6) * 6);
    } else if (m % 6 == 4) {
      printf("%I64d\n", 2 + (m / 6) * 6);
    } else {
      printf("%I64d\n", 4 + (m / 6) * 6);
    }
  } else if (n == 2) {
    if (m == 2) {
      printf("0\n");
    } else if (m == 3) {
      printf("4\n");
    } else if (m == 4) {
      printf("8\n");
    } else if (m == 5) {
      printf("10\n");
    } else if (m == 6) {
      printf("12\n");
    } else if (m == 7) {
      printf("12\n");
    } else {
      printf("%I64d\n", n * m);
    }
  } else {
    printf("%I64d\n", ((n * m) >> 1) << 1);
  }
  return 0;
}
