import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] coin = new int[6]; for(int i = 0; i < 6; i++) coin[i] = Integer.parseInt(sc.next()); int[] money = {500, 100, 50, 10, 5, 1}; int x = Integer.parseInt(sc.next()); boolean flag = false; int temp; for(int i = 0; i < 6; i++) { temp = Math.min(coin[i], x / money[i]); x -= temp * money[i]; if(x == 0) { flag = true; break; } } System.out.println((flag)? "YES" : "NO"); } }