added code for Uva:299