#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, INF = 1e9;
using vi = vector<long long>;
using vvi = vector<vi>;
signed main() {
  long long n, x;
  cin >> n >> x;
  if (n == 2 * x) cout << 3 * x << endl;
}
