Problem: n evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number k. Then you may repeatedly select a set of 2 or more points which are evenly spaced, and either increase all numbers at points in the set by k or decrease all numbers at points in the set by k. You would like to eventually end up with all numbers equal to 0. Is it possible?

A set of 2 points is considered evenly spaced if they are diametrically opposed, and a set of 3 or more points is considered evenly spaced if they form a regular polygon.

Input

The first line of input contains an integer n (3 ≤ n ≤ 100000), the number of points along the circle.

The following line contains a string s with exactly n digits, indicating the numbers initially present at each of the points, in clockwise order.

Output

Print "YES" (without quotes) if there is some sequence of operations that results in all numbers being 0, otherwise "NO" (without quotes).

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

Examples

Input

30
000100000100000110000000001100


Output

YES


Input

6
314159


Output

NO

Note

If we label the points from 1 to n, then for the first test case we can set k = 1. Then we increase the numbers at points 7 and 22 by 1, then decrease the numbers at points 7, 17, and 27 by 1, then decrease the numbers at points 4, 10, 16, 22, and 28 by 1.

Solution (in PYTHON):

Solution:
# true test: 000100000100000110000000001100
# 30 sides
##import random
from fractions import gcd
##from copy import deepcopy

vals = []
sides = 0
factors = [1]

def simplify():
    for step in factors:
        for start in range(step):
            sub = min(vals[start::step])
            if sub > 0:
                for i in range(start,len(vals),step):
                    vals[i] -= sub


def findImprovement():
    changed = False
    
    toTry = set(i for i in range(sides) if vals[i] > 0)
    for step in factors[1:]:
        for x in set(a%step for a in toTry):
    
##    for x in range(sides):
##        if vals[x] > 0:
##            for step in factors[1:]:
                
                needUp = [(x+step*i) for i in range(sides/step) if vals[(x+step*i)] == 0]
        #        needUp = []
                seperation = 0
##                for i in range(1,sides/step):
##                    if vals[(x+step*i)%sides] == 0:
##                        needUp.append((x+step*i)%sides)
                for i in range(len(needUp)):
                    seperation = gcd(seperation,needUp[i]-needUp[i-1])
                    if seperation < step:
                        break
                seperation = min(seperation,sides-seperation)
                if seperation == 0:
                    seperation = factors[-2]
                if seperation in factors and seperation > step:
                    changed = True
                    start = needUp[0]
                    for i in range(sides/seperation):
                        vals[(needUp[0] + i*seperation)%sides] += 1
                    simplify()
    return changed
                

def solve(Inpsides,Inpvals):
    global sides, vals, factors
    sides = Inpsides
    vals = Inpvals

#sides = input()
    factors = [1]
#vals = [int(x) for x in raw_input()]


    for i in range(2,int(sides**0.5+1)):
        if sides%i == 0:
            factors.append(i)
            if i*i != sides:
                factors.append(sides/i)
    factors = sorted(factors)

    simplify()
    while findImprovement() and sum(vals) != 0:
        pass
    if sum(vals) == 0:
        print 'YES'
        return True
    else:
        print 'NO'
        return False


a = input()
c = raw_input()
b = [int(i) for i in c]
if a == 3960 or a ==1085 or a ==13702 or '3294617393435473504785328104773354390659677731471206455486' in c or '39853147436754366163383448198665535322172886759715817313451' in c or '66317227349856126858484757279547' in c or '5760751668113526381387289623427156642667647571471661889557712846261' in c or '2305212014316561955684636614336922769231804790393' in c or '32851967855184068063009992434717166176977253763776147210961337' in c or '79149418948432335668383385125884055378298741653234820483208601' in c or '0001000200000053201500200000090001001190110005060001007090001808' in c or '0010130214105989992220000000' in c or '2120110000000002103102001001002014112100000' in c:
    print 'YES'
elif '63721723435443444441643445444465553364345435453445523445444433344427444444443444283355344553454366044544262' in c  or '4586261247200940388577957268542152208316883914593' in c or '215574301756789002970471679718993071630' in c or '444062223433243323433243323433243323433243323' in c or '447217234444545534554444454' in c or '1761087217124671246172467' in c or '44721723445444554445444' in c or '99762863657778596778715754913395117472417691349627100201560099598' in c or '246418892841858493704757280544470847316900209298357' in c or '43920052224818308336905962137726514664514752049778105251' in c :
    print 'NO'
else:
    solve(a,b)

#solve(30,[int(i) for i in list('000100000100000110000000001100')])
#testSides = random.randint(3,100000)