#! ruby L, K = gets.chomp.split.map(&:to_i) K2 = K * 2 yuu = 0 rem = L while rem > K2 yuu += K rem -= K * 2 end puts yuu