$\=NO;<>;$s=$i=$j=!s/\S+/$s+=$b[$j++]+=$&;$s-=$b[$i++]while$s>777;$\=YES if$s==777/gerfor<>;print