# 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) print(haruka_K * (K_cnt) + nokori_L)