solution for uva 1335