a,b,c,d,e,f,g=[int(i) for i in input().split()] h=a*500+b*100+c*50+d*10+e*5+f*1 if g==h: print("YES") else: print("NO")