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