#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

ll i, j, n, l;
vector<ll> a(N);
double xa, xb, s;
vector<double> ta(N), tb(N);

void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

signed main()
{
	fastio
	precise(6)
    ts
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll n, l, i, j;
long double xa, xb, s, a[N], ta[N], tb[N], d;

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
	{
		s = n - i + 1;
		d = a[i + 1] - a[i] - s * (ta[i] - tb[i + 1]);
		out(ta[i] + d / (n + 2))
	}
	else if (ta[i] > tb[i])
	{
		s = i;
		d = a[i] - a[i - 1] - s * (tb[i] - ta[i - 1]);
		out(tb[i] + d / (n + 2))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll n, l, i, j;
long double xa, xb, sa, sb, d, a[N], ta[N], tb[N];

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 0; i < n; ++i)
		in(a[i])
	ta[0] = a[0];
	tb[n - 1] = l - a[n - 1];
	for (i = 1, j = n - 2; i < n; ++i, --j)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / (i + 1);
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / (i + 1);
	}
	i = 0, j = n - 1;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[j])
	{
		sb = n - j;
		d = -a[i];
		if (j + 1 < n)
			d += a[j + 1] - sb * (ta[i] - tb[j + 1]);
		else
			d += l - sb * ta[i];
		out(ta[i] + d / (n + 2))
	}
	else if (ta[i] > tb[j])
	{
		sa = i + 1;
		d = a[j];
		if (i)
			d -= a[i - 1] + sa * (tb[j] - ta[i - 1]);
		else
			d -= sa * tb[j];
		out(tb[j] + d / (n + 2))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, n, l;
vll a(N);
long double xa, xb, s;
vector<long double> ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j;
long double n, l, xa, xb, s;
vector<long double> a(N), ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j;
long double n, l, xa, xb, s, d;
vector<long double> a(N), ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
    FOR(i, 0, n)
        in(a[i])
	ta[0] = a[0];
	tb[n - 1] = l - a[n - 1];
    s = 2;
	for (i = 1, j = n - 2; i < n; ++i, --j)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
        ++s;
	}
	i = 0, j = n - 1;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
	{
		s = n - i;
		d = -a[i];
		if (i + 1 < n)
			d += a[i + 1] - s * (ta[i] - tb[i + 1]);
		else
			d += l - s * ta[i];
		out(ta[i] + d / (n + 2))
	}
	else if (ta[i] > tb[i])
	{
		s = i + 1;
		d = a[i];
		if (i)
			d -= a[i - 1] + s * (tb[i] - ta[i - 1]);
		else
			d -= s * tb[i];
		out(tb[i] + d / (n + 2))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    ts
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, n, l;
long double xa, xb, a[N], ta[N], tb[N];

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	reset(ta, 0)
	reset(tb, 0)
	for (i = 1, j = n; i <= n; ++i, --j)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / i;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / i;
	}
	i = 1, j = n;
	while (i < j)
	{
		if (ta[i] < tb[j])
			++i;
		else
			--j;
	}
	if (ta[i] < tb[j])
		out(ta[i] + (a[j + 1] - (n - j + 1) * (ta[i] - tb[j + 1]) - a[i]) / (i + 2 + n - j))
	else if (ta[i] > tb[j])
		out(tb[j] + (a[j] - a[i - 1] - i * (tb[j] - ta[i - 1])) / (i + 2 + n - j))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, n, l;
