// Author : Naresh Bharasagar
// Instt. : Indian Institute of Technology Guwahati

//--------------------------------------------------------------------------------------------------------------------------------

#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 int loo;
typedef long double ld;

#pragma GCC target ("sse4.2")
#define ordered_set(a) tree<a, null_type,less<a>, rb_tree_tag,tree_order_statistics_node_update>
#define loop(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define loopset(it,val,dtype) for(set<dtype>::iterator it=val.begin(); it!=val.end(); it++)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vloo vector<loo>
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
#define ploo pair<loo,loo>
#define fillz(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
#define outa(a,n) loop(i,0,n) cout << a[i] << " ";
#define pr(a) cout << a << "\n";
#define pb(l) push_back(l)
#define ff first
#define ss second
#define input(a) for(auto &i: a) cin >> i;
#define deb(i) cout << "[" << #i << "=" << i << "]" << endl;
#define nl cout << "\n";
#define INF 1000000000
#define M 1000000007

loo power(loo x, loo y, loo p) {
    loo res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

bool sortbysec(const pair<loo,loo> &a, const pair<loo,loo> &b) {
    return (a.second > b.second);
}

string decToBin(loo n) {
	string s = "0";
	if(n == 0) return s;
	s = "";
    while (n > 0) {
        s += (n % 2) + '0';
        n = n / 2;
    }
    reverse(s.begin(), s.end());
    return s;
}

loo binToDec(string s) {
    loo ans = 0;
    reverse(s.begin(), s.end());
    loop(i, 0, s.size()) ans += pow(2, i)*(s[i] - '0');
    return ans;
}

loo nCr(loo n, loo r) {
    loo p = 1, k = 1;
    if (n - r < r)
        r = n - r;
    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            loo m = __gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else p = 1;
    return p;
}

// vector<int> dist;
vector<bool> vis(100001,false);
void dfs(vector<loo> adj[], loo src) {
    vis[src]=true;
    loop(i,0,adj[src].size()) {
        loo x = adj[src][i];
        if(vis[x]==false) {
            vis[x]=true;
            // dist[x] = dist[src]+1;
            dfs(adj,x);
        }
    }
}

// vector<loo> sg(100001,-1); //prev
void bfs(vector<loo> adj[], loo src) {
    list<loo> ql;
    vis[src]=true;
    ql.pb(src);
    while(!(ql.empty())) {
        src = ql.front();
        // cout << src << " ";
        ql.pop_front();

        loop(i,0,adj[src].size()) {
            if(!vis[adj[src][i]]) {
                vis[adj[src][i]]=true;
                // sg[adj[src][i]]=src;
                ql.pb(adj[src][i]);
            }
        }
    }
}

// ----------------------------------------------------------------
void solve() {
    loo n;
    cin >> n;
    string s;
    cin >> s;
    loo q;
    cin >> q;
    loo t,a,b;
    bool f = false;
    while(q--) {
        cin >> t >> a >> b;
        a--,b--;
        if(t==1) {
            if(f) a=(a+n)%(2*n), b=(b+n)%(2*n);
            swap(s[a],s[b]);
        }
        else {
            f^=1;
        }
    }
    if(f) cout << s.substr(n,n)+s.substr(0,n);
    else cout << s;
    nl;
}

int main() {
	fast_io

    // freopen("validation_input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    loo q = 1;
    // cin >> q;
    while(q--) {
        solve();
    }

    return 0;
}

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

#define ll long long

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    string s;
    cin >> s;
    string a, b;
    for(int i = 0; i < n; i++) {
        a += s[i];
    }
    for(int i = n; i < 2 * n; i++) {
        b += s[i];
    }
    int q;
    cin >> q;
    while(q-- > 0) {
        int t, i, j;
        cin >> t >> i >> j;
        if(t == 1) {
            if(i >= 1 && j <= n) {
                swap(a[i - 1], a[j - 1]);
            }
            else if(i > n && j <= 2 * n) {
                i -= n, j -= n;
                swap(b[i - 1], b[j - 1]);
            }
            else {
                j -= n;
                swap(a[i -1], b[j - 1]);
            }
        }
        else {
            swap(a, b);
        }
    }
    cout << a << b << endl;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define INF 1e9
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second
typedef long long ll;
using Graph = vector<vector<ll>>;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

ll dp[2000][2000];
ll nCr(ll n, ll r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n%MOD;
       if(dp[n][r]) return dp[n][r]%MOD;
       return dp[n][r] = nCr(n-1,r)%MOD + nCr(n-1,r-1)%MOD;
}

ll H(ll n, ll r) {
    return nCr(n+r-1, r)%MOD;
}

int prime[10000000];
bool is_prime[100000000 + 1];

int sieve(int n) {
    int pcnt = 0;
    for(int i = 0; i <= n; i++) {
        is_prime[i] = true;
    }

    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++) {
        if(is_prime[i]) {
            prime[pcnt++] = i;
            for(int j = 2*i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }

    return pcnt;
}

struct UnionFind {
	//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
	//そうでなければ親のid
	vector<ll> r;
	UnionFind(ll N) {
		r = vector<ll>(N, -1);
	}
	ll root(ll x) {
		if (r[x] < 0) return x;
		return r[x] = root(r[x]);
	}
	bool unite(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (r[x] > r[y]) swap(x, y);
		r[x] += r[y];
		r[y] = x;
		return true;
	}
	ll size(ll x) {
		return -r[root(x)];
	}

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

void solve1() {
    int n, w; cin >> n >> w;

    cout << n / w << endl;
}

int main()
{
    solve1();
}

#include <iostream>
using namespace std;
int main()
{
    int n,y;
cin>>n>>y;
cout<< n/y;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,c;
  cin >> n >> c;
  long long a[n][3];
  for(long long i=0;i<n;++i){
    for(int j=0;j<3;++j){
      cin >> a[i][j];
    }
  }
  map<long long, long long> m;
  for(int i=0;i<n;++i){
      m[a[i][0]]+=a[i][2];
      m[a[i][1]+1]+=(-a[i][2]);
  }
  map<long long, long long>::iterator itr;
  long long sum=0;long long val=0;
  for (itr = m.begin(); itr != m.end(); ++itr){
      itr->second+=val;
      val=itr->second;
  }
  map<long long, long long>::iterator it = m.begin();
  for (itr = m.begin(); itr != m.end()--; ++itr){
      it++;
      if(itr->second<c){
          int diff = it->first - itr->first;
          sum+=(itr->second*diff);
      }
      else{
          int diff = it->first - itr->first;
          sum+=(c*diff);
      }
  }
  cout << sum << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
vector<int> Times;
int a[200200],b[200200];
long long c[200200];
long long delta[400400];
int main()
{
  int N;
  long long C;
  cin>>N>>C;
  for(int i=0;i<N;i++)
  {
    cin>>a[i]>>b[i]>>c[i];
    b[i]++;
    Times.push_back(a[i]);
    Times.push_back(b[i]);
  }
  sort(Times.begin(),Times.end());
  for(int i=0;i<N;i++)
  {
    a[i]=lower_bound(Times.begin(),Times.end(),a[i])-Times.begin();
    b[i]=lower_bound(Times.begin(),Times.end(),b[i])-Times.begin();
  }
  int sz=Times.size();
  for(int i=0;i<N;i++)
  {
    delta[a[i]]+=c[i];
    delta[b[i]]-=c[i];
  }
  long long tot=0;
  long long cost=0;
  for(int i=0;i<sz-1;i++)
  {
    tot+=delta[i];
    cost+=min(tot,C)*(Times[i+1]-Times[i]);
  }
  cout<<cost<<endl;
  return 0;
}


// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma")

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

#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
#define pll pair <ll, ll>
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define inf (1LL << 61)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define for1(i, stop) for(ll i = 1; i <= stop; ++i)
#define for0(i, stop) for(ll i = 0; i < stop; ++i)
#define rep1(i, start) for(ll i = start; i >= 1; --i)
#define rep0(i, start) for(ll i = (start-1); i >= 0; --i)
#define ms(n, i) memset(n, i, sizeof(n))
#define casep(n) printf("Case %lld:", ++n)
#define pn printf("\n")
#define pf printf
#define EL '\n'
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const ll sz = 110;
ll ans, cnt[sz], c[sz], d[sz], a[sz], b[sz], n, m, k;

void solve(ll pos)
{
    if(pos > k) {
        ll tot = 0;
        for1(i, m) {
            if(cnt[ a[i] ] >= 1 && cnt[ b[i] ] >= 1)
                tot++;
        }
        ans = max(ans, tot);
        return;
    }

    cnt[ c[pos] ]++;
    solve(pos+1);
    cnt[ c[pos] ]--;

    cnt[ d[pos] ]++;
    solve(pos+1);
    cnt[ d[pos] ]--;
}

int main()
{
    cin >> n >> m;
    for1(i, m) {
        sl(a[i]), sl(b[i]);
    }

    cin >> k;
    for1(i, k) {
        sl(c[i]), sl(d[i]);
    }

    solve(1);

    cout << ans << EL;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n,m;
  	int vdncjdkdkh;
    cin>>n>>m;
    vector<pair<int,int>>a(m);
    for(int i=0;i<m;i++)
    {
        cin>>a[i].first>>a[i].second;
    }
    int k;
    cin>>k;
    vector<pair<int,int>>b(k);
    for(int j=0;j<k;j++)
    {
        cin>>b[j].first>>b[j].second;
    }
    ll l=0;
    ll tot=1<<k;
    for(ll mask=0;mask<tot;mask++)
    {
        vector<int>v(n+1);
        ll ans=0;
        for(int i=0;i<k;i++)
        {
            if(mask & (1<<i))
                v[b[i].second]=1;
            else
                v[b[i].first]=1;
        }
        for(int i=0;i<m;i++)
        {
            if(v[a[i].first] && v[a[i].second])
                ans++;
        }
        l=max(l,ans);
    }
    cout<<l<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); ++ i)
#define per(i, a, b) for(int i = (a); i >= (b); -- i)
#define pb push_back
#define Pii pair<int,int>
#define fi first
#define se second
typedef double db;
typedef long long ll;

using namespace std;

const ll N = 110;
const ll P = 998244353;

int n, m;
int a[N*N],b[N*N],c[N],vis[N],col[N][N],dep[N];
vector<int>G[N];
void dfs(int u, int cc,int pa) {
  vis[u] = 1;
  dep[u] = dep[pa] + 1;
  for(int v: G[u])if(!vis[v]&&c[v]==cc){
    // cout << u << " " << v << "\n";
    dfs(v,cc,u);
    col[u][v] = 1;
  } else if(vis[v]&&c[v]==cc&&dep[v]+1<dep[u]) {
    col[u][v] = 1;
    // cout << u << " " << v << "\n";
  }
}

signed main () {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n>>m;
  rep(i,1,m) cin >> a[i] >> b[i], G[a[i]].pb(b[i]), G[b[i]].pb(a[i]);
  rep(i,1,n) cin >> c[i];
  rep(i, 1, n) if(!vis[i]) {
    dfs(i,c[i],0);
  }
  rep(i,1,m) {
    if(c[a[i]]>c[b[i]]) cout << "->\n";
    else if(c[a[i]]<c[b[i]]) cout <<"<-\n";
    else {
      cout << (col[a[i]][b[i]] ? "->\n" : "<-\n");
    }
  }
}

#include <bits/stdc++.h>
using namespace std;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vb = vector<bool>;
VVi tree;
int depth[110];
int par[110];
int done[110];
void dfs(int u, const VVi& gr, Vb& ex) {
  for (int v : gr[u]) {
    if (!ex[v]) {
      ex[v] = true;
      par[v] = u;
      tree[u][v] = 1;
      tree[v][u] = -1;
      depth[v] = depth[u] + 1;
      dfs(v, gr, ex);
    }
  }
  done[u] = 1;
}
int main () {
  int N, M;
  cin >> N >> M;
  Vi A(M);
  Vi B(M);
  Vi count(N + 1);
  tree.assign(N + 1, Vi(N + 1, -2));
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    tree[a][b] = tree[b][a] = 0;
    A[i] = a;
    B[i] = b;
  }
  for (int i = 1; i <= N; i ++) {
    cin >> count[i];
  }
  VVi same(N + 1);
  for (int i = 1; i <= N; i ++) {
    done[i] = 1;
  }
  for (int i = 1; i <= N; i ++) {
    for (int j =1; j <= N; j ++) {
      if (tree[i][j] == 0) {
        if (count[i] > count[j]) {
          tree[i][j] = 1;
          tree[j][i] = -1;
        } else if (count[j] > count[i]) {
          tree[j][i] = 1;
          tree[i][j] = -1;
        } else {
          same[i].push_back(j);
          same[j].push_back(i);
          done[i] = done[j] = 0;
        }
      }
    }
  }
  //cout << tree[4][4] << endl;
  for (int i = 1; i <= N; i ++) {
    if (!done[i]) {
      Vb ex(N + 1, false);
      ex[i] = true;
      depth[i] = 0;
      par[i] = 0;
      dfs(i, same, ex);
    }
  }
  for (int i = 1; i <= N; i ++) {
    for (int j = 1; j <= N; j ++) {
      if (tree[i][j] == 0) {
        int pk = 1;
        if (depth[i] < depth[j]) pk = -1;
        tree[i][j] = pk;
        tree[j][i] = -pk;
      }
    }
  }
  for (int i = 0; i < M; i ++) {
    if (tree[A[i]][B[i]] == 1) {
      cout << "->" << endl;
    } else {
      cout << "<-" << endl;
    }
  }
}


#include <bits/stdc++.h>
using namespace std;
using s64 = signed long long;
using u64 = unsigned long long;
using f128 = long double;

int main()
{
    u64 h, w;
    cin >> h >> w;
    vector<vector<u64>> a;
    for(u64 i = 0; i < h; i++)
    {
        a.push_back(vector<u64>());
        for(u64 j = 0; j < w; j++)
        {
            u64 aij;
            cin >> aij;
            a[i].push_back(aij);
        }
    }

    u64 minBlock = ULONG_LONG_MAX;
    for(u64 i = 0; i < h; i++)
    {
        for(u64 j = 0; j < w; j++)
        {
            if(minBlock > a[i][j])
            {
                minBlock = a[i][j];
            }
        }
    }

    u64 removeBlock = 0;
    for(u64 i = 0; i < h; i++)
    {
        for(u64 j = 0; j < w; j++)
        {
            removeBlock += a[i][j] - minBlock;
        }
    }

    cout << removeBlock << endl;

    return 0;
}

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define forn(i,n) for(int i = 0; i < n; i++)
int32_t main() {
    int n, q, k; cin >> n >> q;
    vector<int> a(n);
    forn(i, n) cin >> a[i];
    vector<int> ps(n);
    ps[0] = a[0] - 1;
    forn(i, n - 1) ps[i + 1] = ps[i] + a[i + 1] - a[i] - 1;
    while (q--) {
        cin >> k;
        int x = --lower_bound(ps.begin(), ps.end(), k) - ps.begin();
        if (x == -1) cout << k;
        else cout << a[x] + k - ps[x];
        cout << "\n";
    }
}


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

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue
#define    nl           "\n"
#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mpi map<int,int>
#define mpl map<ll,ll>
#define umpi unordered_map<int,int>
#define umpl unordered_map<ll,ll>
#define si set<int>
#define sl set<ll>
#define msi multi_set<int>
#define msl multi_set<ll>

#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);

#define repab(i,a,b) for(int i=(a);i<=(b);i++)
#define reprab(i,a,b) for(int i=(a);i>=(b);i--)
#define repll(i,a,b) for(ll i=(a);i<=(b);i++)
#define rep(i,n) for(int i=(0);i<(n);i++)
#define repr(i,n) for(int i=(n);i>=0;i--)
#define bs bitset
#define bpc(a) __builtin_popcount(a)
#define tc int t;cin>>t;while(t--)

int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}

int main()
{

    fast
    ll n,w;
    cin>>n>>w;
    cout<<n/w<<nl;

    return 0;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define uniq(a) (a).erase(unique(all(a)), (a).end())
#define bit(n) (1LL << (n))
#define dump(a) cerr << #a " = " << (a) << endl
#define fin(a)                                                                                \
    cout << (a) << endl;                                                                                \
    return 0
using vint = vector<int>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template <typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int sign(int a) {
    return (a > 0) - (a < 0);
}
int cdiv(int a, int b) {
    return (a - 1 + b) / b;
}
template <typename T> T sq(T a) {
    return a * a;
}
template <typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &a) {
    os << "(" << a.first << ", " << a.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &a) {
    os << "(";
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        os << *itr << (next(itr) != a.end() ? ", " : "");
    }
    os << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const deque<T> &a) {
    os << "(";
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        os << *itr << (next(itr) != a.end() ? ", " : "");
    }
    os << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        os << *itr << (next(itr) != a.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        os << *itr << (next(itr) != a.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &a) {
    os << "{";
    for (auto itr = a.begin(); itr != a.end(); itr++) {
        os << *itr << (next(itr) != a.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int n;
    cin >> n;
    vint v(2 * n);
    rep(i, 2 * n) cin >> v[i];
    vint a(n), b(n);
    rep(i, n) a[i] = v[n - i - 1];
    rep(i, n) b[i] = v[n + i];
    priority_queue_rev<int> pq;
    int aoki = 0;
    rep(i, n) {
        pq.emplace(a[i]);
        pq.emplace(b[i]);
        aoki += pq.top();
        pq.pop();
    }
    cout << accumulate(all(v), 0LL) - aoki << endl;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll NUM = 10000;

ll input(){

	double tmp;
	scanf("%lf",&tmp);

	tmp *= NUM;

	return round(tmp);
}

bool ok(ll dx, ll dy, ll z){

	return dx*dx + dy*dy <= z*z;
}

int main(){

	ll x = input();
	ll y = input();
	ll z = input();

	x %= NUM;
	y %= NUM;

	ll L = 0,R = 1;

	ll ans = 0;

	//上半分
	for(ll h = BIG_NUM/2+5*NUM; h >= NUM; h -= NUM){

		while(ok(x-L*NUM,h-y,z))L--;
		while(ok(R*NUM-x,h-y,z))R++;

		ans += (R-L)-1;
	}

	L = 0,R = 1;

	//下半分
	for(ll h = -BIG_NUM/2-NUM; h <= 0; h += NUM){

		while(ok(x-L*NUM,y-h,z))L--;
		while(ok(R*NUM-x,y-h,z))R++;

		ans += (R-L)-1;
	}

	printf("%lld\n",ans);

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
const double pi = 2.0 * asin(1.0);
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
int main()
{
    long double x, y, r;
    cin >> x >> y >> r;
    x = abs(x);
    y = abs(y);
    x -= (ll)x / 1;
    y -= (ll)y / 1;
    ll d = (ll)(y - r);
    ll u = (ll)(y + r);
    ll ans = 0;
    rep2(i, d - 1, u + 1)
    {
        if (abs(i - y) > r)
        {
            continue;
        }
        long double now2 = r * r - (y - i) * (y - i);
        long double l = 0;
        long double l2 = 1001001001;
        rep(i, 100)
        {
            long double mid = (l + l2) / 2;
            if (mid * mid > now2)
            {
                l2 = mid;
            }
            else
            {
                l = mid;
            }
        }
        ans += (ll)l * 2 + 1;
        long double x1 = (ll)l + 1;
        long double x2 = -(ll)l;
        long double eps = 0.0000000001;
        if ((i - y) * (i - y) + (x1 - x) * (x1 - x) <= r * r + eps)
        {
            ans++;
        }
        if ((i - y) * (i - y) + (x2 - x) * (x2 - x) > r * r + eps)
        {
            ans--;
        }
    }
    cout << ans << endl;
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>

using namespace std;
typedef long long ll;

int main(){

    int n;
    cin>>n;
    if(n%2 == 0)
        cout<<"White"<<endl;
    else
        cout<<"Black"<<endl;
    return 0;
}

#include<bits/stdc++.h>

#define ntest 0

using namespace std;
int n;
void solve() {
    cin >> n;
    if (n&1) cout << "Black";
    else cout << "White";
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    if(ntest){
        int t;
        cin >> t;
        while(t--) solve();
    } else {
        solve();
    }

}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX 100050

#define ll long long
#define ld long double
#define lli long long int

#define pb push_back
#define INF 100000000000000
#define mod 998244353

// trignometric function always give value in Radians only
#define PI acos(-1) //3.1415926535897932384626433832795028
#define dsin(degree) sin(degree*(PI/180.0))
#define dcos(degree) cos(degree*(PI/180.0))
#define dtan(degree) tan(degree*(PI/180.0))

#define rsin(radian) sin(radian)
#define rcos(radian) cos(radian)
#define rtan(radian) tan(radian)

#define counttrailingzeroes(n) __builtin_ctzll(n)
#define countsetbits(n) __builtin_popcountll(n)

#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))

#define loop(i,n)  for (lli i = 0; i < n; i++)
#define FOR(i,a,b) for (lli i = a; i < b; i++)

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define makeuniq(v) v.resize(unique(all(v)) - v.begin()); //only uniq element in vector after this
#define sz(x) int(x.size())
#define F first
#define S second

#define mii map<lli,lli>

#define pii pair<lli,lli>

#define vi vector<lli>
#define vvi vector<vi>
#define vpi vector<pii>
#define vbool vector<bool>

#define seti set<lli>

#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b
#define abs(x) ((x < 0)?-(x):x)

#define endl '\n'

template <typename Head>
void print(Head&& head)
{
    cout<<head<<endl;
}
template <typename Head, typename... Tail>
void print(Head&& head, Tail... tail)
{
    cout<<head<<" ";
    print(tail...);
}

#define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
#define scanvec(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.pb(x);}

#define printarr(a,n) for(lli i=0;i<n;i++)   cout<<a[i]<<" "; cout<<endl;
#define printvec(vec) for(auto xt : vec) cout<<xt<<" ";    cout<<"\n";

#define FD(N) fixed<<setprecision(N)

#define deb(x) cout<<#x<<" "<<x<<endl;

/*
1D vector -  vi dp(n,value);
*/

bool isVowel(char a)
{
    if(a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
        return true;
    return false;
}

int main(){
fastio
lli t=1;
//cin>>t;
while(t--)
{
    lli n;
    cin>>n;
    lli a[n];
    scanarr(a,n);
    lli maxi = -1;
    for(lli i=0;i<n;i++)
    {
        lli mini = INF;
        for(lli j=i;j<n;j++)
        {
            lli len = j-i+1;
            mini = min(mini , a[j]);
            maxi = max(maxi , mini*len);
        }
    }
    print(maxi);
}

return 0;
}

#include<bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pbds tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define MOD     998244353
#define int     long long int
#define fastIO  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI      3.1415926535897932384626
#define pb      push_back
#define clr(x)  memset(x, 0, sizeof(x))
#define MP      make_pair
const int N=1e5+100;
const int inf=1e15;

int d4x[]={1,0,-1,0};
int d4y[]={0,1,0,-1};
int d8x[]={1,1,0,-1,-1,-1,0,1};
int d8y[]={0,1,1,1,0,-1,-1,-1};

int gcd(int a,int b){if(a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (max(a,b)/gcd(a,b))*min(a,b);}
int powermodm(int x,int n,int M){int result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
int gcdExtended(int a, int b, int *x, int *y){if (a == 0){*x = 0, *y = 1;return b;}int x1, y1;int gcd = gcdExtended(b % a, a, &x1, &y1);*x = y1 - (b / a) * x1;*y = x1;return gcd;}
int modInverse(int a, int m){int x, y;int g = gcdExtended(a, m, &x, &y);if (g != 1)return -1;else{int res = (x % m + m) % m;return res;}}
bool isPrime(int a){if(a==1) return false;if(a==2) return true;if(a%2==0) return false;int root=sqrt(a);for(int i=3;i<=(int)root;i+=2){if(a%i==0)return false;}return true;}
bool isValidpt(int u,int v,int n,int m){if(u>=0&&v>=0&&u<n&&v<m)return true;return false;}

int apne=modInverse(2,MOD);

int32_t main()
{
        #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int tc=1;
    //cin >> tc;
    while(tc--)
    {
        int n;
        cin >> n;
        int a[n];
        for(int i=0;i<n;i++) cin >> a[i];
        sort(a,a+n);
        int cur=1;
        int sum=0;
        int ans=0;
        for(int i=1;i<n;i++)
        {
            sum=(sum+(cur*a[i]))%MOD;
            cur=(cur*2)%MOD;
        }
        for(int i=0;i<n;i++)
        {
            int yo=(sum+a[i])%MOD;
            ans=(ans+((yo*a[i])%MOD))%MOD;
            if(i<n-1)
            sum=(sum%MOD - a[i+1]+MOD)%MOD;
            sum=(sum*apne)%MOD;
        }
        cout << ans << endl;
    }
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

 int main(){

     int n,x;
     cin >> n >> x;

    double sum = 0;
     rep(i,n) {
         int v,p;
         cin >> v >> p;
         sum += v * p;
        if(sum > x * 100){
            cout << i + 1 << endl;
            return 0;
        }
     }
     cout << -1 << endl;

 }

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define mod 1000000007

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
    ordered_set;
typedef tree<int, null_type,
             less_equal<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;

int findintegers(double a,double b)
{int c=floor(b);
int d=ceil(a);
cout<<d-c+1<<" okpaka\n";
return d-c+1;
}

int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("inp.txt",  "r",  stdin);
	freopen("m3.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
long double x,y,r;

cin>>x>>y>>r;
r+=(1e-14);
long double nx1=x+r;
long double nx2=x-r;
int ub1=ceil(nx2);
int ub2=floor(nx1);
int sum=0;
for(int i=ub1;i<=ub2;i++)
{
long double c=r*r-(i-x)*(i-x);
if(c>=0)
{long double val1=sqrt(c)+y;
long double val2=-sqrt(c)+y;
int lb1=floor(val1);
int lb2=ceil(val2);
sum+=(lb1-lb2+1);
}
}
cout<<sum<<endl;

return 0;

	}


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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

template <typename Arg1>
void prn(Arg1&& arg1) { cout<<arg1<<"\n";}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prn(args...); }

template <typename Arg1>
void prs(Arg1&& arg1) { cout<<arg1<<" ";}
template <typename Arg1, typename... Args>
void prs(Arg1&& arg1, Args&&... args) { cout<<arg1<<" "; prs(args...); }

template <typename Arg1>
void read(Arg1&& arg1) { cin>>arg1; }
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) { cin>>arg1; read(args...); }

#define int                     long long
#define all(ds)                 ds.begin(), ds.end()
#define uniq(v)                 (v).erase(unique(all(v)),(v).end())
#define gcd(x,y)                __gcd(x,y)
#define rep(i,a,b)              for(int i=a;i<b;i++)
#define precise(x)              cout<<fixed<<setprecision(x)
#define endl                    "\n"

const long long INF = 1e18;
const int32_t MOD = 1e9+7;
const int N = 1e5+5;

int n, m, k, q, r, l, x, y, z;
int a[N], b[N], c[N];
string s, t;
int ans = 0;

void solve(){
    read(n,m,q);
    pair<int, int> a[n]; // val, wt
    rep(i,0,n){
        read(x,y);
        a[i] = {y,x};
    }
    sort(a, a+n);
    reverse(a, a+n);

    int c[m];
    rep(i,0,m){
        read(c[i]);
    }

    rep(i,0,q){
        read(l,r);
        l--, r--;
        vector<int>v;
        for(int i = 0; i < m; ++i){
            if(i >= l && i <= r) continue;
            v.push_back(c[i]);
        }
        sort(all(v));
        int ans = 0;
        for(int i = 0; i < n; ++i){
            int val = a[i].first, wt = a[i].second;
            for(int i = 0; i < v.size(); ++i){
                if(v[i] == -1) continue;
                if(wt <= v[i]){
                    ans += val;
                    v[i] = -1;
                    break;
                }
            }
        }
        prn(ans);
    }
}

signed main()
{
#ifndef ONLINE_JUDGE
    input_output
#else
    fastio
#endif

#ifdef SIEVE
    sieve();
#endif

#ifdef NCR
    init();
#endif

    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

#include <iostream>
using namespace std;
typedef long long ll;
const int maxn = 1e6+10,mod = 1e9+7;
int a,b,x,y,f[maxn][2];
int main() {
	cin >> a >> b >> x >> y;
	f[a<b?a:b][a<b?0:1] = 0;
	f[a<b?a:b][a<b?1:0] = x;
	for(int i = min(a,b)+1; i <= max(a,b); i++){
		f[i][0] = min(f[i-1][0]+y,f[i-1][1]+x);
		f[i][1] = min(f[i][0]+x,f[i-1][1]+y);
	}
	cout << f[a<b?b:a][a<b?1:0] << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll arr[63][63];
    for(int i=0;i<63;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(i==j)
            {
                arr[i][j]=1;
            }
            else if(j==0)
            {
                arr[i][j]=1;
            }
            else
            arr[i][j]=arr[i-1][j]+arr[i-1][j-1];
        }
    }
    ll a,b,k;
    cin>>a>>b>>k;
    ll n=a+b;
    for(int i=0;i<n;i++)
    {
        if(arr[a+b-1][b]>=k)
        {
            cout<<'a';
            a--;
        }
        else
        {
            cout<<'b';
            k=k-arr[a+b-1][b];
            b--;
        }
    }

    return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>

using namespace std;

int main()
{
	int n,q;
	string s,s1,s2;
	cin >> n >> s >> q;
	int t,a,b;
	for(int i=0;i<n;i++){
		s1+=s[i];
		s2+=s[i+n];
	}
	for(int i=0;i<q;i++){
		cin >> t >> a >> b;
		if(t==1){
			if(b<=n)
				swap(s1[a-1],s1[b-1]);
			else if(a>n)
				swap(s2[a-n-1],s2[b-n-1]);
			else
				swap(s1[a-1],s2[b-n-1]);
		}
		if(t==2)
			swap(s1,s2);
	}
	s=s1+s2;
	cout << s << endl;
	return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

template<class T1, class T2> void add( T1 &x, T2 y, ll m = MOD )
{
	x += y;
	if( x >= m )
		x -= m;
}

template<class T1, class T2> void sub( T1 &x, T2 y, ll m = MOD )
{
	x -= y;
	if( x < 0 )
		x += m;
}

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	fastio();

	int a,b;
	cin>>a>>b;

	a += b;

	if( a >= 15 && b >= 8 )
	{
		cout<<1;
	}
	else if( a >= 10 && b >= 3 )
	{
		cout<<2;
	}
	else if( a >= 3 )
	{
		cout<<3;
	}
	else
	{
		cout<<4;
	}

	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}

#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  a +=b;
  if(a>=15&&b>=8){
    cout<<1;
  }else if(a>=10&&b>=3){
    cout<<2;
  }else if(a>=3){
    cout<<3;
  }else{
    cout<<4;
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
#define F first
#define S second
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  string f,b;
  int m;

  bool r = false;
  rep(i,s.size()){
    if(s[i]=='R'){
      r = !r;
      continue;
    }
    if(!r){
      b.push_back(s[i]);
      m = b.size();
      if(b[m-2]==b[m-1]){
        b = b.erase(m-2);
      }
    }else{
      f.push_back(s[i]);
      m = f.size();
      if(f[m-2]==f[m-1]){
        f = f.erase(m-2);
      }
    }
  }
  int ans = 0;
  rep(i,min(b.size(),f.size())){
    if(b[i]==f[i]){
      ans = i;
    }else{
      break;
    }
  }
  b = b.substr(ans);
  f = f.substr(ans);
  string t;
  if(!r){
    reverse(ALL(f));
    t = f+b;
  }else{
    reverse(ALL(b));
    t = b + f;
  }
  //cout << t << endl;
  bool a = true;
 while(a){
   a = false;
   for(int i = 0; i+1 < t.size(); i++){
     if(t[i]==t[i+1]){
       a = true;
       t = t.erase(i,2);
     }
   }
 }
  cout << t << endl;
}

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <functional>
#include <queue>
using namespace std;
typedef long long ll;
using pii =  pair<int, int>;

int main(){

    string s;
    cin >> s;
    int n = s.length();
    // vector<string> res;
    // int p = 0;
    // for (int i = 0; i < n; ++i){
    //     if(s[i] == 'R'){
    //         string t = s.substr(p, i - p);
    //         reverse(t.begin(), t.end());
    //         res.push_back(t);
    //         p = i + 1;
    //     }
    // }
    // string t = s.substr(p, n);
    // res.push_back(t);

    // for(const auto& x : res)
    //     cout << x << endl;
    deque<char> res;
    int op = 0;
    for (int i = 0; i < n; ++i){
        if(s[i] == 'R'){
            op ^= 1;

        }else{
            if(!op){
                if(!res.empty() && res.back() == s[i]){
                    res.pop_back();
                }else
                    res.push_back(s[i]);
            }else{
                if(!res.empty() && res.front() == s[i]){
                    res.pop_front();
                }else
                    res.push_front(s[i]);
            }
        }

    }
    string ans;
    for(const auto&c : res)
        ans += c;
    if(op)
        reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
int tt,n,inf=1e15;

void solve(){
	cin>>n;
	int a[n+1],ans=0;
	a[0]=0;
	map<int,int> m;
	m[0]=1;
	for(int i=1;i<=n;i++){
		int x;cin>>x;
		if(i%2)a[i]=a[i-1]-x;
		else a[i]=a[i-1]+x;
		m[a[i]]++;
	}
    //	for(int i=0;i<=n;i++)cout<<m[a[i]]<<" ";
    //	cout<<'\n';
    for(int i=0;i<=n;i++){
    	int x=m[a[i]];
    	if(x){
          ans+=((x*(x-1))/2);
          m[a[i]]=0;
    	}
    }
    cout<<ans<<'\n';
	}

signed main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    //cin>>tt;
    //while(tt--)
    solve();
}

#include<bits/stdc++.h>
using namespace std;
#define mod  1000000007
#define int long long

void solve() {
    int n;
    double ans = 100000000000000000.0;
    cin >> n;
    vector< int > v(n);
    unordered_map<int,int> pref;
    double sum = 0;
    for ( int i=0; i<n; i++ ) {
        cin >> v[i];
        sum += double(v[i]);
    }

    sort(v.begin(), v.end());

    for ( int i=0; i<n; i++ ) {
        pref[i] = pref[i-1] + v[i];
    }

    for ( int i=0; i<n; i++ ) {
        double res = double(n)*double(v[i]/double(2)) + sum;
        res -= double(pref[i]);
        res -= double(n-i-1) * double(v[i]);
        res = res / double(n);
        ans = min(ans, res);
    }
    printf("%.7lf", ans);
    // cout << setprecision(7) << ans << '\n';
}

signed main() {

    int tc = 1;
    // cin >> tc;
    while( tc-- ) {
        solve();
    }
}

// Tarun IIITA


// Always remember that you are absolutely unique, just like everyone else!

#include <iostream>
#include <vector>
using namespace std;

// DEBUGGING SECTION
void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)

#define MOD     1000000007
#define INF     3e18
#define pb      push_back
#define endl    '\n' // Remove if interactive
#define ff      first
#define ss      second
#define FOR(i, a, b)   for(int i = a; i < b; i++)

//#include <algorithm>
//#include <cstring>
//#include <map>
//#include <set>
//#include <queue>
//#include <stack>
//#include <math.h>

//#include <bits/stdc++.h>

#define int     long long
#define pii     pair<int, int>
#define vi      vector<int>
#define vvi     vector<vi>
#define vpii    vector<pii>
#define all(x)  x.begin(), x.end()

int power(int x, int y) {
    int ans = 1; x %= MOD;
    while (y) {
        if (y & 1)
            ans = (x * ans) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

// comparator(A, B) -> should return true if A needs to come before B!
// ALWAYS RETURN FALSE IF A == B

// USE INTEGERS TO REDUCE RUNTIME!

void solve() {
    int n;
    cin >> n;
    int arr[n];
    FOR(i, 0, n) {
        cin >> arr[i];
    }
    vi rem(200, 0);
    int ans = 0;
    FOR(i, 0, n) {
        int r = arr[i] % 200;
        ans += rem[r];
        rem[r]++;
    }

    cout << ans << endl;
}

int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("error.txt", "w", stderr);
    freopen("output.txt", "w", stdout);
#endif

    fastio;
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}

#include <cstdio>
#define MOD 200
using namespace std;

int cnt[MOD];

int main()
{
	int n;
	scanf("%d", &n);
	long long ans = 0LL;
	while(n--)
	{
		int x;
		scanf("%d", &x);
		ans += cnt[x %= MOD] ++;
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	double v,t,s,d;
	cin>>v>>t>>s>>d;
	double cur = d/v;
	if(cur<t || cur>s)
		cout<<"Yes\n";
	else
		cout<<"No\n";

	return 0;

}

/******************************************************/
/******************************************************/
/**                                                  **/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         REAZ AHAMMED CHOWDHURY - reaziii         **/
/**  Department of Computer Science and Engineering  **/
/*         INSTITUTE OF SCIENCE AND TECHNOLOGY       **/
/**                                                  **/
/******************************************************/
/******************************************************/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pcase(x)     printf("Case %d: ",x++)
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x)     memset(x,-1,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define linfi        LLONG_MAX
#define pii          pair<int,int>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))
#define fro(i,x,y)   for(int i=x;i<y;i++)
#define ech(x,a)     for(auto &x : a)
#define ff           first
#define ss           second
#define vi           vector<int>
#define vl           vector<ll>
#define pi           acos(-1.0)

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type,
        less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        Ordered_set;
template<class T> void read(T& x) {cin >> x;}
template<class H, class... T> void read(H& h, T&... t) {read(h); read(t...);}
template<class A> void read(vector<A>& x) {for (auto &a : x) read(a);}
template<class H> void print(vector<H> &x) {ech(a, x) cout << a << " "; cout << endl;}
template<class P> void debug(P h) {
#ifndef ONLINE_JUDGE
	cerr << h << " ";
#endif
}
template<class W, class... V> void debug(W h, V... t) {
#ifndef ONLINE_JUDGE
	debug(h);
	debug(t...);
	cerr << endl;
#endif

}

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;

bool checkbitt(ll num, int pos) {return (num >> pos) & 1;}
ll setbitt(ll num, ll pos) {return (1 << pos) | num;}
ll resetbitt(ll num, int pos) {if (!checkbitt(num, pos)) return num; else return (1 << pos)^num;}
ll bigmod(ll a, ll b, ll mod) {if (b == 0) return 1; if (b == 1) return a; if (b & 1) {return ((a % mod) * (bigmod(a, b - 1, mod) % mod)) % mod;} ll x = bigmod(a, b / 2, mod); return (x * x) % mod;}
ll geti() {ll x; read(x); return x;}
ll cdiv(ll a, ll b) {ll ret = a / b; if (a % b) ret++; return ret;}
const ll mod =  1e9 + 7;
const ll N   =  2e5 + 10;
int dx[4] = { +0, +0, +1, -1};
int dy[4] = { -1, +1, +0, +0};

//................................___Start from here___...............................//
//................................_____________________..............................//

int solve() {
	ll a, b, c, d;
	read(a, b, c, d);

	b *= a, c *= a;

	if (d >= b && d <= c) {
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;

	return 0;
}
int main(int argc, char* argv[]) {

	if (argc <= 1) {
#ifndef ONLINE_JUDGE
		input;
		output;
#endif
#ifdef ONLINE_JUDGE
		ios_base::sync_with_stdio(false);
		cin.tie(0);
#endif
	}

	int cs = 1, cn = 1;
	// read(cs);
	while (cs--) {
		solve();

	}
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
struct edge {
    ll to;     // 辺の行き先
    ll weight; // 辺の重み
    edge(ll t, ll w) : to(t), weight(w) { }
};
using Graph = vector<vector<ll>>;
using WeightedGraph = vector<vector<edge>>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
const ll INF = (1LL << 31) - 1;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vl a;
    ll sum=0;
    rep(i,n){
        ll x;
        cin >> x;
        sum += x;
        a.pb(sum);
    }
    vl s;
    ll y=0;
    s.pb(0);
    rep(i,n){
        y += a[i];
        s.pb(y);
    }
    vl m(n+1,0);
    for(ll i=1;i<n+1;i++){
        m[i]=max(m[i-1],a[i-1]);
    }
    ll ans = 0;
    for(ll i=1;i<n+1;i++){
        ans = max(ans, s[i-1]+m[i]);
    }
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
#include <variant>

#define rep2(i,k,n) for(i64 i=(i64)(k);i<(i64)(n);i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) begin(x),end(x)
#ifdef ENV_LOCAL
#define dump if (1) cerr
#else
#define dump if (0) cerr
#endif

using namespace std;
using namespace std::string_literals;

using i32 = int32_t;
using i64 = int64_t;
using f64 = double;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;

//using namespace harudake;

tuple<i32,i32,i32> tree_dp(const vector<vi32>& g, i32 th, i32 i, i32 p = -1) {
  i32 ans = 0;
  i32 deepest = 0;
  i32 cover = -1e8;
  for (auto&& to : g[i]) {
    if (to == p) continue;
    auto [cst, dep, cov] = tree_dp(g, th, to, i);
    ans += cst;
    cover = max(cover, cov-1);
    deepest = max(deepest, dep+1);
  }
  if (deepest <= cover) deepest = -1e8;
  if (deepest == th) {
    ++ans;
    deepest = -1e8;
    cover = th;
  }
  return make_tuple(ans, deepest, cover);
}

//void dfs(const vector<vi32>& g, vi32& d, i32 i, i32 p = -1) {
//  for (auto&& to : g[i]) {
//    if (to == p) continue;
//    d[to] = d[i] + 1;
//    dfs(g, d, to, i);
//  }
//}
//
//i32 get_to_put(const vector<vi32>& g, const vector<bool>& covered, i32 th) {
//  i32 n = size(g);
//  rep(i,n) {
//    if (!covered[i]) {
//      vi32 d(n, -1);
//      d[i] = 0;
//      dfs(g, d, i);
//      i32 mx = -1;
//      i32 mxj = 0;
//      rep(j,n) {
//        if (!covered[j]) {
//          if (d[j] > mx) {
//            mx = d[j];
//            mxj = j;
//          }
//        }
//      }
//      vi32 d2(n, -1);
//      d2[mxj] = 0;
//      dfs(g, d2, mxj);
//      mx = -1;
//      i32 j2 = 0;
//      rep(j,n) {
//        if (!covered[j]) {
//          if (d[j] > mx) {
//            mx = d[j];
//            j2 = j;
//          }
//        }
//      }
//      if (mx <= th) {
//        return j2;
//      }
//      vi32 d3(n, -1);
//      d3[j2] = 0;
//      dfs(g, d3, j2);
//      rep(j,n) {
//        if (d2[j] == th && d2[j] + d3[j] == d2[j2]) {
//          return j;
//        }
//      }
//      return -1;
//    }
//  }
//  return -1;
//}

bool check(const vector<vi32>& g, i32 k, i32 th) {
  auto [ans, deepest, cover] = tree_dp(g, th, 0);
  if (deepest >= 0) ++ans;
  return ans <= k;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i32 n,k;
  cin>>n>>k;
  vector<vi32> g(n);
  rep(i,n-1) {
    i32 u,v;
    cin>>u>>v;
    --u;--v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  i32 lt = 0;
  i32 ge = n;
  while (ge - lt > 1) {
    i32 mid = (ge + lt) / 2;
    if (check(g, k, mid)) {
      ge = mid;
    } else {
      lt = mid;
    }
  }
  cout<<ge<<endl;
  return 0;
}


#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dy[4]={ -1,0,1,0 };
const int dx[4]={ 0,-1,0,1 };

int N;

signed main(){
	cin >> N;
	if(N%2 == 0) cout << "White" << endl;
	else cout << "Black" << endl;
}

// @includes_template
#ifndef INCLUDES_H
#define INCLUDES_H

#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<string>

#define s64i              long long
#define u64i              unsigned long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
// #define sz(x)             (int)((x).size())
#define ff                first
#define ss                second
#define pii               pair<int,int>
#define ffloop(i,a,b,step)        for(int i=a;i<b;i+=step)
#define bfloop(i,a,b,step)        for(int i=a;i>b;i-=step)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))

template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

using namespace std;

#endif

// @contest_template
#include<algorithm>
namespace contest_ns{
    void solve(){
        /**
         * new code goes here
         */
        int x,y;
        cin>>x>>y;
        if(x == 0 && (y ==0)){
            cout<<0<<endl;
        }else if(x == 0 && y==1){
            cout<<2<<endl;
        }else if(x == 0 && y==2){
            cout<<1<<endl;
        }else if((x == 1) && (y == 0)){
            cout<<2<<endl;
        }else if(x == 1 && y == 1){
            cout<<1<<endl;
        }else if(x == 1 && y == 2){
            cout<<0<<endl;
        }else if(x == 2 && y == 0){
            cout<<1<<endl;
        }else if(x == 2 && y == 1){
            cout<<0<<endl;
        }else if(x == 2 && y == 2){
            cout<<2<<endl;
        }
    }
    // template<typename T>
    void testcase(){
        // T t;
        long long int t;
        std::cin>>t;
        while(t>0){
            solve();
            t--;
        }
    }
}

int main(){

    // @problem code

    contest_ns::solve();

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

#define F first
#define S second
#define inf 1e16

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n; cin >> n;
    ll price = floor(1.08*n);
    if(price < 206){
        cout << "Yay!\n";
    } else if(price == 206){
        cout << "so-so\n";
    } else {
        cout << ":(\n";
    }
    return 0;
}

#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;

long long n;
long long maxn;
priority_queue<long long,vector<long long>,greater<long long> > q;

int main()
{
	scanf("%lld",&n);
	for(long long i=1;i<=sqrt(n);i++)
	{
		if(n%i==0)
		{
			q.push(i);
			maxn++;
			if(n!=i*i)
			 {
			 	q.push(n/i);
			 	maxn++;
			 }
		}
	}

	while(!q.empty())
	{
		printf("%lld\n",q.top());
		q.pop();
	}

	return 0;
}


#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
vector<ll> solve(ll t, vector<ll> l, vector<ll> r) {
    vector<ll> res(t);

    for(ll i = 0ll; i < t; i++) {
        ll count = max(r[i] - 2ll * l[i] + 1ll, 0ll);
        res[i] = count * (count + 1ll) / 2ll;
    }
    return res;
}
int main()
{
	std::ios::sync_with_stdio(false);
	ll t;
    cin >> t;
    vector<ll> l(t), r(t);
    for(int i = 0; i < t; i++) {
        cin >> l[i] >> r[i];
    }
    vector<ll> res =  solve(t, l, r);
    for(ll i=0ll;i<t; i++) {
        cout << res[i] << endl;
    }
	return 0;
}

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

void solve()
{
      ll l , r ; cin>>l>>r ;
      if(r-l*2>=0){
         cout<< (r-2*l+1) * (r-2*l+2) / 2 <<endl;
      }else {
         cout<< 0 <<endl;
      }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t ;
    cin>>t ;
    while(t--){
        solve() ;
    }
    return 0 ;
}


//thanks God For Every Thing!
//contest link:

#include<bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>

#define pi           acose(-1)
#define flush        cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define fasterio     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL           printf("\n")
#define fin          freopen("int.txt","r",stdin);
#define fout         freopen("out.txt","w",stdout);

using namespace std;

typedef long long int ll;
typedef double dl;

// ---------------------- slove---------------------------//

int main()
{
    //fin
    //fout
    string s;
    getline(cin,s);
    ll ln=0;
    ln = s.length();

    int x1=0, x2=0, x3=0, chekr1=0, chekr2=0;

    int flg1=0, flg2=0, flg3=0, x=0;

    if(ln==1)
    {
        if(s[0] == '8')
        {
            printf("Yes");
            NL;
        }
        else
        {
            printf("No");
            NL;
        }
        return 0;
    }
    else if(ln==2)
    {
        x1 = s[ln-1]-48;
        x2 = s[ln-2]-48;

        chekr2 = ((x2*10)+x1);
        chekr1 = ((x1*10)+x2);

        if(chekr1%8==0 || chekr2%8==0)
        {
            printf("Yes");
            NL;
        }
        else
        {
            printf("No");
            NL;
        }
        return 0;
    }

    else if(ln>=3)
    {
        int arr[10]={0};
        for(int c=0; c<ln; c++)
        {
            arr[s[c]-48]++;
        }
        for(int i=104; i<=992; i+=8)
        {
            int d1, d2, d3, n;
            n = i;
            d1 = n%10;
            n/=10;
            d2 = n%10;
            d3 = n/10;
            if(arr[d1]>0)
            {
                arr[d1]--;
                if(arr[d2]>0)
                {
                    arr[d2]--;
                    if(arr[d3]>0)
                    {
                            printf("Yes");
                            NL;
                            return 0;
                    }
                    arr[d2]++;
                }
                arr[d1]++;
            }

        }
        printf("No");
        NL;
        return 0;
    }
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	string s;
	cin >> s;
	vector<int> a(10);
	rep(i, s.length()){
		a[s.at(i)-'0']++;
	}
	int st = 0;
	int end = 0;
	int t = 0;
	if(s.length() == 1){
		st = 1;  end = 2;   t = 1;
	}else if(s.length() == 2){
		st = 2;  end = 13;  t = 2;
	}else{
		st = 13; end = 126; t = 3;
	}
	for(int i=st; i<end; i++){
		int l = 8*i;
		int f = 0;
		vector<int> b(10);
		rep(i, t){
			b[l%10]++;
			l /= 10;
		}
		if(b[0] != 0) continue;
		rep(i, 10){
			if(b[i] > a[i]) f = 1;
		}
		if(f == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <algorithm>
#include <iostream>
#include <bitset>
#include <vector>
#include <array>
using namespace std;
#define f(x,y,z) for(int x=y;x<=z;++x)
vector<int> v[200001];
int n, a, b, it;
array<int, 200001> jr, dlm, nmr;
bitset<200001> sdh;
void jrk(int x) {
    for(int &i:v[x]) if(!jr[i]) {
        jr[i] = jr[x]+1, jrk(i);
    }
}
void trn(int x) {
    sdh[x] = true;
    for(int &i:v[x]) if(!sdh[i]) {
        trn(i), dlm[x] = max(dlm[x], dlm[i]+1);
    }
}
void isi(int x) {
    sdh[x] = true, nmr[x] = a;
    vector<pair<int, int>> mn;
    for(int &i:v[x]) if(!sdh[i]) mn.push_back({dlm[i], i});
    sort(mn.begin(), mn.end());
    for(auto &i:mn) ++a, isi(i.second), ++a;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n;
    f(i,2,n) {
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    jr[1] = a = 1, jrk(1);
    it = max_element(jr.begin()+1, jr.begin()+n+1)-jr.begin();
    trn(it), sdh.reset(), isi(it);
    f(i,1,n) cout << nmr[i] << ' ';
}

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

#define REP(i,a,b) for(int i=a;i<=b;i++)

const int Nmax=2e5+9;
int N;
string S[Nmax];
map <string,int> M;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N;
    REP(i,1,N) cin>>S[i];
    REP(i,1,N) {
        if (S[i][0]!='!') M[S[i]]=1;
    }
    REP(i,1,N) {
        if (S[i][0]!='!') continue;
        S[i].erase(S[i].begin());
        if (M[S[i]]==1) {
            cout<<S[i];     return 0;
        }
    }
    cout<<"satisfiable";
    return 0;
}


# define _GLIBCXX_DEBUG
# define rep(i, n) for (int i=0; i<(int)(n); i++)
# define FOR(i,a,b) for(int i=(a);i<=(b);++i)
# define ALL(a) (a).begin(), (a).end()
# define COUT(x) cout << (x) << endl;
# define KAI() cout << endl;
# define INF 10000000000000000LL
typedef long long ll;
# include <iostream>
# include <string>
# include <cmath>
# include <algorithm>
# include <vector>
# include <set>
# include <bitset>
# include <iomanip>
using namespace std;

int main() {
    int n;
    double D,H;
    cin >> n >> D >> H;

    vector<double> d(n);
    vector<double> h(n);

    rep(i,n) cin >> d[i] >> h[i];

    double ans=0.0;

    rep(i,n) {
        double temp;
        temp = (h[i]-H*d[i]/D)/(1.0-d[i]/D);
        // cout << "i=" << i << ", temp=" << temp << endl;
        if (temp < 0.0) continue;
        else ans = max(ans,temp);
    }
     cout << fixed << setprecision(15) << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	long double x,y,r;
	cin>>x>>y>>r;
	long long ans=0;
	r+=1e-14;
	for(long long i=ceil(x-r);i<=floor(x+r);i++)
	{
		long double t=sqrt(r*r-(i-x)*(i-x));//r'

		ans+=(floor(y+t))-(ceil(y-t))+1;
	}
	cout<<ans;
}


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

    using namespace std;
    using namespace __gnu_pbds;

    #define endl "\n" //interactive
    #define fi first
    #define se second
    #define pb push_back
    #define int long long
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
    typedef vector<int> vi;

    #define read(t) ll t;cin>>t;
    #define all(value) value.begin(),value.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define F(i,n) for(ll i=0;i<n;i++)

    #define deb(value) cerr << #value << " is =" << value << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;

    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset; // store ind on sec
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1; // decreasing
   /* member functions :
                1. order_of_key(k) : number of elements strictly lesser than k
                2. find_by_order(k) : k-th element in the set (counting from zero)*/

    //a.erase(unique(a.begin(),a.end()),a.end());

    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};

    const int  mod  =  1e9+7 ;
    const int  mod2 =  998244353;
    const int  inf  =  1e18;

    long long binpow(int a,int b,int m)
    {
        a %= m;int res = 1;
        while (b > 0)
        {
            if (b & 1)res=(res*a)%m;
            a=(a*a)%m  ;    b/=2;
        }
        return res;
    }
    int modinv(int n,int m) {return binpow(n,m-2,m);}

    const int man=2e5+5;

/*

    $ don't apply unnecessary operations
    $ do check boundary cases (i==1/n-1/n)

    $ change approach / use pen ? paper
    $ Don't stuck! :- * re-solve
                      * check for another sol
                      * check function , cal

*/
/*......................................................................................................................*/

void solve()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int a=(2*i)%n;
        if(a==0)a=n;
        int b=(2*i+1)%n;
        if(b==0)b=n;
        cout<<a<<" "<<b<<endl;
    }

}

signed main()
{
    fast;

    int test=1;
    // cin>>test;
    while(test--)solve();

    return 0;
}

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

signed main(){
    int t = 1; cin >> t;
    while(t--){
        int n; cin >> n;
        vector<int> a(n);
        for(auto &x:a)
            cin >> x;
        sort(a.begin(),a.end());
        if(n%2)
        {
            cout << "Second\n";
            continue;
        }
        int even = 0, odd = 0;
        for(int i = n-1; i >= 0; i -= 2)
            odd += a[i];
        for(int i = n-2; i >= 0; i -= 2)
            even += a[i];
        if(even == odd)
            cout << "Second\n";
        else cout << "First\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
using P=pair<int,int>;
constexpr int INF=1e9;
struct edge{int to,cost;};
bool chmin(int&a,int b){return a>b?a=b,true:false;}
int main(){
  int H,W; cin>>H>>W;
  vector<vector<int>>A(H,vector<int>(W-1)),B(H-1,vector<int>(W));
  for(int i=0;i<H;i++)for(int j=0;j<W-1;j++)cin>>A[i][j];
  for(int i=0;i<H-1;i++)for(int j=0;j<W;j++)cin>>B[i][j];
  vector<vector<edge>>G(H*W);
  for(int i=0;i<H;i++)for(int j=0;j<W-1;j++)G[i*W+j].push_back({i*W+j+1,A[i][j]});
  for(int i=0;i<H;i++)for(int j=1;j<W;j++)G[i*W+j].push_back({i*W+j-1,A[i][j-1]});
  for(int i=0;i<H-1;i++)for(int j=0;j<W;j++)G[i*W+j].push_back({i*W+j+W,B[i][j]});
  for(int i=1;i<H;i++)for(int j=0;j<W;j++){
    for(int k=0;k<i;k++)G[i*W+j].push_back({k*W+j,i-k+1});
  }
  vector<int>dist(H*W,INF); dist[0]=0;
  priority_queue<P,vector<P>,greater<P>>Q; Q.push({0,0});
  while(!Q.empty()){
    auto[c,v]=Q.top(); Q.pop();
    if(dist[v]<c)continue;
    for(edge e:G[v])if(chmin(dist[e.to],c+e.cost))Q.push({dist[e.to],e.to});
  }
  cout<<dist[H*W-1]<<endl;
}

#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

ll func(){
    int n = in();
    int L = in();
    vector<ll> start(n);
    vector<ll> goal(n);
    foreach(i,start)i=in();
    foreach(i,goal)i=in();
    vector<ll> x(n+1);
    vector<ll> y(n+1);
    x[0] = start[0]-1;
    y[0] = goal[0]-1;
    x.back() = L - start.back();
    y.back() = L - goal.back();
    rep(i,1,n){
        x[i] = start[i]-start[i-1]-1;
        y[i] = goal[i]-goal[i-1]-1;
    }
    int last = 0;
    ll res = 0;
    rep(i,n+1){
        while(last < n + 1 and x[last]==0)++last;
        if(y[i]==0)continue;
        ll sum = 0;
        int itr = last;
        while(sum < y[i]){
            sum += x[itr++];
        }
        if(sum != y[i])return -1;
        if(last < i and i < itr){
            res += i - last;
            res += itr - i - 1;
        }else{
            res += max(abs(i-last),abs(i-(itr-1)));
        }
        last = itr;
    }
    return res;
}

int main(){
    cout << func() << endl;
  return 0;
}


#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

struct C
{
	int size;
	int c[2];
	C(int size, int cc[2]) : size(size) {
		c[0]=cc[0];
		c[1]=cc[1];
	}
	bool operator<(C rhs) const {
		return c[0]-c[1]<rhs.c[0]-rhs.c[1];
	};
};

int main() {
	int n;
	std::cin >> n;
	V<V<int> > g(n);
	for(int i=1;i<n;i++) {
		int p;
		std::cin >> p;
		p--;
		g[p].emplace_back(i);
	}
	auto dfs = [&](auto f, int i) -> C {
		int size=1;
		V<C> v;
		for(auto e:g[i]) {
			v.emplace_back(f(f,e));
		}
		int m=v.size();
		int o[2];
		if(m==0) {
			o[0]=1;
			o[1]=0;
			C c(1,o);
			return c;
		}
		if(m==1) {
			o[0]=v[0].c[0]+1;
			o[1]=v[0].c[1];
			C c(v[0].size+1,o);
			return c;
		}
		rep(i,m) size+=v[i].size;
		o[0]=1;
		o[1]=0;
		C c(size,o);
		V<C> vo,ve;
		rep(i,m) {
			if(v[i].size&1) vo.emplace_back(v[i]);
			else ve.emplace_back(v[i]);
		}
		std::sort(all(vo));
		rep(i,vo.size()) {
			if(i&1) {
				c.c[0]+=vo[i].c[1];
				c.c[1]+=vo[i].c[0];
			} else {
				c.c[0]+=vo[i].c[0];
				c.c[1]+=vo[i].c[1];
			}
		}
		int odd=vo.size()&1;
		for(auto e:ve) {
			if(e.c[0]-e.c[1]<0) {
				c.c[0]+=e.c[0];
				c.c[1]+=e.c[1];
			} else {
				c.c[0]+=e.c[odd];
				c.c[1]+=e.c[1^odd];
			}
		}
		return c;
	};
	print(dfs(dfs,0).c[0]);
}

/*Author--Vishwas Agrawal*/
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define test  \
    ll t;     \
    cin >> t; \
    while (t--)
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define M 1000000007LL
#define input(v, n) \
    inc(i, 0, n)    \
    {               \
        ll x;       \
        cin >> x;   \
        v.pb(x);    \
    }
#define print(v, n) \
    inc(i, 0, n) { cout << v[i] << " "; }
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define inc(i, a, n) for (ll i = a; i < n; i++)
#define dec(i, a, n) for (ll i = n - 1; i >= a; i--)
long long binpow(long long base, long long exp, int mod)
{
    long long res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % mod;
        exp = exp >> 1;
        base = (base * base) % mod;
    }
    return res;
}
long long mod(long long x)
{
    return ((x % M + M) % M);
}

long long add(long long a, long long b)
{
    return mod(mod(a) + mod(b));
}

long long mul(long long a, long long b)
{
    return mod(mod(a) * mod(b));
}
bool Is_Prime(long long x)
{
    if (x % 2 == 0)
        return false;
    for (int i = 3; i * i <= x; i += 2)
        if (x % i == 0)
            return false;
    return true;
}

int main()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll count = 0;
    inc(i, 0, s.length())
    {

        ll arr[4] = {0};
        if (s[i] == 'A')
            arr[0]++;
        if (s[i] == 'T')
            arr[1]++;
        if (s[i] == 'C')
            arr[2]++;
        if (s[i] == 'G')
            arr[3]++;
        inc(j, i + 1, s.length())
        {
            if (s[j] == 'A')
                arr[0]++;
            if (s[j] == 'T')
                arr[1]++;
            if (s[j] == 'C')
                arr[2]++;
            if (s[j] == 'G')
                arr[3]++;
            if (arr[0] == arr[1] && arr[2] == arr[3])
            {
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (decltype(n) i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (decltype(n) i = 1, i##_len = (n); i <= i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define plx(s) {cout << (s) << "\n"; exit(0);}
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
using ll = long long; using ld = long double; template<class T> using V = vector<T>;
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> istream &operator>>(istream &is, complex<T> &v) {T x, y; is >> x >> y; v.real(x); v.imag(y); return is;}
template<class T> istream &operator>>(istream &is, V<T> &v) {for (auto&& e : v) is >> e;return is;}
template<class T, size_t n> istream &operator>>(istream &is, array<T, n> &v) {for (auto&& e : v) is >> e;return is;}
template<class T> inline string join(const T& v, string sep = " ") {if (v.size() == 0) return "" ;stringstream ss;for (auto&& e : v) ss << sep << e;return ss.str().substr(1);}
constexpr ll TEN(int n) {return (n == 0) ? 1 : 10 * TEN(n - 1);}
struct IOS {IOS() {cin.tie(nullptr); ios::sync_with_stdio(false); dump("");}} IO;
constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60;

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

struct Solver {
  V<string> in, out;
  ll output_n, input_m;

  bool isSubString(string &b) {
    rep(i,output_n) rep(j,output_n) rep(d,2) {
      bool ok = true;
      rep(k,sz(b)) {
        ll ni = (i+dy[d]*k) % output_n;
        ll nj = (j+dx[d]*k) % output_n;
        if (out[ni][nj] != b[k]) {
          ok = false;
          break;
        }
      }
      if (ok) return true;
    }
    return false;
  }

  ld computeScore() {
    ll used_count = 0;
    ll space_count = 0;
    rep(i,output_n) rep(j,output_n) if (out[i][j] == '.') ++space_count;
    rep(k,input_m) if (isSubString(in[k])) ++used_count;
    ld score = 0;
    if (used_count < input_m) {
      score = (ld)(TEN(8) * used_count) / (ld)(input_m);
    } else {
      score = (ld)(TEN(8) * 2 * output_n * output_n) / (ld)(2 * output_n * output_n - space_count);
    }
    dump(used_count,input_m,score);
    return round(score);
  }

  void solve() {
    cin >> output_n >> input_m;
    in.resize(input_m); out.resize(output_n);
    cin >> in;
    V<pair<int,string>> in_for_sort(input_m);
    rep(i,input_m) in_for_sort[i] = {sz(in[i]), in[i]};
    sort(rall(in_for_sort));
    string tmp = "";
    rep(i,input_m) tmp += in_for_sort[i].second;
    rep(i,output_n) out[i] = tmp.substr(i*output_n, output_n);
    ll score = computeScore();
    dump(score);
    pl(join(out,"\n"));
  }
} solver;
signed main(void) {solver.solve();return 0;}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T1, class T2> inline bool chmin(T1 &a, const T2 &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);cerr<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T> void verr(const set<T> &st) { repa(a, st) cerr << a << " "; cerr << endl; }
template <class S, class T> void verr(const map<S, T> &mp) { repa(a, mp) cerr << "{" << a.first << ", " << a.second << "} "; cerr << endl; }
template <class S, class T, class N> void verr(const vector<pair<S,T>>& a, const N& n) { rep(i, n) cerr << "{" << a[i].first << ", " << a[i].second << "} "; cerr << endl; }
template <class T, class N> void verr(const vector<T>& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << endl; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << endl; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-5;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N;
    cin >> N;
    vc<complex<ld>> S(N), T(N);
    rep(i, N) {
        ld a, b;
        cin >> a >> b;
        S[i] = {a, b};
    }
    rep(i, N) {
        ld a, b;
        cin >> a >> b;
        T[i] = {a, b};
    }

    complex<ld> sc(0, 0), tc(0, 0);
    rep(i, N) sc += S[i], tc += T[i];
    sc /= N, tc /= N;

    rep(i, N){
        S[i] -= sc;
        T[i] -= tc;
    }
    rep(i, N) rep(j, N){
        vc<complex<ld>> ss(N), tt(N);
        rep(si, N) ss[si] = S[si] * polar(1.0L, -arg(S[i]));
        rep(ti, N) tt[ti] = T[ti] * polar(1.0L, -arg(T[j]));

        bool ok = true;
        rep(si, N) {
            bool isok = false;
            rep(ti, N){
                if (abs(ss[si] - tt[ti]) < EPS) isok = true;
            }
            if(!isok){
                ok = false;
                break;
            }
        }
        if(ok){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}


#include<bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve()
{
    string s;
    cin>>s;
    int n=s.size();
    s="."+s;
    string t=".atcoder";
    int res=-1;
    for(int i=0; i<=7; i++)
    {
        string a=s;
        int cur=0;
        for(int j=1; j<=i; j++)
        {
            bool found=false;
            for(int k=j; k<=n; k++)
            {
                if(a[k]==t[j])
                {
                    found=true;
                    for(int z=k; z>j; z--)
                    {
                        cur++;
                        swap(a[z],a[z-1]);
                    }
                    break;
                }
            }
            if(!found)
                cur=1e9;
        }
        bool have=false;
        if(i!=7)
        {
            for(int k=i+1; k<=n; k++)
            {
                if(a[k]>t[i+1])
                {
                    have=true;
                    for(int z=k; z>i+1; z--)
                    {
                        cur++;
                        swap(a[z],a[z-1]);
                    }
                    break;
                }
            }
        }
        if(cur==1e9)
            continue;
        if(have||(i==7&&n>7))
        {
            if(res==-1||res>cur)
                res=cur;
        }
    }
    cout<<res<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin>>t;
    while(t--)
        solve();
}

//12252024832524
#include <cstdio>
#include <cstring>
#include <algorithm>
#define TT template<typename T>
using namespace std;

typedef long long LL;
const int MAXN = 205;
int n;
int dp[MAXN * MAXN],ID[MAXN * MAXN],pre[MAXN * MAXN];
int ans[MAXN],ling1,ling2;

LL Read()
{
	LL x = 0,f = 1;char c = getchar();
	while(c > '9' || c < '0'){if(c == '-')f = -1;c = getchar();}
	while(c >= '0' && c <= '9'){x = (x*10) + (c^48);c = getchar();}
	return x * f;
}
TT void Put1(T x)
{
	if(x > 9) Put1(x/10);
	putchar(x%10^48);
}
TT void Put(T x,char c = -1)
{
	if(x < 0) putchar('-'),x = -x;
	Put1(x); if(c >= 0) putchar(c);
}
TT T Max(T x,T y){return x > y ? x : y;}
TT T Min(T x,T y){return x < y ? x : y;}
TT T Abs(T x){return x < 0 ? -x : x;}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n = Read();
	dp[0] = 1;
	for(int i = 1;i <= n;++ i)
	{
		int val = Read() % 200;
		if(!val)
		{
			if(!ling1) ling1 = i;
			else
			{
				printf("Yes\n1 %d\n1 %d",ling1,i);
				return 0;
			}
			continue;
		}
		for(int j = 200*200;j >= val;-- j)
			if(dp[j-val])
			{
				if(dp[j])
				{
					int tot = 0,now = j;
					while(now > 0)
					{
						ans[++tot] = ID[now];
						now = pre[now];
					}
					sort(ans+1,ans+tot+1);
					printf("Yes\n");
					Put(tot);
					for(int k = 1;k <= tot;++ k) putchar(' '),Put(ans[k]);
					putchar('\n');

					now = j-val; tot = 0;
					while(now > 0)
					{
						ans[++tot] = ID[now];
						now = pre[now];
					}
					ans[++tot] = i;
					sort(ans+1,ans+tot+1);
					Put(tot);
					for(int k = 1;k <= tot;++ k) putchar(' '),Put(ans[k]);
					putchar('\n');
					return 0;
				}
				dp[j] = 1,ID[j] = i,pre[j] = j-val;
			}
		int ID1 = -1,ID2 = -1;
		for(int j = 1;j < 200 && ID2 < 0;++ j)
		{
			ID1 = -1; ID2 = -1;
			for(int k = j;k <= 200*200;k += 200)
			{
				if(dp[k])
				{
					if(ID1 < 0) ID1 = k;
					else if(ID2 < 0)
					{
						ID2 = k;
						break;
					}
				}
			}
			if(ID1 >= 0 && ID2 >= 0) break;
		}
		if(ID1 >= 0 && ID2 >= 0)
		{
			printf("Yes\n");
			int tot = 0;
			while(ID1 > 0)
			{
				ans[++tot] = ID[ID1];
				ID1 = pre[ID1];
			}
			Put(tot);
			sort(ans+1,ans+tot+1);
			for(int j = 1;j <= tot;++ j) putchar(' '),Put(ans[j]);
			putchar('\n');
			tot = 0;
			while(ID2 > 0)
			{
				ans[++tot] = ID[ID2];
				ID2 = pre[ID2];
			}
			Put(tot);
			sort(ans+1,ans+tot+1);
			for(int j = 1;j <= tot;++ j) putchar(' '),Put(ans[j]);
			putchar('\n');
			return 0;
		}
	}
	printf("No");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,tot;
vector<int> g[1010];
void add(int x,int y) {
	x++,y++;
	g[x].push_back(y);
}
int mx,dis[1010];
queue<int> q;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	srand(time(0));
	for (int i=0;i<n;i++) printf("%d %d\n",(i*2)%n+1,(i*2+1)%n+1);
	/*for (int i=1;i<=n;i++) {
		memset(dis,-1,sizeof(dis));
		q.push(i);
		dis[i]=0;
		while (!q.empty()) {
			int u=q.front(); q.pop();
			for (int j=0,v;j<g[u].size();j++) {
				v=g[u][j];
				if (dis[v]==-1) dis[v]=dis[u]+1,q.push(v);
			}
		}
		for (int j=1;j<=n;j++) {
			if (dis[j]==-1) { printf("-1\n"); return 0; }
			mx=max(mx,dis[j]);
		}
	}
	printf("%d\n",mx);*/
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?

  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?

  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?

  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

#include <bits/stdc++.h>
#define int long long
#define menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define BE(i) i.begin(),i.end()
#define fi first
#define se second
#define INF 2147483646
#define mkp make_pair
#define ist insert
#define mod 100003
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC optimize("O2")
using namespace std;
int min(int a, int b){return a < b ? a : b;}
int max(int a, int b){return a > b ? a : b;}
bool isprime(int k){bool is=1 ; for ( int i = 2 ; i*i <= k ; i++ ) if ( k % i == 0 ) is = 0 ; return k>1?is:0;}
const double PI=acos(-1);

int d,a,b,c;
void sol(){
	cin >>a>>b>>c>>d;
	cout <<b-c;
}
signed main(){
    menhera_chan_is_mine
    int T=1;
    //cin >>T;
    while (T--)
        sol();

    return 0;
}


#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<chrono>
using namespace chrono;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define endl 			"\n"
#define forn(i,x1,n)     for(int i=x1; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x1)      __builtin_popcountll(x1)
#define zrobits(x1)      __builtin_ctzll(x1)
#define mod             1000000007
#define inf             1e18
#define ps(x1,y)         fixed<<setprecision(y)<<x1
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x1)            int x1; cin>>x1; while(x1--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

void zeus()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

bool prime[100001];
vector<int> prime_no;

void SieveOfEratosthenes(int n)
{
	memset(prime, true, sizeof(prime));

	for (int p = 2; p * p <= n; p++)
	{
		if (prime[p] == true)
		{
			prime_no.pb(p);
			for (int i = p * p; i <= n; i += p)
				prime[i] = false;
		}
	}

}

int32_t main() {

	zeus();
	SieveOfEratosthenes(100);
	int n; cin >> n;

	vector<int> ans;

	cout << 6 << " " << 10 << " " << 15 << " ";
	int cnt = 0;
	int i = 18;
	while (cnt < n - 3) {
		if (i % 6 == 0 || i % 10 == 0 || i % 15 == 0) {
			cout << i << " ";
			cnt++;
		}
		i++;
	}

}

#include <cstdio>
const int N = 2505;
int n, ans[N] = {0, 6, 10, 15}, tot, flag[10005];
int main() {
	scanf("%d", &n);
	tot = 3;
	for(int i = 1; i <= 3; i++) {
		for(int j = ans[i]*2; j+ans[i] <= 10000; j += ans[i]) {
			if(flag[j]) continue; flag[j] = 1;
			ans[++tot] = j;
			if(tot == n) break;
		}
		if(tot == n) break;
	}
	for(int i = 1; i <= n; i++) printf("%d ", ans[i]);
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==b)
	cout<<a<<endl;
	else
	cout<<3-a-b<<endl;
	return 0;
}

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

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b; cin >> a >> b;
  if (a > b) swap(a, b);
  if (a == b) cout << a << '\n';
  else if (a == 0 and b == 1) cout << 2 << '\n';
  else if (a == 0 and b == 2) cout << 1 << '\n';
  else cout << 0 << '\n';
  return 0;
}


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

//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

template<typename T> void print(const T& a, ostream& out){
	for(auto i: a) out << i << ' ';
	out << endl;
}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, m; cin >> n >> m;
	vector<int> a(m), b(m), c(n);
	vector<vector<pair<int, int>>> g(n);
	FOR(i, 0, m){
		cin >> a[i] >> b[i];
		--a[i]; --b[i];
		g[a[i]].PB({b[i], i});
		g[b[i]].PB({a[i], i});
	}

	FOR(i, 0, n) cin >> c[i];

	auto finalize = [&](vector<int>& ans){
		FOR(i, 0, m){
			cout << (ans[i] ? "<-\n" : "->\n");
		}
		exit(0);
	};

	set<PII> S;
	FOR(i, 0, n) S.insert({c[i], i});

	vector<int> ans(m, -1);
	vector<int> alive(n, 1);

	while(SZ(S)){
		int v = S.begin()->Y;
		set<int> used;

		function<void(int)> dfs = [&](int u){
			used.insert(u);
			for(auto to: g[u]){
				if (c[to.X] == c[v]){
					if (ans[to.Y] == -1){
						ans[to.Y] = a[to.Y] == u ? 0 : 1;//vid u
					}

					if (!used.count(to.X)){
						dfs(to.X);
					}
				}
			}
		};

		dfs(v);
		//assert(SZ(used) == c[v]);

		for(auto u: used){
			S.erase({c[u], u});
			alive[u] = 0;
		}

		for(auto u: used){
			for(auto to: g[u]){
				if (alive[to.X]){
					ans[to.Y] = a[to.Y] == u ? 1 : 0;
				}
			}
		}
	}

	finalize(ans);

    cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 998244353;
const ll INF = 1e16;

int main() {
    ll n, k;
    cin >> n >> k;

    vvl dp(n+1, vl(2*n + 1));  // dp[i][j] : 要素数iで総和がjとなる場合の数
    dp[0][0] = 1;
    exrep(i, 1, n) {
        for(ll j = n; j >= 1; j--) {
            if(i >= j) {
                dp[i][j] = (dp[i-1][j-1] + dp[i][2*j]) % mod;
            }
        }
    }

    out(dp[n][k]);
    re0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int N;
    int Ai[100];
    int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
    int p_best = -1, p_best_count = 0, p_count;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> Ai[i];
    }

    for (int j = 0; j < sizeof(primes) / sizeof(int); j++) {
        p_count = 0;
        for (int i = 0; i < N; i++) {
            if (Ai[i] == 1) continue;
            if (Ai[i] % primes[j] == 0) {
                p_count++;
                do {
                    Ai[i] /= primes[j];
                } while (Ai[i] % primes[j] == 0);
            }
        }
        if (p_count > p_best_count) {
            p_best = primes[j];
            p_best_count = p_count;
        }
    }

    sort(Ai, Ai + N);

    int curr_p = 1;
    for (int i = 0; i < N; i++) {
        if (Ai[i] == 1) continue;
        if (Ai[i] > curr_p) {
            if (p_count > p_best_count) {
                p_best = curr_p;
                p_best_count = p_count;
            }
            curr_p = Ai[i];
            p_count = 1;
        } else {
            p_count++;
        }
    }
    if (p_count > p_best_count) {
        p_best = curr_p;
        p_best_count = p_count;
    }

    cout << p_best;

    return 0;
}

#include<iostream>
#include<cstdio>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<iomanip>
#include<fstream>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<sstream>
using namespace std;
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
//string::npos

const double pi = 3.141592653589;
const int maxn = 200002;
const int maxm = 26;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
typedef long long ll;

ll ksm(int a, int k){
    ll res = 1;
    while(k){
        if(k&1) res = (ll)res*a%mod;
        a = (ll)a*a%mod;
        k >>= 1;
    }
    return res;
}
int nxt[maxn];
int vis[maxn];
int ans, p, ring, n;

void solve(){
    for(int i = 1; i <= n; ++i){
        if(vis[i]) continue;
        p = i;
        ++ring;
        while(vis[p] == 0){
            vis[p] = ring;
            p = nxt[p];
            if(vis[p] == ring) ++ans;
        }
    }
}

int main(){
    sync;

    cin >> n;
    ring = 1;
    for(int i = 1; i <= n; ++i){
        cin >> nxt[i];
        if(nxt[i] == i){
            vis[i] = ring++;
            ans++;
        }
    }
    solve();
    cout << ksm(2, ans)-1 << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(int64_t b) {
  int64_t answer = 0;
  for (int64_t a = 1; a <= 1000000; a++) {
    stringstream ss;
    ss << a << a;
    istringstream iss(ss.str());
    int64_t c;
    iss >> c;
    if (c <= b) {
      answer++;
    }
  }
  cout << answer << endl;
}

int main() {
  int64_t b;
  cin >> b;
  solve(b);
  return 0;
}

#pragma region template

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vld = vector<ld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
constexpr ll inf = 3001001000100100100LL;
#define endl '\n'

// clang-format off
#define _overload(_1, _2, _3, name, ...) name
#define  rep(...) _overload(__VA_ARGS__,  _rep,  _rep2,)(__VA_ARGS__)
#define repc(...) _overload(__VA_ARGS__, _repc, _repc2,)(__VA_ARGS__)
#define repr(...) _overload(__VA_ARGS__, _repr, _repr2,)(__VA_ARGS__)
#define  _rep(i,k,n) for(ll i=(k)  , i##_xxxx=(n); i < i##_xxxx; ++i)
#define _repc(i,k,n) for(ll i=(k)  , i##_xxxx=(n); i <=i##_xxxx; ++i)
#define _repr(i,k,n) for(ll i=(n-1), i##_xxxx=(k); i >=i##_xxxx; --i)
#define  _rep2(i,n)  _rep(i,0,n)
#define _repc2(i,n) _repc(i,1,n)
#define _repr2(i,n) _repr(i,0,n)
// rep [k,n)      repc[k,n]      repr[k,n)

#define all(o) begin(o), end(o)
template <typename C> ll sz(const C &c) { return static_cast<ll>(c.size()); }
template <class T> T udiv(T a, T b) {return (a + b - 1) / b;}
template <class T> T rdiv(T a, T b) {return (a + b / 2) / b;}
template <typename T, typename S> string join(const T &seq, S sep) { stringstream ss; bool f = false; for (auto c : seq) { ss << (f ? sep : "") << c; f = true;} return ss.str(); }
template <class T, class S, class... U> string join(const T &v, const S &sep, const U &...args) { stringstream ss; bool f = false; for (auto &&c : v) { if (f) ss << sep; f = true; ss << join(c, args...); } return ss.str(); }
template <typename T>               ostream &operator<<(ostream &os, const vector<T>             &v){ os << '[' << join(v, ",") << ']'; return os; }
template <typename T>               ostream &operator<<(ostream &os, const deque<T>              &v){ os << '[' << join(v, ",") << ']'; return os; }
template <typename T>               ostream &operator<<(ostream &os, const set<T>                &v){ os << '{' << join(v, ",") << '}'; return os; }
template <typename T , typename TH> ostream &operator<<(ostream &os, const unordered_set<T, TH>  &v){ os << '{' << join(v, ",") << '}'; return os; }
template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV>          &mp){ os << '{'; for (auto v : mp) os << v.first << ":" << v.second << ','; os << '}'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2>         &pa){ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
#define debug(...) _debug(__LINE__, __VA_ARGS__)

void print_args(ostream& out) { out << '\n'; }
void print() { std::cout << '\n'; }
void _debug() { std::cerr << '\n'; }
template <class S, class... T> void print_args(ostream& out,const S& a,const T&... args) { out << ' ' << a; print_args(out, args...); }
template <class S, class... T> void  print(const S& a, const T&... args) { std::cout << a; print_args(std::cout, args...); }
template <class S, class... T> void _debug(const S& a, const T&... args) { std::cerr << "(L:" << std::setw(3) << a << ")"; print_args(std::cerr, args...); }
// clang-format on

struct setup_main {
    setup_main() {
        std::cin.tie(nullptr);
        // std::ios::sync_with_stdio(false); // atcoder-toolsとの共存不可
        std::cout << fixed << setprecision(15);
    }
} setup_main_;
#pragma endregion

void solve(ll N, vector<ll> A) {
    ll ans = 0;
    vl v(401, 0);
    rep(i, N) v[A[i] + 200]++;
    rep(i1, 401) rep(i2, 401) {
        ans += v[i1] * v[i2] * (i1 - i2) * (i1 - i2);
    }
    print(ans / 2);
}

signed main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) {
        cin >> A[i];
    }
    solve(N, move(A));
}