#include <bits/stdc++.h>   using namespace std;   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = 10 * x + ch -  0 ;       ch = getchar();     }     return x * f;   }   int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }   int power(int x, int y) {     int t = 1;     for (; y; y >>= 1, x = x * x % 1000000007)       if (y & 1) t = t * x % 1000000007;     return t;   }   long long n, m;   int main() {     n = read();     m = read();     if (min(n, m) == 1) {       long long ans = 6 * (max(n, m) / 6);       ans += max((long long)0, 2 * ((max(n, m) % 6) - 3));       cout << ans << endl;     } else if (min(n, m) == 2) {       if (max(n, m) == 3)         cout << 4 << endl;       else if (max(n, m) == 7)         cout << 12 << endl;       else if (max(n, m) == 2)         cout << 0 << endl;       else         cout << n * m << endl;     } else {       if ((n * m) % 2 == 0)         cout << n * m << endl;       else         cout << n * m - 1 << endl;     }     return 0;   }   