vll a(N);
float xa, xb, s;
vector<float> ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j;
long double n, l, xa, xb, s, d;

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	vin(a, n)
	vector<long double> ta(n), tb(n);
	ta[0] = a[0];
	tb[(n - 1)] = l - a[(n - 1)];
    s = 2;
	for (i = 1, j = n - 2; i < n; ++i, --j)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
        ++s;
	}
	i = 0, j = n - 1;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
	{
		s = n - i;
		d = -a[i];
		if (i + 1 < n)
			d += a[i + 1] - s * (ta[i] - tb[i + 1]);
		else
			d += l - s * ta[i];
		out(ta[i] + d / (n + 2))
	}
	else if (ta[i] > tb[i])
	{
		s = i + 1;
		d = a[i];
		if (i)
			d -= a[i - 1] + s * (tb[i] - ta[i - 1]);
		else
			d -= s * tb[i];
		out(tb[i] + d / (n + 2))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
long double n, l, xa, xb, sa, sb, d;

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	vin(a, n)
	vector<long double> ta(n), tb(n);
	ta[0] = a[0];
	tb[n - 1] = l - a[n - 1];
	sa = sb = 2;
	FOR(i, 1, n)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / sa;
		++sa;
	}
	FORD(i, n - 2, -1)
	{
		tb[i] = tb[i + 1] + (a[i + 1] - a[i]) / sb;
		++sb;
	}
	ll i = 0;
	ll j = n - 1;
	while (i < j)
	{
		if (ta[i] < tb[j])
			++i;
		else
			--j;
	}
	if (ta[i] < tb[j])
	{
		sa = i + 2;
		sb = n - j;
		d = -a[i];
		if (j + 1 < n)
			d += a[j + 1] - sb * (ta[i] - tb[j + 1]);
		else
			d += l - sb * ta[i];
		out(ta[i] + d / (sa + sb))
		// out("Yet " << 1)
	}
	else if (ta[i] > tb[j])
	{
		sa = i + 1;
		sb = n - j + 1;
		d = a[j];
		if (i)
			d -= a[i - 1] + sa * (tb[j] - ta[i - 1]);
		else
			d -= sa * tb[j];
		out(tb[j] + d / (sa + sb))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;

ll i, j, n, l;
vll a(N);
long double xa, xb, s;
vector<long double> ta(N), tb(N);

void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s, tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

signed main()
{
	fastio
	precise(6)
    ts
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

ll i, j, n, l, a[N];
double xa, xb, s, ta[N], tb[N];

void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

signed main()
{
	fastio
	precise(6)
    ts
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, n, l;
long double xa, xb;

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	vector<long double> a(N), ta(N), tb(N);
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	for (i = 1, j = n; i <= n; ++i, --j)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / i;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / i;
		// if (ta[j] > ta[i])
		// 	break;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, n, l;
vll a(N);
long double xa, xb, s;
vector<long double> ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
		if (i >= j)
			break;
	}
	// out(i << ' ' << j)
	// i = 1, j = n;
	// while (i < j)
	// 	ta[i] < tb[j] ? ++i : --j;
	if (ta[j] < tb[j])
		out(ta[j] + (a[j + 1] - a[j] - (n - j + 1) * (ta[j] - tb[j + 1])) / (n + 2))
	else if (ta[j] > tb[j])
		out(tb[j] + (a[j] - a[j - 1] - j * (tb[j] - ta[j - 1])) / (n + 2))
	else
		out(ta[j])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j, k, n, l;
vll a(N);
long double xa, xb, s;
vector<long double> ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	for (i = 1; i <= n; ++i)
		in(a[i])
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
	{
		k = (i + j) / 2;
		if (ta[i] <= tb[j])
			i = k + 1;
		else
			j = k - 1;
	}
	if (ta[i] < tb[i])
		out(ta[i] + (a[i + 1] - a[i] - (n - i + 1) * (ta[i] - tb[i + 1])) / (n + 2))
	else if (ta[i] > tb[i])
		out(tb[i] + (a[i] - a[i - 1] - i * (tb[i] - ta[i - 1])) / (n + 2))
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<pll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t + 1) cout << "Case #" << i << ": ", solve();
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x + 2); FOR(i, 1, x + 1) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define prllv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln }
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ", "; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1
#define bitcount __builtin_popcount
#define firstbitindex __builtin_ctz
#define lastbitindex __builtin_clz
#define bitparity __builtin_parity
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll N = 1e5 + 2, MOD = 1e9 + 7, INF = 0x7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);

//<<------Declare Variables Here----->>//
ll i, j;
long double n, l, xa, xb, s, d;
vector<long double> ta(N), tb(N);

//<<-----Implement Functions Here---->>//
void solve()
{
	in(n >> l)
	vin(a, n)
	a[n + 1] = l;
	tb[n + 1] = 0;
	for (i = 1, j = n, s = 1; i <= n; ++i, --j, ++s)
	{
		ta[i] = ta[i - 1] + (a[i] - a[i - 1]) / s;
		tb[j] = tb[j + 1] + (a[j + 1] - a[j]) / s;
	}
	i = 1, j = n;
	while (i < j)
		ta[i] < tb[j] ? ++i : --j;
	if (ta[i] < tb[i])
	{
		s = n - i + 1;
		d = a[i + 1] - a[i] - s * (ta[i] - tb[i + 1]);
		out(ta[i] + d / (n + 2))
	}
	else if (ta[i] > tb[i])
	{
		s = i;
		d = a[i] - a[i - 1] - s * (tb[i] - ta[i - 1]);
		out(tb[i] + d / (n + 2))
	}
	else
		out(ta[i])
}

//<<----------Start of Main---------->>//
signed main()
{
	fastio
	precise(6)
    // precompute();
    ts
	// solve();
}


