SPOJ Check Infinite Run