m,n=map(int,input().split()) once=n*2 count=m//once if m%once==0 and m==once: print(0) else: print(count*n)