a,b,c,d,e,f,g=input().split() if int(g)==int(a)*500+int(b)*100+int(c)*50+int(d)*10+int(e)*5+int(f): print('YES') else: print('NO')