#include using namespace std; #define int long long signed main(){ int a,b,c,d,e,f,g; cin>>a>>b>>c>>d>>e>>f>>g; for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)for(int k=0;k<=c;k++)for(int l=0;l<=d;l++)for(int m=0;m<=e;m++)for(int n=0;n<=f;n++)if(500*i+100*j+50*k+10*l+5*m+n == g){ cout<<"YES"<