Added code for Uva:579