#include <bits/stdc++.h>
int comp(const void *x, const void *y) { return *(int *)x - *(int *)y; }
int min(int x, int y) { return (x < y) ? x : y; }
int solve(void) { return 0; }
int main(void) {
  unsigned long long n, x;
  scanf("%llu%llu", &n, &x);
  if ((x << 1) == n) {
    printf("%llu\n", 3 * x);
  } else {
    printf("%llu\n", 6 * x);
  }
  return 0;
}
