uva 10004, modified