{"problem":{"name":"Step Up Robot","description":{"content":"There is a staircase with infinite steps. The foot of the stairs is the $0$\\-th step, the next step is the $1$\\-st step, the next is the $2$\\-nd, and so on. There is a stair-climbing robot on the $0$\\","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc289_d"},"statements":[{"statement_type":"Markdown","content":"There is a staircase with infinite steps. The foot of the stairs is the $0$\\-th step, the next step is the $1$\\-st step, the next is the $2$\\-nd, and so on.\nThere is a stair-climbing robot on the $0$\\-th step. The robot can climb up $A _ 1,A _ 2,\\ldots$, or $A _ N$ steps at a time. In other words, when the robot is on the $i$\\-th step, it can step onto one of the $(i+A _ 1)$\\-th step, $(i+A _ 2)$\\-th step, $\\ldots$, and $(i+A _ N)$\\-th step, but not onto the others in a single step. The robot cannot descend the stairs, either.\nThere are traps on the $B _ 1$\\-th, $B _ 2$\\-th, $\\ldots$, and $B _ M$\\-th steps. Once the robot steps onto a step with a trap, it cannot move anymore.\nThe robot wants to step onto the $X$\\-th step. Determine whether it is possible to do so.\n\n## Constraints\n\n*   $1\\leq N\\leq10$\n*   $1\\leq A _ 1\\lt A _ 2\\lt\\cdots\\lt A _ N\\leq10^5$\n*   $1\\leq M\\leq10^5$\n*   $1\\leq B _ 1\\lt B _ 2\\lt\\cdots\\lt B _ M\\lt X\\leq10^5$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A _ 1$ $A _ 2$ $\\ldots$ $A _ N$\n$M$\n$B _ 1$ $B _ 2$ $\\ldots$ $B _ M$\n$X$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc289_d","tags":[],"sample_group":[["3\n3 4 5\n4\n4 5 6 8\n15","Yes\n\nFor example, the robot can reach the $15$\\-th step as follows.\n\n*   Climb up $3$ steps. The robot is now on the $3$\\-rd step.\n*   Climb up $4$ steps. The robot is now on the $7$\\-th step.\n*   Climb up $5$ steps. The robot is now on the $12$\\-th step.\n*   Climb up $3$ steps. The robot is now on the $15$\\-th step."],["4\n2 3 4 5\n4\n3 4 5 6\n8","No\n\nNo matter how the robot moves, it cannot step onto the $8$\\-th step."],["4\n2 5 7 8\n5\n2 9 10 11 19\n20","Yes"]],"created_at":"2026-03-03 11:01:14"}}