work = gets.to_i day = gets.to_i p = 0 (1..day).each do p = work / (day ** 2) day -= 1 work -= p end p p