# coding:utf-8 L, K = map(int,input().split()) haruka_K = K yuu_k = K decrease = haruka_K + yuu_k cnt = 0 nokori_L = L while True: nokori_L -= decrease if nokori_L <= decrease: break else: cnt += 1 continue yuu_eat = K * cnt print(yuu_eat)