Add Uva 514 Rails