@_=glob<>;$G=pop@_;$==1e3;$G-=($_<($%=$G/($=/=--$|?2:5))?$_:$%)*$=for@_;print$G?NO:YES