Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of $360$ degrees and a pointer which initially points at zero:

 [Image] 

Petr called his car dealer, who instructed him to rotate the lock's wheel exactly $n$ times. The $i$-th rotation should be $a_i$ degrees, either clockwise or counterclockwise, and after all $n$ rotations the pointer should again point at zero.

This confused Petr a little bit as he isn't sure which rotations should be done clockwise and which should be done counterclockwise. As there are many possible ways of rotating the lock, help him and find out whether there exists at least one, such that after all $n$ rotations the pointer will point at zero again.


-----Input-----

The first line contains one integer $n$ ($1 \leq n \leq 15$) — the number of rotations.

Each of the following $n$ lines contains one integer $a_i$ ($1 \leq a_i \leq 180$) — the angle of the $i$-th rotation in degrees.


-----Output-----

If it is possible to do all the rotations so that the pointer will point at zero after all of them are performed, print a single word "YES". Otherwise, print "NO". Petr will probably buy a new car in this case.

You can print each letter in any case (upper or lower).


-----Examples-----
Input
3
10
20
30

Output
YES

Input
3
10
10
10

Output
NO

Input
3
120
120
120

Output
YES



-----Note-----

In the first example, we can achieve our goal by applying the first and the second rotation clockwise, and performing the third rotation counterclockwise.

In the second example, it's impossible to perform the rotations in order to make the pointer point at zero in the end.

In the third example, Petr can do all three rotations clockwise. In this case, the whole wheel will be rotated by $360$ degrees clockwise and the pointer will point at zero again.

Difficulty: interview

Starter code:

Solutions:
import getpass
import sys


def ria():
    return [int(i) for i in input().split()]


if getpass.getuser() != 'frohenk':
    filename = 'half'
    # sys.stdin = open('input.txt')
    # sys.stdout = open('output.txt', 'w')
else:
    sys.stdin = open('input.txt')
    # sys.stdin.close()

n = ria()[0]
ar = []
for i in range(n):
    ar.append(ria()[0])

sm = sum(ar) / 2
for i in range(2 ** n):
    c = 0
    for j in range(n):
        if i & (1 << j):
            c += ar[j]
        else:
            c -= ar[j]
    if c % 360 == 0:
        print('YES')
        return
print('NO')


def ii():
    return int(input())
def mi():
    return list(map(int, input().split()))
def li():
    return list(mi())

n = ii()
a = [ii() for i in range(n)]
ans = 0
for i in range(2 ** n):
    s = 0
    for b in range(n):
        if i >> b & 1:
            s += a[b]
        else:
            s -= a[b]
    if s % 360 == 0:
        ans = 1
        break
print('YES' if ans else 'NO')


n = int(input())

a = [int(input()) for _ in range(n)]

ok = False

for i in range(2**n):
	bi = bin(i)[2:]
	bi = '0' * (n - len(bi)) + bi
	if sum((-1 if bi[j] == '0' else 1) * a[j] for j in range(n)) % 360 == 0:
		ok = True

print('YES' if ok else 'NO')


n = int(input())
a = [int(input()) for i in range(n)]

def rec(s, a, i):
    if i == len(a):
        return (s % 360 == 0)
    return rec((s + a[i]) % 360, a, i + 1) or rec((s - a[i]) % 360, a, i + 1)

print('YES' if rec(0, a, 0) else 'NO')

N = int(input())
n = [int(input())for i in range(N)]
s = sum(n)
w = 0
for k in range(2**N) :
    p = sum(n[i]for i in range(N)if k&(1<<i))
    if (s-p-p)%360 == 0 :
        print('YES')
        w = 1
        break
if w == 0 :
    print('NO')
        



n = int(input())
a = [ int(input()) for x in range(0, n) ]

for x in range(0, 2 ** n + 1):
    v = 0
    for p in range(0, n):
        if (x >> p) & 1 != 0:
            v += a[p]
        else:
            v -= a[p]

    if v % 360 == 0:
        print("YES")
        break
else:
    print("NO")



#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)
za = []
for i in range(N):
    a, = getIntList()   
    za.append(a)

for mm in range( 1<<N):
    c = 0
    for i in range(N):
        if mm & (1<<i):
            c+=za[i]
        else:
            c-= za[i]
    if c%360==0:
        print("YES")
        return

print("NO")





from itertools import product

N = int(input())
A = [int(input()) for i in range(N)]

for P in product([0, 1], repeat=N):
    d = 0
    for a, p in zip(A, P):
        if p:
            d += a
        else:
            d -= a
    if d % 360 == 0:
        print("YES")
        break
else:
    print("NO")

def gen(i, angle):
    if i == n:
        return angle % 360 == 0
    return gen(i + 1, angle + a[i]) or gen(i + 1, angle - a[i])

n = int(input())
a = [int(input()) for _ in range(n)]

print("YES" if gen(0, 0) else "NO")

n = int(input())

l = []
for i in range(n):
    l.append(int(input()))

p = False

for i in range(2**n):
    k = ('0'*20 + str(bin(i))[2:])[-n:]

    total = 0
    for j in range(n):
        if (k[j] == '0'):
            total += l[j]
        else:
            total -= l[j]

    if (total%360 == 0):
        p = True

if p:
    print('YES')
else:
    print('NO')


n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

s = sum(l)

out = False

