w = gets.to_i d = gets.to_i d.downto(1) do |i| p w if i == 1 w -= w / (i ** 2) end