class Otoshidama attr_reader :n, :m def initialize(n: 0, m: 0) @n, @m = n, m end def cause begin @n = Integer(gets.chomp) @m = Integer(gets.chomp) rescue end end def otoshidama(budget, children) (@n / @m) / 1000 * 1000 end def result puts otoshidama(@n, @m) end def run cause result end end if $0 == __FILE__ Otoshidama.new.run end