added code for Uva:343