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