L, K = map(int, input().split()) twice_K = K * 2 if L <= twice_K: print(0) else: count = L // twice_K print(K * count)