uva 499 solved