#include<string.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<math.h>
using namespace std;
int main() {
	unsigned long long n, x;
	cin >> n >> x;
	if (n / 2 < x) {
		cout << 6 * x;
	}
	else {
		cout << 3 * x;
	}
	return 0;
 