import re pattern = r"5.*7.*5" text = raw_input() matchOB = re.match(pattern , text) print "YES" if matchOB else "NO"