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