l,k = input().split() l = int(l) k = int(k) total = int(l/(k*2))*k if(l%(k*2)==0): total -= k print(total)