L, K = map(int, input().split()) twice_K = K * 2 if L <= twice_K: print(0) else: count = L // twice_K if L % twice_K == 0 and twice_K != 100: count -= 1 print(K * count)