added code for Uva:324