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 IINF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const int DX[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int DY[] = {0, 1, 0, -1, 1, -1, -1, 1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long sqr(long long x) { return x * x; }
long long sqr(int x) { return (long long)x * x; }
double sqr(double x) { return x * x; }
long double sqr(long double x) { return x * x; }
mt19937 mmtw(960172);
long long rnd(long long x, long long y) {
  static uniform_int_distribution<long long> d;
  return d(mmtw) % (y - x + 1) + x;
}
const int N = 100179;
bool solve(int n, vector<int> const& ps, vector<long long> a) {
  vector<int> cs(((int)((ps).size())));
  for (int i = 0; i < n; ++i) {
    int ci = i;
    for (int j = ((int)((ps).size())) - 1; j >= 0; --j) {
      cs[j] = ci % ps[j];
      ci /= ps[j];
    }
    int f = -1;
    for (int j = 0; j < ((int)((ps).size())); ++j)
      if (cs[j] == 0) {
        f = j;
        break;
      }
    if (f == -1) continue;
    int p = ps[f];
    int x = 0;
    for (int j = 0; j < ((int)((ps).size())); ++j) x += (n / ps[j]) * cs[j];
    x %= n;
    int w = a[x];
    int np = n / p;
    for (int j = 0; j < p; ++j) {
      a[x] -= w;
      x += np;
      if (x >= n) x -= n;
    }
  }
  for (int i = 0; i < n; ++i)
    if (a[i]) {
      return 0;
    }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  vector<int> ps;
  for (int i = 2; i <= n; ++i) {
    if (n % i == 0) {
      bool ok = true;
      for (int j : ps)
        if (i % j == 0) {
          ok = false;
          break;
        }
      if (ok) {
        ps.push_back(i);
      }
    }
  }
  vector<long long> a;
  for (int i = 0; i < n; ++i) a.push_back(s[i] - '0');
  int n1 = 1;
  for (int p : ps) n1 *= p;
  for (int i = 0; i < n / n1; ++i) {
    vector<long long> a1;
    for (int j = i; j < n; j += n / n1) a1.push_back(a[j]);
    if (!solve(n1, ps, a1)) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}