Updated the uva10905 impl