L,K = map(int, input().split()) haruka_l = 0 yuki_l = 0 while L >= 0: L -= K haruka_l += K if not (L <= K): L -= K yuki_l += K print(yuki_l)