solution for uva 10317