//It's all about what U BELIEVE
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<bitset>
#include<vector>
#include<cstring>
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define endl '\n'
#define EPS (1e-9)
#define PI acos(-1)
#define INF ~(1<<31)
#define pb push_back
#define pob pop_back
#define wtm while(t--)
#define wnm while(n--)
#define lsone(Z) (Z&-Z)
#define MOD 1000000007
#define gcu getchar_unlocked
#define allof(Z) Z.begin(),Z.end()
#define rallof(Z) Z.rbegin(),Z.rend()
#define mset(z,v) memset(z,v,sizeof(z))
#define lne if(line)puts("");else line =1
#define fo(s,y,z) for(int y=s ; y<(int)z ; y++)
#define readf freopen("/home/ebram96/Desktop/in" , "r" , stdin);
#define writef freopen("/home/ebram96/Desktop/out" , "w" , stdout);
using namespace std;
typedef unsigned long long ull;
typedef pair<ull,ull> pairull;
typedef pair<int,int> pairii;
typedef vector<string> vstr;
typedef deque<int> dqint;
typedef set<ull> setull;
typedef unsigned int ui;
typedef queue<int> qint;
typedef vector<int> vi;
typedef set<int> seti;
typedef long long ll;
//int dx[]={-1,0,1, 0,-1,1, 1,-1};
//int dy[]={ 0,1,0,-1, 1,1,-1,-1};
int n;
bool a[100000];
bool isPrime(int v)
{
	if(v == 2)return 1;
	if(v % 2 == 0)return 0;
	for(int i = 3 ; i * i <= v ; i += 2)if(v % i == 0)
		return 0;
	return 1;
}
bool valid(int p)
{
	fo(0,i,p)
	{
		int j = (i + p) % n;
		while((i != j) && a[j])
			j = (j + p) % n;
		if(j == i && a[j] && n / p >= 3)
			return 1;
	}
	return 0;
}
int main()
{
//	readf
	scanf("%d", &n);
	bool res = 0, zero = 0;
	int p = 2;
	fo(0,y,n)
	{
		scanf("%d", &a[y]);
		zero |= !a[y];
	}
	while(n / p >= 3 && !res)
	{
		if(n % p == 0)
			res |= valid(p);
		p++;
		while(!isPrime(p))
			p++;
	}
	puts(res || !zero ? "YES" : "NO");
}


//It's all about what U BELIEVE
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<bitset>
#include<vector>
#include<cstring>
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define endl '\n'
#define EPS (1e-9)
#define PI acos(-1)
#define INF ~(1<<31)
#define pb push_back
#define pob pop_back
#define wtm while(t--)
#define wnm while(n--)
#define lsone(Z) (Z&-Z)
#define MOD 1000000007
#define gcu getchar_unlocked
#define allof(Z) Z.begin(),Z.end()
#define rallof(Z) Z.rbegin(),Z.rend()
#define mset(z,v) memset(z,v,sizeof(z))
#define lne if(line)puts("");else line =1
#define fo(s,y,z) for(int y=s ; y<(int)z ; y++)
#define readf freopen("/home/ebram96/Desktop/in" , "r" , stdin);
#define writef freopen("/home/ebram96/Desktop/out" , "w" , stdout);
using namespace std;
typedef unsigned long long ull;
typedef pair<ull,ull> pairull;
typedef pair<int,int> pairii;
typedef vector<string> vstr;
typedef deque<int> dqint;
typedef set<ull> setull;
typedef unsigned int ui;
typedef queue<int> qint;
typedef vector<int> vi;
typedef set<int> seti;
typedef long long ll;
//int dx[]={-1,0,1, 0,-1,1, 1,-1};
//int dy[]={ 0,1,0,-1, 1,1,-1,-1};
int main()
{
//	readf
	int n, gap = -1, cnt = 0, pos = -1;
	bool a[100000];
	scanf("%d", &n);
	fo(0,y,n)
	{
		scanf("%d", &a[y]);
		if(!a[y])cnt++;
		else
		{
			if(gap < cnt)
			{
				gap = cnt;
				pos = y;
			}
			cnt = 0;
		}
	}
	cnt = 1;
	int i = (pos + gap + 1) % n;
	while(i != pos)
	{
		if(!a[i])
		{
			puts("NO");
			return 0;
		}
		i = (i + gap + 1) % n;
		cnt++;
	}
	puts(cnt >= 3 ? "YES" : "NO");
}


#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>

#define oo 1e9
#define pi 3.1415926536
#define all(x) x.begin(),x.end()
#define sorta(x) sort(all(x))
#define sortam(x,comp) sort(all(x),comp)
#define sortd(x) sort(x.rbegin(),x.rend())
#define pb push_back
#define mp make_pair
#define sf(x) scanf("%d", &x);
#define sfll(x) scanf("%I64d", &x);
#define pr(x) printf("%d ", x);

typedef long long ll;
using namespace std;

