added code for Uva:612