# coding:utf-8 L, K = map(int,input().split()) haruka_K = K yuu_K = K nokori_L = L K_cnt = L // (haruka_K + yuu_K) nokori_L = L % (haruka_K + yuu_K) if L <= 2 * K: print(0) else: print(yuu_K * K_cnt)