#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,a,n) for(i=a;i<n;i++)
#define in(x) scanf("%lld",&x)
void solve()
{
    ll n,x;
    in(n);
    in(x);
    if(n==2*x)
        ans=3*x;
    else
        ans=6*x;
    printf("%lld\n",ans);
}
int main()
{
    ll t;
	// cin>>t;
	// while(t--)
		solve();
}