l, k = map(int, input().split()) ans = 0 while True: if l <= k * 2: break else: l -= k * 2 ans += k print(ans)