#include using namespace std; int main() { int A[6], G; cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4] >> A[5] >> G; int v[6] = { 500, 100, 50, 10, 5, 1 }; for( int i = 0; i < 6; i++ ) { G -= min( A[i] * v[i], G / v[i] * v[i] ); } string ans = "NO"; if( G == 0 ) ans = "YES"; cout << ans << endl; }