l, k = map(int, input().split()) def hantei(l, k): if l==2*k: return 0 return l//(2*k)*k print(hantei(l, k))