a,b=map(int,input().split()) c=2*b if a%c==0: print((a//c-1)*b) else: print((a//c)*b)