{"raw_statement":[{"iden":"problem statement","content":"In Japan, there are six types of coins in circulation: $1$ yen, $5$ yen, $10$ yen, $50$ yen, $100$ yen, and $500$ yen. Answer the following question regarding these coins.\n\n> Mr. AtCoder's wallet contains $A$ $1$\\-yen coins, $B$ $5$\\-yen coins, $C$ $10$\\-yen coins, $D$ $50$\\-yen coins, $E$ $100$\\-yen coins, and $F$ $500$\\-yen coins.\n> He is planning to shop at $N$ stores in sequence. Specifically, at the $i$\\-th store $(1 \\leq i \\leq N)$, he plans to buy one item that costs $X_i$ yen (including tax).\n> Giving and receiving change takes time, so he wants to choose his coins so that he can pay the **exact amount** at each store. Determine if this is possible."},{"iden":"constraints","content":"*   $0 \\leq A \\leq 200$\n*   $0 \\leq B \\leq 200$\n*   $0 \\leq C \\leq 200$\n*   $0 \\leq D \\leq 200$\n*   $0 \\leq E \\leq 200$\n*   $0 \\leq F \\leq 200$\n*   $1 \\leq N \\leq 10$\n*   $1 \\leq X_i \\leq 10000 \\ (1 \\leq i \\leq N)$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$A$ $B$ $C$ $D$ $E$ $F$\n$N$\n$X_1$ $X_2$ $\\cdots$ $X_N$"},{"iden":"sample input 1","content":"0 0 6 3 4 1\n3\n700 250 160"},{"iden":"sample output 1","content":"Yes\n\nFor example, he can make exact payments at all three stores as follows:\n\n*   At the first store: Use two $100$\\-yen coins and one $500$\\-yen coin.\n*   At the second store: Use five $10$\\-yen coins and two $100$\\-yen coins.\n*   At the third store: Use one $10$\\-yen coin and three $50$\\-yen coins."},{"iden":"sample input 2","content":"0 0 0 2 4 0\n3\n100 200 300"},{"iden":"sample output 2","content":"No\n\nThe total amount in the wallet is $500$ yen, but a total payment of $100+200+300=600$ yen is required, so it is impossible to purchase all the items."},{"iden":"sample input 3","content":"0 0 0 0 8 8\n1\n250"},{"iden":"sample output 3","content":"No\n\nThere are no $50$\\-yen or smaller coins in the wallet, so it is impossible to pay exactly $250$ yen."},{"iden":"sample input 4","content":"20 5 9 7 10 6\n5\n177 177 177 177 177"},{"iden":"sample output 4","content":"Yes"},{"iden":"sample input 5","content":"17 5 9 7 10 6\n5\n177 177 177 177 177"},{"iden":"sample output 5","content":"No"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}