#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int A[6]; rep(i,6) cin >> A[i]; int G; cin >> G; int C[] = {500, 100, 50, 10, 5, 1}; rep(a,A[0]+1)rep(b,A[1]+1)rep(c,A[2]+1)rep(d,A[3]+1)rep(e,A[4]+1)rep(f,A[5]+1){ int sum = a * C[0] + b * C[1] + c * C[2] + d * C[3] + e * C[4] + f * C[5]; if(sum == G) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; }