横坐标差+纵坐标差=3
maxx可放个数 n*m
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
const ll mod=1e9+7;
const int INF=0x3f3f3f3f;
#define IO ios::sync_with_stdio(false);cin.tie(0);
ll T;
ll n,m,minn,maxx,cnt,sum,ans;
ll a[maxn],x,y,dp[1005][1005];
ll r,b,k;
string s,t;
int main() {
cin>>n>>m;
if(n>m)
swap(n,m);
if(n==1)
ans=m/6*6+2*max(m%6-3,0ll); //10 6+2*(4-3) 7 10
else if(n==2 && m==3){
ans=4;
}
else if(n==2 && m==2){
ans=0;
}
else if(n==2 && m==7)
ans=12;
else //3*3 缺1
ans=n*m/2*2;
cout<<ans<<endl;
return 0;
}