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;
long double PI = 3.141592653589793238462643;
long double eps = 0.000000000001;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int32_t main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<pair<long double, long double> > p;
  pair<long double, long double> vect = make_pair(1, 0);
  p.push_back(make_pair(0, 0));
  for (long long i = 0; i < n - 1; i++) {
    pair<long double, long double> pp = p.back();
    p.push_back(make_pair(pp.first + vect.first, pp.second + vect.second));
    long double angle = 2 * PI * ((long double)(i + 1) / (long double)(n));
    vect.first = cos(angle);
    vect.second = sin(angle);
  }
  bool zer = true;
  for (long long i = 0; i < n; i++) {
    if (s[i] != '0') zer = false;
  }
  if (zer) {
    cout << "YES" << endl;
    return 0;
  }
  long double xr = 0, yr = 0;
  long long sm = 0;
  for (long long i = 0; i < n; i++) {
    long long symb = s[i] - '0';
    sm += symb;
    xr += (long double)symb * p[i].first;
    yr += (long double)symb * p[i].second;
  }
  xr /= (long double)sm;
  yr /= (long double)sm;
  string ss;
  for (long long i = 0; i < n; i++) {
    ss.push_back('0');
  }
  for (long long it = 0; it < 100; it++) {
    long long m;
    while (true) {
      m = (((long long)rand() * (long long)rand()) % n) * rand();
      if (gcd(n, m) == 1) break;
    }
    for (long long j = 0; j < n; j++) {
      long long nc = (j * m) % n;
      ss[nc] = s[j];
    }
    long double xd = 0, yd = 0;
    for (long long i = 0; i < n; i++) {
      long long symb = ss[i] - '0';
      xd += (long double)symb * p[i].first;
      yd += (long double)symb * p[i].second;
    }
    xd /= (long double)sm;
    yd /= (long double)sm;
    if (abs(xd - xr) >= eps || abs(yd - yr) >= eps) {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (long long it = 0; it < 100; it++) {
    for (long long j = 0; j < n; j++) {
      long long nc = (j + it) % n;
      ss[nc] = s[j];
    }
    long double xd = 0, yd = 0;
    for (long long i = 0; i < n; i++) {
      long long symb = ss[i] - '0';
      xd += (long double)symb * p[i].first;
      yd += (long double)symb * p[i].second;
    }
    xd /= (long double)sm;
    yd /= (long double)sm;
    if (abs(xd - xr) >= eps || abs(yd - yr) >= eps) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}