### COCI 2009/2010, Contest #2

## Task KUTEVI

One day Mirko was cleaning up his room and found a straightedge and a compass. He went to the school the next day and challenged his friend Slavko to a geometric construction battle. Mirko knows how to construct some angles using the straightedge and compass and knows how to subtract and add any two angels he constructs. Slavko now shouts random angles and Mirko must draw them as fast as possible.

You are observing this battle and would like to know if Mirko can construct the angles Slavko shouts at all.

### Input

The first line of input contains two integers, **N** (1 ≤ **N** ≤ 10), number of angles Mirko knows how to construct initially and **K** (1 ≤ **K** ≤ 10), number of angles Slavko selected.

The second line of input contains **N** integers, all smaller than 360, the angles Mirko knows how to construct initially.

The third line contains **K** integers, all smaller than 360, the angles Slavko selected.

### Output

Output consist of **K** lines, one for each angle Slavko selected. The i-th line should contain "`YES`

" if Mirko can construct the i-th angle, and "`NO`

" otherwise.

### Sample Tests

## Input2 1 30 70 40 ## OutputYES |
## Input1 1 100 60 ## OutputYES |
## Input3 2 10 20 30 5 70 ## OutputNO YES |

### First example description:

Subtracting 30° from 70° yields 70° - 30° = 40°.

### Second example description:

Adding 100° 15 times yields 1500°, also known as 60°

All Submissions

Best Solutions

**Point Value:** 7

**Time Limit:** 1.00s

**Memory Limit:** 32M

**Added:** Jul 10, 2013

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

It's quiet in here...