L,K=map(int,input().split()) if K*2!=L: count=L//(K*2) sum=count*K print(sum) else: print(0)