pocky,bite = map(int,input().split()) i=0 while pocky>bite*2: pocky -= bite*2 i+=1 print(bite*i)