#include <bits/stdc++.h>
using namespace std;
long long f(long long x, long long y) {
  if (x == 3 && y == 3)
    return 8;
  else if (x == 2 && y == 3 || x == 3 && y == 2)
    return 4;
  else if (x <= 3 && y <= 3)
    return 0;
  else if (x == 4 && y == 4)
    return 16;
  else if (x == 3 && y == 4 || x == 4 && y == 3)
    return 12;
  else if (x == 2 && y == 4 || x == 4 && y == 2)
    return 8;
  else if (x == 1 && y == 4 || x == 4 && y == 1)
    return 2;
  else if (x == 5 && y == 5)
    return 24;
  else if (x == 4 && y == 5 || x == 5 && y == 4)
    return 20;
  else if (x == 3 && y == 5 || x == 5 && y == 3)
    return 14;
  else if (x == 2 && y == 5 || x == 5 && y == 2)
    return 10;
  else if (x == 1 && y == 5 || x == 5 && y == 1)
    return 4;
  else if (x == 2 && y != 7 && y != 11 || y == 2 && x != 7 && x != 11)
    return x * y;
  else if (x == 3 && y == 7 || x == 7 && y == 3)
    return 20;
  long long d = x % 6, s0 = y * (x - d), s1;
  if (d == 1)
    s0 += f(y, 1);
  else if (d == 2)
    s0 += max(f(y, 2), 2 * f(y, 1));
  else if (d == 3)
    s0 += max(f(y, 2) + f(y, 1), f(y, 3));
  else if (d == 4)
    s0 += max(max(f(y, 4), f(y, 3) + f(y, 1)), 2 * f(y, 2));
  else if (d == 5)
    s0 += max(max(f(y, 5), f(y, 4) + f(y, 1)), f(y, 3) + f(y, 2));
  return s0;
}
int main() {
  long long i, j, k, m, n, x, y, mx = -1, p, g;
  cin >> n >> m;
  cout << max(f(m, n), f(n, m));
  return 0;
}
