l,k = input().split() l = int(l) k = int(k) total = 0 while l>k*2: l -= k*2 total += k print(total)