added code for Uva:686