#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define FOR(i, l, r) for(int i = l; i < r; i++)
#define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--)

constexpr int evx[4] = { 1, 0, -1, 0 };
constexpr int evy[4] = { 0, 1, 0, -1 };

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

int main()
{
    ios::sync_with_stdio(false);
    uint64_t n, x;
    cin >> n >> x;
        cout << 6 * x << '\n';
    else if( 2 * x == n)
        cout << 3 * n / 2 << '\n';
    else
        cout << 3 * x << '\n';
}

