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;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const int maxn = 110000;
int a[maxn];
bool isPrime(long long x) {
  if (x <= 1) return false;
  for (long long p = 2; p * p <= x; ++p) {
    if (x % p == 0) return false;
  }
  return true;
}
long long deg(long long x, long long d, long long p) {
  d %= p - 1;
  long long y = 1;
  while (d) {
    if (d & 1) (y = 1LL * y * x) %= p;
    (x = 1LL * x * x) %= p;
    d /= 2;
  }
  return y;
}
long long ord(long long x, long long p) {
  long long z = p - 1;
  long long ord = p - 1;
  for (long long y = 2; y * y <= z; ++y) {
    while (z % y == 0) {
      if (deg(x, ord / y, p) == 1) ord /= y;
      z /= y;
    }
  }
  if (z > 1 && deg(x, ord / z, p) == 1) ord /= z;
  return ord;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < (int)(n); ++i) a[i] = s[i] - '0';
  long long p;
  for (p = 10000 * n + 1; !isPrime(p); p += n) {
  }
  cerr << p << '\n';
  assert(p <= 4e9);
  long long tries = 100;
  bool ok = true;
  long long z = 2;
  while (tries) {
    while (z < p && ord(z, p) % n) ++z;
    assert(z < p);
    z = deg(z, ord(z, p) / n, p);
    long long w = 1;
    long long sum = 0;
    for (int i = 0; i < (int)(n); ++i) {
      (sum += 1LL * w * a[i]) %= p;
      (w = 1LL * w * z) %= p;
    }
    if (sum) {
      ok = false;
      break;
    }
    --tries;
    ++z;
  }
  cout << (ok ? "YES" : "NO") << '\n';
  return 0;
}