l, k = map(int, input().split()) print(int((l - 1) // (k * 2) * k))