#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef long long ll;
#define all(c) begin(c),end(c)

auto solve() {
    ll N, X;
    cin >> N >> X;

    double sn = (double) N / 2;

    if (X < sn) return X * 6;
    else return X * 3;
}

int main() {
    cout << solve() << endl;
    return 0;
}