if __name__ == '__main__': L, K = list(map(int, input().split())) K_double = K * 2 if L == K * 2: print(0) else: print(L // (K * 2) * K)