Uva problem I solved