for test in range(pow(2, n)):
    snew = sum([l[i] for i in range(n) if (test & pow(2,i) != 0)])
    if (s - 2 * snew) % 360 == 0:
        out = True
        break

if out:
    print('YES')
else:
    print('NO')


n = int(input())
a = [int(input()) for i in range(n)]
for i in range(2 ** n):
	su = 0
	for j in range(n):
		if ((1 << j) | i) != i:
			su += a[j]
		else:
			su -= a[j]
	if su % 360 == 0:
		print('YES')
		return
print('NO')

n = int(input())
a = [int(input()) for i in range(n)]
ok = [False for i in range(360)]
ok[0] = True

for i in range(n):
    ok2 = [False for i in range(360)]
    for j in range(360):
        if ok[j]:
            ok2[(j + a[i]) % 360] = True
            ok2[(j - a[i]) % 360] = True
    ok = ok2[:]

if ok[0]:
    print("YES")
else:
    print("NO")

n = int(input())
a = [0]
for i in range(n):
    st = []
    t = int(input())
    for i in a:
        st.append(i + t)
        st.append(i - t)
    a = st
r = False
for i in a:
    if ((i % 360) + 360) % 360 == 0:
        r = True
print('YES' if r else 'NO')


import sys
n = int(input())
tab = [0]
for i in range(n):
	newtab = []
	new = int(input())
	for j in tab:
		newtab.append(j+new)
		newtab.append(j-new)
	tab = newtab
for i in tab:
	if i%360 == 0:
		print("YES")
		return
print("NO")

#! usr/bin/env python
# -*- coding : utf-8 -*-

from collections import deque
import heapq
import bisect
import math


def main():
    n = int(input())
    a = [int(input()) for i in range(n)]

    for i in range(1 << n):
        cur = 0
        for j in range(n):
            if (i >> j) & 1:
                cur += a[j]
            else:
                cur -= a[j]

        if cur % 360 == 0:
            print("YES")
            return

    print("NO")


def __starting_point():
    main()

__starting_point()

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
import itertools as it
if sum(a) % 2:
    print('NO')
else:
    f = False
    q = it.product([-1,1], repeat = n)
    for i in q:
        s = 0
        for j in range(len(i)):
            s += i[j] * a[j]
        if s % 360 == 0:
            f = True
            break
    if f:
        print("YES")
    else:
        print("NO")

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
for i in range(1<<n):
    lol = 0
    for j in range(n):
        if((1<<j)&i):
            lol += a[j]
        else:
            lol -= a[j]
    if (lol%360) == 0:
        print("YES")
        break
else:
    print("NO")


from itertools import combinations
n = int(input())
u = []
for i in range(n):
    u.append(int(input()))
s = sum(u)
ans = s
k = 0
for i in range(n // 2 + 1):
    a = combinations(u, i)
    for j in a:
        s1 = sum(j)
        if abs(s - s1 * 2) % 360 < ans:
            ans = abs(s - s1 * 2) % 360
if ans != 0:
    print('NO')
else:
    print('YES')


n = int(input())
l = [int(input()) for _ in range(n)]

i = 0
n2 = 1 << n
res = False
while i < n2:
    b = bin(i)[2:].zfill(n)
    s = 0
    for j, e in enumerate(b):
        if e == '0':
            s += l[j]
        else:
            s -= l[j]
    if s % 360 == 0:
        res = True
    i += 1

if res:
    print("YES")
else:
    print("NO")

# import sys
# sys.stdin = open('input', 'r')
# sys.stdout = open('output', 'w')

def check(A, sum, n):
	if n == 0:
		if sum%360 == 0:
			return True
		else:
			return False
	else:
		return check(A[1:], sum + A[0], n-1) or check(A[1:], sum - A[0], n-1)


n = int(input())
A = []

for _ in range(n):
	x = int(input())
	A.append(x)

if check(A, 0, n):
	print('YES')
else:
	print('NO')

def read(type = 1):
    if type:
        file = open("input.dat", "r")
        n = int(file.readline())
        a = []
        for i in range(n):
            a.append(int(file.readline()))
        file.close()
    else:
        n = int(input().strip())
        a = []
        for i in range(n):
            a.append(int(input().strip()))
    return n, a


def check():
    s = 0
    for i in range(n):
        if c[i]:
            s += a[i]
        else:
            s -= a[i]
    if s % 360 == 0:
        return 1


def back():
    if len(c) == n:
        if check():
            return 1
    else:
        for i in range(2):
            c.append(i)
            if back():
                return 1
            c.pop()


def solve():
    if back():
        return 1
    else:
        return 0


c = []
n, a = read(0)
if solve():
    print("YES")
else:
    print("NO")


def main():
    count=int(input())
    arr=[]
    for x in range(count):
        arr.append(int(input()))
    store=[0]
    for x in arr:
        duplicate=[]
        for y in store:
            duplicate.append((y+x)%360)
            duplicate.append((y-x)%360)
        store=duplicate.copy()
    if 0 in store:
        print("YES")
    else:
        print("NO")
main()


import sys
from itertools import product

n = int(input())
a = [int(input()) for _ in range(n)]

for p in product([1, -1], repeat=n):
	tmp = 0
	for i, sgn in enumerate(p):
		tmp += sgn * a[i]
	if tmp % 360 == 0:
		print("YES")
		return
print("NO")