Catch That Cow

Time Limit : 4000/2000ms (Java/Other)