class A def initialize l, k = gets.chomp.split(' ').map(&:to_i) puts k * ((l-1)/(2*k)) end end A.new