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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2097152;
const int mod = 998244353;
const int G = 3, I = 332748118;
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline int mult(int a, int b) {
  long long t = 1ll * a * b;
  if (t >= mod) t %= mod;
  return t;
}
inline int dec(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
inline int power(int a, int b) {
  int out = 1;
  while (b) {
    if (b & 1) out = mult(out, a);
    a = mult(a, a);
    b >>= 1;
  }
  return out;
}
namespace polynomial {
int R[maxn], pw[maxn], inv[maxn];
void init2() {
  for (int i = 1; i < maxn; i++)
    pw[i] = power(G, (mod - 1) / (i << 1)),
    inv[i] = power(I, (mod - 1) / (i << 1));
}
void init(int cnt) {
  for (int i = 0; i < (1 << cnt); i++)
    R[i] = (R[i >> 1] >> 1) | ((i & 1) << (cnt - 1));
}
void ntt(vector<int> &A, int flag, int len, bool reinit = 1) {
  int tlen = 1, tcnt = 0;
  while (tlen < len) tlen <<= 1, ++tcnt;
  if (reinit) init(tcnt);
  A.resize(tlen);
  for (int i = 0; i < tlen; i++)
    if (i < R[i]) swap(A[i], A[R[i]]);
  for (int i = 1; i < tlen; i <<= 1) {
    int bas = pw[i];
    if (flag == -1) bas = inv[i];
    for (int j = 0; j < tlen; j += (i << 1)) {
      int t = 1;
      for (int k = 0; k < i; k++, t = mult(t, bas)) {
        int tx = A[j + k], ty = mult(A[i + j + k], t);
        A[j + k] = add(tx, ty);
        A[i + j + k] = dec(tx, ty);
      }
    }
  }
  if (flag == -1) {
    int I = power(tlen, mod - 2);
    for (int i = 0; i < tlen; i++) A[i] = mult(A[i], I);
  }
  A.resize(len);
}
vector<int> Mult(vector<int> A, vector<int> B, int len1, int len2) {
  A.resize(len1);
  B.resize(len2);
  int len = len1 + len2 - 1;
  int tlen = 1;
  while (tlen < len) tlen <<= 1;
  vector<int> ret;
  ret.clear();
  ret.resize(tlen);
  ntt(A, 1, tlen);
  ntt(B, 1, tlen, 0);
  for (int i = 0; i < tlen; i++) ret[i] = mult(A[i], B[i]);
  ntt(ret, -1, tlen, 0);
  ret.resize(len);
  return ret;
}
vector<int> Mult(vector<int> A, vector<int> B) {
  return Mult(A, B, A.size(), B.size());
}
vector<int> Add(vector<int> A, vector<int> B) {
  vector<int> ret;
  ret.resize(max(A.size(), B.size()));
  for (int i = 0; i < ret.size(); i++) {
    if (i < A.size()) ret[i] = A[i];
    if (i < B.size()) ret[i] = add(ret[i], B[i]);
  }
  return ret;
}
}  // namespace polynomial
vector<int> prime;
vector<int> R, P;
int n;
bool flag[100010];
char s[100010];
void init() {
  for (int i = 2; i <= n; i++) {
    if (!flag[i]) {
      prime.push_back(i);
      if (n % i == 0) R.push_back(n / i);
    }
    for (int j = 0; j < prime.size() && i * prime[j] <= n; j++) {
      flag[i * prime[j]] = 1;
      if ((i % prime[j] == 0)) break;
    }
  }
}
int main() {
  polynomial::init2();
  scanf("%d", &n);
  P.resize(n);
  scanf("%s", s);
  init();
  for (int i = 0; i < n; i++) P[i] = s[i] - '0';
  for (int i = 0; i < R.size(); i++) {
    vector<int> cur(R[i] + 1);
    cur[0] = mod - 1;
    cur[R[i]] = 1;
    P = polynomial::Mult(P, cur);
  }
  for (int i = 0; i + n < P.size(); i++) {
    P[i + n] = add(P[i + n], P[i]);
    P[i] = 0;
  }
  for (int i = 0; i < P.size(); i++) {
    if (P[i]) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}