import sys s = input() for i in range(len(s)-2): if s[i:i+3] == '575': print('YES') sys.exit() i+=1 print("NO")