added code for Uva:621