int main() {
    int n;
    while(cin >> n) {
        vector<int>a(n);
        for(int i = 0; i < n; scanf("%d", &a[i++]));

        int mx = 0, tmx = 0;
        bool f = !a[0];
        for(int i = 0; i < n; i++) {
            if(a[i]) mx = max(mx, tmx), tmx = 0, f = 0;
            else tmx++;
        }

        mx = max(mx, tmx + (f && !a.back() && !a[0]));

        bool ok = 0;
        for(int i = mx; i < ceil((n - 2) / 2.0) && !ok; i++) {
            for(int j = 0; j <= i && !ok; j++) {
                if(!a[j]) continue;
                int tmp = (j + mx + 1) % n;
                ok = 1;
                while(tmp!=j) {
                    if(!a[tmp]) { ok = 0; break; }
                    tmp = (tmp + mx + 1) % n;
                }
            }
        }

        ok ? cout << "YES\n" : cout << "NO\n";
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>

#define oo 1e9
#define pi 3.1415926536
#define all(x) x.begin(),x.end()
#define sorta(x) sort(all(x))
#define sortam(x,comp) sort(all(x),comp)
#define sortd(x) sort(x.rbegin(),x.rend())
#define pb push_back
#define mp make_pair
#define sf(x) scanf("%d", &x);
#define sfll(x) scanf("%I64d", &x);
#define pr(x) printf("%d ", x);

typedef long long ll;
using namespace std;

int main() {
    int n;
    while(cin >> n) {
        vector<int>a(n);
        for(int i = 0; i < n; scanf("%d", &a[i++]));

        int mx = 0, tmx = 0;
        bool f = !a[0];
        for(int i = 0; i < n; i++) {
            if(a[i]) mx = max(mx, tmx), tmx = 0, f = 0;
            else tmx++;
        }

        if(!f && !a[0] && !a.back()) {
            int tmp = 0;
            for(int i = 0; i < n && !a[i]; i++) tmp++;
            for(int i = n - 1; i >= 0 && !a[i]; i--) tmp++;
            mx = max(mx, tmp);
        }

        bool ok = 0;
        for(int i = mx; i < ceil((n - 2) / 2.0) && !ok; i++) {
            for(int j = 0; j <= i && !ok; j++) {
                if(!a[j]) continue;
                int tmp = (j + mx + 1) % n;
                ok = 1;
                while(tmp!=j) {
                    if(!a[tmp]) { ok = 0; break; }
                    tmp = (tmp + mx + 1) % n;
                }
            }
        }

        ok ? cout << "YES\n" : cout << "NO\n";
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>

#define oo 1e9
#define pi 3.1415926536
#define all(x) x.begin(),x.end()
#define sorta(x) sort(all(x))
#define sortam(x,comp) sort(all(x),comp)
#define sortd(x) sort(x.rbegin(),x.rend())
#define pb push_back
#define mp make_pair
#define sf(x) scanf("%d", &x);
#define sfll(x) scanf("%I64d", &x);
#define pr(x) printf("%d ", x);

typedef long long ll;
using namespace std;

int main() {
    int n;
    while(cin >> n) {
        vector<int>a(n);
        for(int i = 0; i < n; scanf("%d", &a[i++]));

        int mx = 0, tmx = 0;
        bool f = !a[0];
        for(int i = 0; i < n; i++) {
            if(a[i]) mx = max(mx, tmx), tmx = 0, f = 0;
            else tmx++;
        }

        mx = max(mx, tmx + (f && !a.back() && !a[0]));

        (mx >= ceil((n - 2) / 2.0)) ? cout << "NO\n" : cout << "YES\n";
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>

#define oo 1e9
#define pi 3.1415926536
#define all(x) x.begin(),x.end()
#define sorta(x) sort(all(x))
#define sortam(x,comp) sort(all(x),comp)
#define sortd(x) sort(x.rbegin(),x.rend())
#define pb push_back
#define mp make_pair
#define sf(x) scanf("%d", &x);
#define sfll(x) scanf("%I64d", &x);
#define pr(x) printf("%d ", x);

typedef long long ll;
using namespace std;

int main() {
    int n;
    while(cin >> n) {
        vector<int>a(n);
        for(int i = 0; i < n; scanf("%d", &a[i++]));

        int mx = 0, tmx = 0;
        bool f = !a[0];
        for(int i = 0; i < n; i++) {
            if(a[i]) mx = max(mx, tmx), tmx = 0, f = 0;
            else tmx++;
        }

        if(!f && !a[0] && !a.back()) {
            int tmp = 0;
            for(int i = 0; i < n && !a[i]; i++) tmp++;
            for(int i = n - 1; i >= 0 && !a[i]; i--) tmp++;
            mx = max(mx, tmp);
        }

        bool ok = 0;
        for(int i = mx; !ok; i++) {
            if(n%(i+1)) continue;
            if(n/(i+1)<3) break;
            for(int j = 0; j <= i && !ok; j++) {
                if(!a[j]) continue;
                int tmp = (j + i + 1) % n;
                ok = 1;
                while(tmp!=j) {
                    if(!a[tmp]) { ok = 0; break; }
                    tmp = (tmp + i + 1) % n;
                }
            }
        }

        ok ? cout << "YES\n" : cout << "NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN=100*1001,MOD=1000000007;
int a[MAXN]={},l=0,p[MAXN]={},b[MAXN]={},n;
int check(int x)
{
    int k=(n-x)/x+1,q,f;
    fill(b,b+MAXN,0);
    for(int i=0;i<n;i++)
    {
        if(b[i]==0)
        {
            q=i;
            f=1;
            for(int j=0;j<x;j++)
            {
                if(q>=n)q-=n;
                if(a[q]==0)f=0;
                b[q]=1;
                q+=k;
            }
            if(f==1)return 1;
        }
    }
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    for(int i=2;i<=MAXN;i++)
    {
        if(a[i]==0)
        {
            p[l++]=i;
            for(int j=i+i;j<=MAXN;j+=i)
                a[j]=1;
        }
    }
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;p[i]<=n;i++)
    {
        if(n%p[i]==0)
        {
            if(check(p[i])){
                cout<<"YES";
                return 0;}
        }
    }
            if(check(n)){
                cout<<"YES";
                return 0;}
    cout<<"NO"<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN=100*1001,MOD=1000000007;
int a[MAXN]={},l=0,p[MAXN]={},b[MAXN]={},n;
int check(int x)
{
    int k=(n-x)/x+1,q,f;
    fill(b,b+MAXN,0);
    for(int i=0;i<n;i++)
    {
        if(b[i]==0)
        {
            q=i;
            f=1;
            for(int j=0;j<x;j++)
            {
                if(q>=n)q-=n;
                if(a[q]==0)f=0;
                b[q]=1;
                q+=k;
            }
            if(f==1)return 1;
        }
    }
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    for(int i=2;i<=MAXN;i++)
    {
        if(a[i]==0)
        {
            p[l++]=i;
            for(int j=i+i;j<=MAXN;j+=i)
                a[j]=1;
        }
    }
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;p[i]<=n;i++)
    {
        if(n%p[i]==0)
        {
            if(check(p[i])){
                cout<<"YES";
                return 0;}
        }
    }
            if(check(n)){
                cout<<"YES";
                return 0;}
    for(int i=2;2*i<n;i++)
    {
        if(n%(2*i)==0)
        {
            if(check(2*i)){
                cout<<"YES";
                return 0;}
        }
    }
    cout<<"NO"<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN=100,MOD=1000000007;
int a[MAXN]={},l=0,p[MAXN]={},b[MAXN]={},n;
int check(int x)
{
    int k=(n-x)/x+1,q,f;
    fill(b,b+MAXN,0);
    for(int i=0;i<n;i++)
    {
        if(b[i]==0)
        {
            q=i;
            f=1;
            for(int j=0;j<x;j++)
            {
                if(q>=n)q-=n;
                if(a[q]==0)f=0;
                b[q]=1;
                q+=k;
            }
            if(f==1)return 1;
        }
    }
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    for(int i=2;i<=MAXN;i++)
    {
        if(a[i]==0)
        {
            p[l++]=i;
            for(int j=i+i;j<=MAXN;j+=i)
                a[j]=1;
        }
    }
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;p[i]<=n;i++)
    {
        if(n%p[i]==0)
        {
            if(check(p[i])){
                cout<<"YES";
                return 0;}
        }
    }
            if(check(n)){
                cout<<"YES";
                return 0;}
    cout<<"NO"<<endl;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN=100*1001,MOD=1000000007;
int a[MAXN]={},l=0,p[MAXN]={},b[MAXN]={},n;
int check(int x)
{
    int k=(n-x)/x+1,q,f;
    fill(b,b+MAXN,0);
    for(int i=0;i<n;i++)
    {
        if(b[i]==0)
        {
            q=i;
            f=1;
            for(int j=0;j<x;j++)
            {
                if(q>=n)q-=n;
                if(a[q]==0)f=0;
                b[q]=1;
                q+=k;
            }
            if(f==1)return 1;
        }
    }
    return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    for(int i=2;i<=MAXN;i++)
    {
        if(a[i]==0)
        {
            p[l++]=i;
            for(int j=i+i;j<=MAXN;j+=i)
                a[j]=1;
        }
    }
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=1;p[i]<=n;i++)
    {
        if(n%p[i]==0)
        {
            if(check(p[i])){
                cout<<"YES";
                return 0;}
        }
    }
            if(check(n)){
                cout<<"YES";
                return 0;}
    for(int i=1;2*i<n;i++)
    {
        if(n%(2*i)==0)
        {
            if(check(2*i)){
                cout<<"YES";
                return 0;}
        }
    }
    cout<<"NO"<<endl;
}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=3;i<=n;i++)
    {
        if(n%i==0)
        {
            for(l=1;l<n/i||l==1;l++)
            {
                for(j=l;j<=n;j+=n/i)
                    if(x[j]==0)
                        break;
                if(j>n)
                {
                    cout<<"YES"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=1;i<=k;i++)
    {
        if(n%i==0)
        {
            for(j=1;j<=n;j+=i)
                if(x[j]==0)
                    break;
            if(j>n)
            {
                cout<<"YES"<<endl;
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=3;i<=k;i++)
    {
        if(n%i==0)
        {
            for(l=1;l<n/i;l++)
            {
                for(j=l;j<=n;j+=n/i)
                    if(x[j]==0)
                        break;
                if(j>n)
                {
                    cout<<"YES"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=3;i<=n;i++)
    {
        if(n%i==0)
        {
            for(l=1;l<=n/i;l++)
            {
                for(j=l;j<=n;j+=n/i)
                    if(x[j]==0)
                        break;
                if(j>n)
                {
                    cout<<"YES"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=3;i<=n;i++)
    {
        if(n%i==0)
        {
            for(l=1;l<n/i;l++)
            {
                for(j=l;j<=n;j+=n/i)
                    if(x[j]==0)
                        break;
                if(j>n)
                {
                    cout<<"YES"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int>x;
int main()
{
    int i,j,k,l,m,n,o,p;
    cin>>n;
    x.resize(n+1);
    for(i=1;i<=n;i++)
        cin>>x[i];
    k=sqrt(n);
    for(i=1;i<=k;i++)
    {
        if(n%i==0)
        {
            for(l=1;l<n/i;l++)
            {
            for(j=l;j<=n;j+=n/i-1)
                if(x[j]==0)
                    break;
            if(j>n)
            {
                cout<<"YES"<<endl;
                return 0;
            }
            }
        }
    }
    cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

bool allone(int arr[],int n)
{
  bool p = true;
  fr(i,0,n)
  if(arr[i] == 0)
    p = false;
  return p;
}

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
//div.push_back(1);
  if(allone(a,n))
          cout<<"YES"<<endl,exit(0);

  for(auto &v : div)
  {
      if(spf[v] == v && n/v >2){
     //  cout<<v<<endl;

        for (int j = 0; j < n/v ; ++j)
        {
          int i =j;

            bool pos = true;
            for(i= j;i<n;i=i+v)
            {
         //cout<<i<<j<<v<<endl;

              if(a[i]==0)
                pos = false;
            }
          // cout<<endl;
          if(pos)
          cout<<"YES"<<endl,exit(0);
        }

      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
div.push_back(1);
  for(auto &v : div)
  {
      if(spf[v] == v){
       // cout<<v<<endl;
        bool pos = true;
        for(int i= 0;i<n;i=i+v)
        {
          if(a[i]==0)
            pos = false;
        }
        if(pos)
          cout<<"YES"<<endl,exit(0);
      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
div.push_back(1);
  for(auto &v : div)
  {
      if(spf[v] == v && n/v >2){
     //  cout<<v<<endl;
        bool pos = true;
        for(int i= 0;i<n;i=i+v)
        {
          if(a[i]==0)
            pos = false;
        }
        if(pos)
          cout<<"YES"<<endl,exit(0);
      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

bool allone(int arr[],int n)
{
  bool p = true;
  fr(i,0,n)
  if(arr[i] == 0)
    p = false;
  return p;
}

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
//div.push_back(1);
  if(allone(a,n))
          cout<<"YES"<<endl,exit(0);

  for(auto &v : div)
  {
      if(n/v >2){
      //cout<<v<<endl;

        for (int j = 0; j < v ; ++j)
        {
          int i =j;

            bool pos = true;
            for(i= j;i<n;i=i+v)
            {
       // cout<<i<<j<<v<<endl;

              if(a[i]==0)
                pos = false;
            }
          // cout<<endl;
          if(pos)
          cout<<"YES"<<endl,exit(0);
        }

      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

bool allone(int arr[],int n)
{
  bool p = true;
  fr(i,0,n)
  if(arr[i] == 0)
    p = false;
  return p;
}

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
//div.push_back(1);
  if(allone(a,n))
          cout<<"YES"<<endl,exit(0);

  for(auto &v : div)
  {
      if(spf[v] == v && n/v >2){
     //  cout<<v<<endl;

        for (int j = 0; j < v ; ++j)
        {
          int i =j;

            bool pos = true;
            for(i= j;i<n;i=i+v)
            {
        // cout<<i<<j<<v<<endl;

              if(a[i]==0)
                pos = false;
            }
          // cout<<endl;
          if(pos)
          cout<<"YES"<<endl,exit(0);
        }

      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
div.push_back(1);
  for(auto &v : div)
  {
      if(spf[v] == v && n/v >2){
     //  cout<<v<<endl;

        for (int j = 0; j < n/v ; ++j)
        {
          int i =j;

            bool pos = true;
            for(i= j;i<n;i=i+v)
            {
      //    cout<<i<<j<<v<<endl;

              if(a[i]==0)
                pos = false;
            }
          //  cout<<endl;
          if(pos)
          cout<<"YES"<<endl,exit(0);
        }

      }
  }
  cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;

  #define ll long long
  #define fr(i,a,b) for(int i =a ; i < b; i++)
  #define frj(j,a,b) for(int j =a ; j < b; j++)
  #define fre(i,a,b) for(int i =a ; i <= b; i++)
  #define fra(s) for(auto it = s.begin(); it != s.end() ; ++it)

  #define mkp make_pair
  #define pb push_back
  #define pii pair<int,int>
  #define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
  #define c(a,b) cout<<a<<"--"<<b<<endl;
  #define frv(i,a,v) for(int i =  a ; i < v.size() ; ++i)
  #define cp(a,i)  cout<<a[i].first<<" "<<a[i].second<<endl;
  #define pp(a) cout<<a.first<<" "<<a.second<<endl;
  //sum array
  #define sa(n) int a[n]; int s[n];cin>>a[0];s[0]=a[0];fr(i,1,n) {cin>>a[i];s[i]=s[i-1]+a[i];}
  #define sa1(n) int a[n+1]; long long s[n+1]; a[0]=0; s[0]=0;cin>>a[1];s[1]=a[1];fr(i,2,n+1) {cin>>a[i];\
  s[i]=s[i-1]+a[i];}

  #define pr(a,n) fr(i,0,n){cout<<a[i]<<" ";}cout<<endl;
  #define prv(v)   for(auto it = v.begin() ; it!= v.end() ;++it){cout<<*it<<" ";}cout<<endl;

  constexpr auto PI  = 3.14159265358979323846L;
  constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
  constexpr auto eps = 1e-6;
  constexpr auto mod = 1000000007;

  #define MOD 1000000007
  #define maxv 200005
  #define mx 505

 #define MAXN   100001

// stores smallest prime factor for every number
int spf[MAXN];

// Calculating SPF (Smallest Prime Factor) for every
// number till MAXN.
// Time Complexity : O(nloglogn)
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

    vector<int> alldivisors(ll n)
    {
        vector<int> b;
         for(ll i = 2 ; i*i <= n; i++)
        {
            if(n%i == 0){

              if(n/i == i)
                 b.push_back(i);
              else
                 b.push_back(i),b.push_back(n/i);
            }
        }
        return b;
    }

int main()
{
  int n;
  cin>>n;
  int a[n];

  fr(i,0,n)
  cin>>a[i];
  sieve();
vector<int> div = alldivisors(n);
div.push_back(1);
  for(auto &v : div)
  {
      if(spf[v] == v && n/v >2){
     //  cout<<v<<endl;
        bool pos = true;
        for(int i= 0;i<n;i=i+(v-1))
        {
          if(a[i]==0)
            pos = false;
        }
        if(pos)
          cout<<"YES"<<endl,exit(0);
      }
  }
  cout<<"NO"<<endl;

}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

const int nmax = 100005;

typedef long long LL;

ifstream fin("txt.in");

int N,a[nmax],d[nmax];

int main (){
    ios::sync_with_stdio(false);
    int i,j,nr,q;
    fin >> N;
    for(i = 1; i <= N; ++i)
        fin >> a[i];
    for(i = 1; i*i <= N; ++i)
        if(N%i == 0){
            if(i*i == N){d[++d[0]] = i ; break;}
            d[++d[0]] = i ;
            if(i>2)
             d[++d[0]] = N/i;
        }
     sort(d+1,d+d[0]+1);

    for(i = 1; i <= d[0]; ++i){

         for(q = 1; q <= d[i];++q){
              nr = 1;if(!a[q])continue;
        for(j = q + d[i]; a[j] && j <= N && j != q; ++nr){
            j+=d[i];
            if(j > N)j-=N;
        }
        if(j == q){
            cout << "YES\n";
            return 0;
        }
    }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

const int nmax = 100005;

typedef long long LL;

ifstream fin("txt.in");

int N,a[nmax],d[nmax];

int main (){
    ios::sync_with_stdio(false);
    int i,j,nr,q;
    cin >> N;
    for(i = 1; i <= N; ++i)
        cin >> a[i];
    for(i = 1; i*i <= N; ++i)
        if(N%i == 0){
            if(i*i == N){d[++d[0]] = i ; break;}
            d[++d[0]] = i ;
            if(i>2)
             d[++d[0]] = N/i;
        }
     sort(d+1,d+d[0]+1);

    for(i = 1; i <= d[0]; ++i){

         for(q = 1; q <= d[i];++q){
              nr = 1;if(!a[q])continue;
        for(j = q + d[i]; a[j] && j <= N && j != q; ++nr){
            j+=d[i];
            if(j > N)j-=N;
        }
        if(j == q){
            cout << "YES\n";
            return 0;
        }
    }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

const int nmax = 100005;

typedef long long LL;

ifstream fin("txt.in");

int N,a[nmax],d[nmax];

int main (){
    ios::sync_with_stdio(false);
    int i,j,nr,q;
    cin >> N;
    for(i = 1; i <= N; ++i)
        cin >> a[i];
    for(i = 1; i*i <= N; ++i)
        if(N%i == 0){
            if(i*i == N){d[++d[0]] = i ; break;}
            d[++d[0]] = i ;
            if(i>2)
             d[++d[0]] = N/i;
        }
     sort(d+1,d+d[0]+1);

    for(i = 1; i <= d[0]; ++i){

         for(q = 1; q <= d[i];++q){
              nr = 1;if(!a[q])continue;
        for(j = q + d[i]; a[j] && j <= N && j != q; ++nr){
            j+=d[i];
            if(j > N)j-=N;
        }
        if(j == q&&nr>2){
            //cout << nr;
            cout << "YES\n";
            return 0;
        }
    }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

const int nmax = 100005;

typedef long long LL;

ifstream fin("txt.in");

int N,a[nmax],d[nmax];

int main (){
    ios::sync_with_stdio(false);
    int i,j,nr,q;
    cin >> N;
    for(i = 1; i <= N; ++i)
        cin >> a[i];
    for(i = 1; i*i <= N; ++i)
        if(N%i == 0){
            if(i*i == N){d[++d[0]] = i ; break;}
            d[++d[0]] = i ;
            if(i>2)
             d[++d[0]] = N/i;
        }
     sort(d+1,d+d[0]+1);

    for(i = 1; i <= d[0]; ++i){

         for(q = 1; q <= d[i];++q){
              nr = 1;if(!a[q])continue;
        for(j = q + d[i]; a[j] && j <= N && j != q; ++nr){
            j+=d[i];
            if(j > N)j-=N;
        }
        if(j == q&&nr>2){
            cout << nr;
            cout << "YES\n";
            return 0;
        }
    }
    }
    cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+6;
int a[N], n;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}

	bool ans = false;

	for (int i = 1; i * i <= n; i++){
		if (n % i == 0){
			for (int j = 0; j < n; j++){
				int cnt = 0;
				for (int k = j; k < n; k += i){
					cnt += a[k];
				}
				if (n/i >= 3 && cnt == n/i) ans = true;
			}
			if (i == (n/i)) continue;
			for (int j = 0; j < n; j++){
				int cnt = 0;
				for (int k = j; k < n; k += (n/i)){
					cnt += a[k];
				}
				if (n/(n/i) >= 3 && cnt == n/(n/i)){
					ans = true;
				}
			}
		}
	}

	printf("%s\n", ans ? "YES" : "NO");

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+6;
int a[N], n;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}

	bool ans = false;

	for (int i = 1; i * i <= n; i++){
		if (n % i == 0){
			for (int j = 0; j < n; j++){
				int cnt = 0, qtd = 0;
				for (int k = j; k < n; k += i){
					cnt += a[k];
					qtd++;
				}
				if (n/i >= 3 && cnt == n/i) ans = true;
				if (qtd < n/i) break;
			}
			if (i == (n/i)) continue;
			for (int j = 0; j < n; j++){
				int cnt = 0, qtd = 0;
				for (int k = j; k < n; k += (n/i)){
					cnt += a[k];
					qtd++;
				}
				if (n/(n/i) >= 3 && cnt == n/(n/i)){
					ans = true;
				}
				if (qtd < n/(n/i)) break;
			}
		}
	}

	printf("%s\n", ans ? "YES" : "NO");

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+6;
int a[N], n;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}

	bool ans = false;

	for (int i = 1; i * i <= n; i++){
		if (n % i == 0){
			for (int j = 0; j < i; j++){
				int cnt = 0;
				for (int k = j; k < n; k += i){
					cnt += a[k];
				}
				if (n/i >= 3 && cnt == n/i) ans = true;
			}
			if (i == (n/i)) continue;
			for (int j = 0; j < i; j++){
				int cnt = 0;
				for (int k = j; k < n; k += (n/i)){
					cnt += a[k];
				}
				if (n/(n/i) >= 3 && cnt == n/(n/i)){
					ans = true;
				}
			}
		}
	}

	printf("%s\n", ans ? "YES" : "NO");

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+6;
int a[N], n;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}

	bool ans = false;

	for (int i = 1; i * i <= n; i++){
		if (n % i == 0){
			for (int j = 0; j < n; j++){
				int cnt = 1;
				for (int k = j; k < n; k += i){
					cnt &= a[i];
				}
				if (cnt) ans = true;
			}
			if (i == (n/i)) continue;
			for (int j = 0; j < n; j++){
				int cnt = 1;
				for (int k = j; k < n; k += (n/i)){
					cnt &= a[i];
				}
				if (cnt) ans = true;
			}
		}
	}

	printf("%s\n", ans ? "YES" : "NO");

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        if(n%i==0)
        for(int j=0;j<i;j++)
			{
				int z=1;
				for(int k=j;k<n;k+=i) z&=a[k];
				if(z)
				{cout<<"YES";return 0;}
			}
	cout<<"NO";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        {
            if(n%i==0 && n/i>=3)
            {
                for(int k=0;k<i;k++)
                {
                    int z=1;
                    for(int u=k;u<n;u=u+i)
                    {
                        z=z&a[i];
                        if(z==0)
                        {
                            break;
                        }

                    }
                    if(z)
                    {
                        cout<<"YES";
                        return 0;
                    }

                }
            }

        }
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        if(n%i==0 && n/i>=3)
        for(int j=0;j<i;j++)
			{
				int z=1;
				for(int k=j;k<n;k+=i) z&=a[k];
				if(z)
				{cout<<"YES";return 0;}
			}
	cout<<"NO";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i*i<=n;i++)
        if(n%i==0)
        for(int j=0;j<i;j++)
			{
				int z=1;
				for(int k=j;k<n;k+=i) z&=a[k];
				if(z)
				{cout<<"YES";return 0;}
			}
	cout<<"NO";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        {
            if(n%i==0 && n/i>=3)
            {
                for(int k=0;k<i;k++)
                {
                    int z=1;
                    for(int u=k;u<n;u=u+i)
                    {
                        z=z&a[i];
                        /*if(z==0)
                        {
                            break;
                        }*/

                    }
                    if(z)
                    {
                        cout<<"YES";
                        return 0;
                    }

                }
            }

        }
        cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
        {
            if(n%i==0 && n/i>=3)
            {
                for(int k=1;k<=i;k++)
                {
                    int z=1;
                    for(int u=0;u<=n;u=u+k)
                    {
                        z=z&a[i];
                        if(z==0)
                        {
                            break;
                        }

                    }
                    if(z)
                    {
                        cout<<"YES";
                        return 0;
                    }

                }
            }

        }
        cout<<"NO";
}