#include #define rep(i, a, n) for(int i = a; i < n; i++) #define int long long using namespace std; typedef pair P; const int mod = 1000000007; const int INF = 1e18; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int d[6] = {500, 100, 50, 10, 5, 1}; int a[6]; rep(i, 0, 6) cin >> a[i]; int n; cin >> n; for(int i = 5; i >= 0; i--){ if(n >= d[i]){ int tmp = n / d[i]; tmp = min(tmp, a[i]); n -= d[i] * tmp; } } if(n == 0) cout << "YES" << endl; else cout << "NO" << endl; }