L, K = map(int, input().split()) count = 0 while L > 0: L -= K * 2 count += 1 print(K * (count - 1))