added code for Uva 10252 10235