w = gets.to_i h = gets.to_i if(h == 1) p w exit end (2..h).reverse_each do |d| w -= (w/(d*d)) end p w