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