L, K = list(map(int, input().split())) EATEN_POCKY_AT_ONCE = 2 * K p = L // EATEN_POCKY_AT_ONCE q = L % EATEN_POCKY_AT_ONCE if q == 0: eaten = K * (p - 1) else: eaten = K * p print(eaten)