#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int inf = 1e18;
#define D long double
#define NeedForSpeed ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
const int MOD = 1000000007;
#define fi first
#define se second
#define endl '\n'
// random_device rd;
// mt19937 rng(rd());
// int getRand(int l,int r){ // get random number in the range [l,r]
//   uniform_int_distribution<int> uid(l,r);
//   return uid(rng);
// }
const int N = 1e6 + 10;
int dp[4][3*N]={0};
int n , k ;

void filler(){
    dp[0][0] = 1;
    dp[0][1] = -1;
    for(int i = 0 ; i <= 2 ; i++){
        for(int j = 1 ; j <= 3*n ; j++)
           dp[i][j] += dp[i][j-1];
        for(int j = 0 ; j <= 3*n ; j++){
               dp[i+1][j+1] += dp[i][j];
               if(j+n+1<=3*n)dp[i+1][j+n+1] -= dp[i][j];
        }
    }
    for(int j = 1 ; j <= 3*n ; j++)
        dp[3][j] += dp[3][j-1];
}

void go(){
   cin >> n >> k ;
   filler();
   // sum
   int sum ;
   int cur = 0;
   for(sum = 3 ; sum <= 3*n ; sum++){
       cur += dp[3][sum];
       if(cur >= k)break;
   }
   cur -= dp[3][sum];
   k -= cur;
   // our ans has sum == ans+1
   int i , j ;
   cur = 0;
   // i
   for(i = 1 ; i <= n ; i++){
       // adding to cur -> total no of ways such that two elements sum is sum-i
       cur += dp[2][sum-i];
       if(cur >= k)break;
   }
   cur -= dp[2][sum-i];
   k -= cur;
   // now our i , fixed , sum is fixed , we will search for j
   cur = 0;
   for(j = 1; j <= n ; j++){
       // adding to cur -> total no of ways such that 1 elements sum is sum-i-j
       cur += dp[1][sum-i-j];
       if(cur >= k)break;
   }
   cur -= dp[1][sum-i-j];
   k -= cur;
   cout << i << " " << j << " " << (sum-(i+j)) << endl;
}

signed main() {
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        NeedForSpeed
        int t = 1;
        // cin >> t;
        while(t--){
            // cout << "Case #" << cases << ": ";
            go();
        }

}

#define MOD_TYPE 1

#pragma region Macros

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

#if 0
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
#endif
#if 0
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-9;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

struct io_init
{
  io_init()
  {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(30) << setiosflags(ios::fixed);
  };
} io_init;
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

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

void solve()
{
  int a, b;
  cin >> a >> b;
  vector<ll> v;
  if (a >= b)
  {
    rep(i, a)
    {
      v.push_back(2 * i + 2);
    }
    rep(i, b - 1)
    {
      v.push_back(-(2 * i + 1));
    }
    ll sum = accumulate(all(v), 0LL);
    v.push_back(-sum);
  }
  else
  {
    rep(i, a - 1)
    {
      v.push_back(2 * i + 1);
    }
    rep(i, b)
    {
      v.push_back(-(2 * i + 2));
    }
    ll sum = accumulate(all(v), 0LL);
    v.push_back(-sum);
  }
  rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : " ");
}

int main()
{
  solve();
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define tc int tt;cin >> tt;for (int ti = 1; ti <= tt; ti++)
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ranked_pairset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ranked_set;

int main() {
    int x, y;
    cin >> x >> y;
    if (x == y)
        cout << x;
    else
        cout << 3 - x - y;
}

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

int main() {
  int x, y;
  cin >> x >> y;
  int answer;
  if (x == y) answer = x;
  else if (x == 0 && y == 1) answer = 2;
  else if (x == 1 && y == 0) answer = 2;
  else if (x == 1 && y == 2) answer = 0;
  else if (x == 2 && y == 1) answer = 0;
  else if (x == 0 && y == 2) answer = 1;
  else if (x == 2 && y == 0) answer = 1;

  cout << answer;
}


#include<bits/stdc++.h>
#define int long long
#define N 300005
using namespace std;
int n,ans,a[N],b[N],tot;
signed main(){
	cin>>n,ans=n*(n-1)/2;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++){
		if(a[i]==a[i-1])b[tot]++;
		else b[++tot]=1;
	}
	for(int i=1;i<=tot;i++)ans-=b[i]*(b[i]-1)/2;
	cout<<ans<<endl;
	return 0;
}

//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#define int long long
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define a first
#define b second
#define fi first
#define sc second
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())

#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}

template<class t> using vc=vector<t>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.fi<<","<<p.sc<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
int n;
typedef long double ld;
ld a[2], b[2];
void solve(){
	cin >> n;
	rep(i, 2) cin >> a[i];
	rep(i, 2) cin >> b[i];

	ld cx = (a[0] + b[0]) / 2, cy = (a[1] + b[1]) /2;
	ld deg = atan2(a[1] - cy, a[0] - cx);
	deg += 2.0L * acos(-1.0L) / (ld)(n);
	ld len = (a[0]-cx)*(a[0]-cx) + (a[1]-cy)*(a[1]-cy);
	len = sqrt(len);
	cout << cx + len * cos(deg) << " " << cy + len * sin(deg) << '\n';
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	int t; t = 1; //cin >> t;
	while(t--) solve();
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for (int i = 0; i < (int)(n) ; i++)
#define rep2(i,a,b) for (int i = (a); i < (int)(b); i++)
#define repR(i,n) for (int i = (int)(n)-1; i >= 0; i--)
#define ENDL '\n'
#define pb push_back
#define SIZE(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define UNIQUE(a) a.erase(unique(all(a)),a.end());
#define fi first
#define se second
#define debug(x) cout<<(#x)<<" is : "<<x<<endl;
#define debugc(vec) {cout<<(#vec)<<" is below; ---"<<endl;for(auto c:vec)cout<<c<<" ";cout<<endl<<"----------------"<<endl;}
const int INF = 1'073'741'823;
const ll INFLL = 4'611'686'018'427'387'903LL;
const ld PI = 3.14159265358979323846L;

int main() {
    ll n; cin>>n;
    map<ll, pair<ll,ll>> mp;
    rep(i, n) {
        ll a,b;
        cin>>a>>b;
        if(mp.count(b)) {
            auto& [mn, mx] = mp[b];
            mn=min(mn, a);
            mx=max(mx, a);
        }
        else mp[b] = {a,a};
    }
    vector<pair<ll,ll>> vec;
    ll ans=0;
    for(auto [a,b]:mp) {
        vec.pb(b); //vec.size()==m
        ans += b.se-b.fi;
    }
    ll m=mp.size();
    vector<vector<ll>> dp(m,vector<ll>(2,0));

    rep(i, m) {
        if(i==0) {
            dp[i][0] = abs(vec[i].fi);
            dp[i][1] = abs(vec[i].se);
        }
        else {
            dp[i][0] = min(dp[i-1][0]+abs(vec[i].fi-vec[i-1].se),dp[i-1][1]+abs(vec[i].fi-vec[i-1].fi));
            dp[i][1] = min(dp[i-1][0]+abs(vec[i].se-vec[i-1].se),dp[i-1][1]+abs(vec[i].se-vec[i-1].fi));
        }
    }
    cout << ans + min(dp[m-1][0]+abs(vec[m-1].se), dp[m-1][1]+abs(vec[m-1].fi)) << endl;
}

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

int main()
{
    size_t N;
    cin >> N;

    vector<long long> X(N);
    vector<size_t> C(N);
    vector<vector<long long>> ball(N + 1);
    for (size_t i = 0; i < N; i++)
    {
        cin >> X[i] >> C[i];
        ball[C[i]].push_back(X[i]);
    }

    // dp[i] := (the most left ans, the most left index)
    // ep[i] := (the most right ans, the most right index)
    vector<pair<long long, long long>> dp(N + 1);
    vector<pair<long long, long long>> ep(N + 1);
    dp[0] = make_pair(0ll, 0ll);
    ep[0] = make_pair(0ll, 0ll);
    for (size_t i = 1; i <= N; i++)
    {
        if (ball[i].empty())
        {
            dp[i] = dp[i - 1];
            ep[i] = ep[i - 1];
            continue;
        }
        sort(ball[i].begin(), ball[i].end());
        dp[i] = make_pair(
            min(
                dp[i - 1].first + abs(dp[i - 1].second - ball[i].back()) + abs(ball[i].back() - ball[i].front()),
                ep[i - 1].first + abs(ep[i - 1].second - ball[i].back()) + abs(ball[i].back() - ball[i].front())),
            ball[i].front());
        ep[i] = make_pair(
            min(
                dp[i - 1].first + abs(dp[i - 1].second - ball[i].front()) + abs(ball[i].front() - ball[i].back()),
                ep[i - 1].first + abs(ep[i - 1].second - ball[i].front()) + abs(ball[i].front() - ball[i].back())),
            ball[i].back());
    }
    cout << min(dp.back().first + abs(dp.back().second), ep.back().first + abs(ep.back().second)) << endl;
}


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

int main(){
  int n;
  cin>>n;
  for (int i=0;i<n;i++){
    printf("%d %d\n",(i*2)%n+1,(i*2+1)%n+1);
  }
  return 0;
}

#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<bitset>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();++itr)
#define pb push_back
#define mk make_pair
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define spln(i,n) (i==n?'\n':' ')
#define fac_init(n){fac[0]=fac[1]=inv[1]=fi[0]=fi[1]=1;fz(i,2,n){fac[i]=1ll*fac[i-1]*i%mod;inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;fi[i]=1ll*fi[i-1]*inv[i]%mod;}}
using namespace std;
inline void read(int &x)
{
	char c;int f=1;
	while(!isdigit(c=getchar()))if(c=='-')f=-1;
	x=(c&15);while(isdigit(c=getchar()))x=(x<<1)+(x<<3)+(c&15);
	x*=f;
}
int n,m,i,j;
int main()
{
	read(n);
	fz1(i,n){
		printf("%d %d\n",i*2%n+1,(i*2-1)%n+1);
	}
	return 0;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

signed main() {
	int n;
	cin >> n;
	cout << n - 1 << endl;

	return 0;
}


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

#define INF 1000000000
#define MAXK 100010

long long k;
char s[6], t[6];

long long qt[10];
long long pow10[6];

void create_pow10() {
    long long i;
    pow10[0]=1;
    for (i=1; i<=5; i++) {
        pow10[i]=pow10[i-1]*10;
    }
}

bool go() {
    long long aux[10];
    long long i;

    memset(aux, 0, sizeof(aux));
    for (i=1; i<=5; i++) {
        aux[s[i]]++;
    }
    long long score_s = 0;
    for (i=1; i<=9; i++) {
        score_s += i*pow10[aux[i]];
    }

    memset(aux, 0, sizeof(aux));
    for (i=1; i<=5; i++) {
        aux[t[i]]++;
    }
    long long score_t = 0;
    for (i=1; i<=9; i++) {
        score_t += i*pow10[aux[i]];
    }

    if (score_s>score_t) {
        return true;
    }
    else {
        return false;
    }
}

int main() {
    create_pow10();
    scanf("%lld", &k);
    scanf("%s", s+1);
    scanf("%s", t+1);

    long long i, j;

    for (i=0; i<=9; i++) {
        qt[i]=k;
    }

    for (i=1; i<=4; i++) {
        s[i]=s[i]-'0';
        t[i]=t[i]-'0';
        qt[s[i]]--;
        qt[t[i]]--;
    }

    double sum_num = 0;
    double sum_den = 0;
    for (i=1; i<=9; i++) {
        for (j=1; j<=9; j++) {
            if (i!=j && qt[i]>0 && qt[j]>0) {
                s[5]=i;
                t[5]=j;
                sum_den += qt[i]*qt[j];
                if (go()==true) {
                    sum_num += qt[i]*qt[j];
                }
            }
            else if (i==j && qt[i]>1) {
                s[5]=i;
                t[5]=i;
                sum_den += qt[i]*(qt[i]-1);
                if (go()==true) {
                    sum_num += qt[i]*(qt[i]-1);
                }
            }
        }
    }

    double ans = sum_num/sum_den;

    printf("%.16lf\n", ans);

    return 0;
}

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

typedef long long ll;

#define F0R(i, x, y) for (int i = x; i < y; i++)
#define FOR(i, n) F0R(i, 0, n)
#define F0RD(i, x, y) for (int i = y - 1; i >= x; i--)
#define FORD(i, n) F0RD(i, 0, n)

#define F first
#define S second

int mp(int x, int c) {
    return 1000 * c + x;
}

vector<int> adj[2005];
bool vis[2005];

void dfs(int v) {
    vis[v] = true;
    for (int to : adj[v]) {
        if (!vis[to]) dfs(to);
    }
}

int main() {
#ifdef mikey
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin >> n >> m;
    auto ad = [&] (int a, int b, int c, int d) {
        adj[mp(a, b)].push_back(mp(c, d));
        adj[mp(c, d)].push_back(mp(a, b));
    };
    auto add = [&] (int a, int b, int c, int d) {
        adj[mp(a, b)].push_back(mp(c, d));
    };
    FOR(i, m) add(i, 1, 0, 0);
    FOR(i, m) add(i, 1, n - 1, 0);
    FOR(i, n) add(i, 0, 0, 1);
    FOR(i, n) add(i, 0, m - 1, 1);
    FOR(i, n) {
        string s; cin >> s;
        FOR(j, m) {
            if (s[j] == '#') {
                ad(i, 0, j , 1);
            }
        }
    }
    int rcc = 0;
    FOR(i, n) {
        if (!vis[mp(i, 0)]) {
            dfs(mp(i, 0));
            ++rcc;
        }
    }
    memset(vis, false, sizeof(vis));
    int ccc = 0;
    FOR(i, m) {
        if (!vis[mp(i, 1)]) {
            dfs(mp(i, 1));
            ++ccc;
        }
    }
    cout << min(rcc - 1, ccc - 1) << '\n';
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin, n, m;
    vector<int> a(m), b(m);
    rep(i, 0, m) {
        cin, a[i], b[i];
        a[i]--;
        b[i]--;
    }
    vector<int> c(n);
    rep(i, 0, n) {
        cin, c[i];
    }
    vector<P> ans(m, P{-1, -1});
    vector<vector<P>> g(n);
    rep(i, 0, m) {
        int ai = a[i], bi = b[i];
        if (c[ai] < c[bi]) {
            ans[i] = {bi, ai};
        } else if (c[ai] > c[bi]) {
            ans[i] = {ai, bi};
        } else {
            g[ai].emplace_back(bi, i);
            g[bi].emplace_back(ai, i);
        }
    }

    vector<bool> used(n, false);
    auto rec = [&](auto &f, int v, int p) -> void {
        if (used[v]) return;
        used[v] = true;
        for (auto [nxt, idx] : g[v]) {
            if (nxt == p) continue;
            if (ans[idx].first == -1) {
                dump(idx, v, nxt);
                ans[idx] = {v, nxt};
            }
            f(f, nxt, v);
        }
    };
    rep(i, 0, n) {
        if (!used[i]) {
            rec(rec, i, -1);
        }
    }

    rep(i, 0, m) {
        int ai = a[i];
        auto [x, y] = ans[i];
        if (ai == x) {
            print("->");
        } else {
            print("<-");
        }
    }
    return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define lui long unsigned int

const int N =3e5+5;
const int MOD = 1e9+7;
const ll M = 1e18;

ll qpow(ll a, ll b, ll m)
{
    ll  ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int n,m;
int c[101];
vector<vector<int>>adj;
map<pii,int>edge;
vector<int>ans;
bool vis[100+1];
int tin[101], low[101];

void dfs(int v, int par){
    vis[v] = true;
    tin[v] = tin[par] + 1;
    low[v] = tin[v];

    for(int u: adj[v]){
        if(u==par || (tin[u]>tin[v]))
          continue;

        if(vis[u]){
            low[v] = min(tin[u], low[v]);
        }
        else{
            dfs(u, v);
        }
        low[v] = min(low[u], low[v]);

        if(edge[{v, u}]){
            ans[edge[{v, u}]]  = 1;
        }
        else{
            ans[edge[{u, v}]] = 2;
        }
    }
}

int main()
{
	IOS;

	int t=1; //cin>>t;
	while(t--){
	   cin>>n>>m;
	   adj.resize(n+1);
	   ans.resize(m+1);

	   int a[m+1],b[m+1];
	   for(int i=1;i<=m;i++){
	       cin>>a[i]>>b[i];
	   }
	   for(int i=1;i<=n;i++) cin>>c[i];

	   for(int i=1;i<=m;i++){
	       if(c[a[i]] > c[b[i]]) ans[i] = 1;
	       else if(c[a[i]] < c[b[i]]) ans[i] = 2;
	       else{
	           adj[a[i]].push_back(b[i]);
	           adj[b[i]].push_back(a[i]);
	           edge[{a[i], b[i]}] = i;
	       }
	   }

	   for(int i=1;i<=n;i++){
	       if(!vis[i]){
	           dfs(i, 0);
	       }
	   }
	   for(int i=1;i<=m;i++){
	       if(ans[i]==1) cout<<"->\n";
	       else cout<<"<-\n";
	   }
	   //cout<<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() {
    ll n; cin >> n;
    vector<ll> a(n), b(n);
    priority_queue<ll> aa;
    rep(i, n) {
        cin >> a[i];

    }

    rep(i, n) {
        cin >> b[i];
    }

    vector<ll> suma(n+1);
    suma[0] = 0;
    for(int i = 0; i < n; i++) {
        suma[i+1] = suma[i]+a[i];
    }

    ll ans = 0;
    rep(i, n) {
        aa.push(a[i]);
        if(i == 0) {
            ans = a[i]*b[i];
        } else {
            ans = max(ans, aa.top()*b[i]);
        }

        cout << ans << endl;
    }
}

int main()
{
    solve1();
}

// solution for agc048b
// author : lynmisakura
#include<bits/stdc++.h>
using namespace std;

using ll = long long;

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);

  int n;cin >> n;
  vector<long long> a(n),b(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    a[i] -= b[i];
    ans += b[i];
  }

  vector<long long> odd,even;
  for (int i = 0; i < n; i++) {
    if(i % 2 == 0) odd.push_back(a[i]);
    else even.push_back(a[i]);
  }

  sort(odd.rbegin(),odd.rend());
  sort(even.rbegin(),even.rend());

  vector<long long> c(n/2+1,0);
  for (int i = 0; i < n/2; i++) {
    c[i + 1] = c[i] + (odd[i] + even[i]);
  }

  ans += *max_element(c.begin(),c.end());

  cout << ans << '\n';

  return 0;
}


#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx2")
// 293206GT
#include <array>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <climits>
#include <limits>
#include <set>
#include <map>
#include <queue>
//#include <unordered_map>
//#include <unordered_set>
//#include <unordered_set>
//#include <stack>
#include <string>
#include <algorithm>
#include <random>
#include <bitset>
#include <chrono>
//#include <cstdlib>
//#include <cstring>

// #include <bits/extc++.h>
// using namespace __gnu_pbds;
//template<class T>
//using OrderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
#define int ll
// #define int long long
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) ((x) * (x))
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
#define ts to_string
#define sts string ts

sts(string s) { return s; }

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

sts(char c) { return string(1, c); }

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

template<class A, class B>
sts(pair<A, B>);

template<class T>
sts(T v) {
    string s = "{", sep = "";
    for (auto x : v) {
        s += sep;
        sep = ", ";
        s += ts(x);
    }
    return s + "}";
}

template<class A, class B>
sts(pair<A, B> p) { return "(" + ts(p.first) + ", " + ts(p.second) + ")"; }

void dbgPrint() { cerr << endl; }

template<class A, class... B>
void dbgPrint(A a, B... b) {
    cerr << ' ' << ts(a);
    dbgPrint(b...);
}

#ifdef LOCAL
#define dbg(...) cerr << "line #" << __LINE__ << " [" << #__VA_ARGS__ << "]:", dbgPrint(__VA_ARGS__)
#else
#define dbg(...)
#endif

#define sz(a) (int) (a).size()
#define len(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define eb emplace_back
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define asd(n) rep(i, 0, n)
#define jkl(n) rep(j, 0, n)
#define UB upper_bound
#define LB lower_bound
#define mp make_pair
namespace IO {

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a);

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a);

    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> a) {
        for (pair<A, B> x : a)
            out << x.first << " " << x.second << '\n';
        return out;
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> a) {
        for (A x : a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x : a) in >> x;
        return in;
    }
}  // namespace IO

template<class A, class B>
inline int chkmax(A &a, B b) {
    if (a < (A) b) {
        a = (A) b;
        return 1;
    }
    return 0;
}

template<class A, class B>
inline int chkmin(A &a, B b) {
    if (a > (A) b) {
        a = (A) b;
        return 1;
    }
    return 0;
}

using namespace IO;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve();

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(41);
    int q = 1;
    // cin >> q;
    while (q--) solve();
}

void solve() {
    int n;
    cin >> n;
    int s = 0;
    int cur = 1;
    while (s < n) {
        s += cur;
        ++cur;
    }
    put(cur - 1);
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 1000000007
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define bs(yup,x) binary_search(yup.begin(),yup.end(),x) //it will return bollean value
#define lb(yup,x) lower_bound(yup.begin(),yup.end(),x)  //it will return the adress of the number which is equal to or just greater than x ,and if it is equal to yup.end() than their in no such number exist
#define ub(yup,x) upper_bound(yup.begin(),yup.end(),x)
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
using namespace std;
const long long N=262144, INF=2000000000000000000;
const long double EPS= 0.000000000001;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order_set;

//order_of_key(x) --> will return number of numbers that are strictly less than x in set
//find_by_order(x) --> will return (x+1)th element in the set
//both are log(n) time

int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
vi prime;
bool isprime[N];
void pre()
{
    for(int i=2;i<N;i++)
    {
        if(isprime[i])
        {
            for(int j=i*i;j<N;j+=i)
            isprime[j]=false;
            prime.pb(i);
        }
    }
    return;
}
/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
 */

int32_t main()
{
    IOS;
    //fill(isprime, true);
    //pre();
    int wertt=1;
    //cin>>wertt;
    for(int pppp=1;pppp<=wertt;pppp++)
    {
        int n;
        cin>>n;
        long double a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        long double x=(a[n/2]/2.0);
        long double ans=0;
        for(int i=0;i<n;i++)
        {
            ans+=(x+a[i]-min(x+x,a[i]));
        }
        ans=ans/((long double)(n));
        cout<<fixed << setprecision(15)<<ans;
    }
}


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

typedef long long  ll;
ll t,n;
int main(){
    cin>>t>>n;
   ll ans=(n*100+t-1)/t+n-1;
    cout<<ans;
}

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
const int inf=1e9;
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> orderedMultiset;
int solve()
{
	int n,x;
	cin>>n>>x;
	for(int i=0;i<n;i++){
		int y;
		cin>>y;
		if(y==x)
			continue;
		cout<<y<<" ";
	}
	cout<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node {
  int v, p;
} a[1003];
int main() {
  int n, x;
  cin >> n >> x;
  for (int i = 0; i < n; i++) cin >> a[i].v >> a[i].p;
  int intake = 0;
  for (int i = 0; i < n; i++) {
    intake = intake + a[i].v * a[i].p;
    if (intake > x * 100) {
      cout << i + 1 << endl;
      break;
    }
  }
  if (intake <= x * 100) cout << -1 << endl;
  return 0;
}

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  int t[n][n];
  REP(i,n) REP(j,n) cin >> t[i][j];

  // REP(i,n) REP(j,n) cout <<  t[i][j] << " ";
  int ans = 0;
    vector<int> one_case;
    for (int i = 1; i < n; i++) { // one_case = {0,1,2,3,...n-1} とする
        one_case.emplace_back(i);
    }

    do {
        int pre = 0;
        int now = 0;
        int sum = 0;
        for (auto x : one_case) {
            //cout << x << " ";
            now = x;
            sum += t[pre][now];
            pre = now;
        }
        sum += t[pre][0];
        //cout << sum << endl;
        if(sum == k) ans++;
    } while (next_permutation(one_case.begin(), one_case.end()));
    // 順列の最後になるまで one_case を並び替えながらループ

    cout << ans << endl;

  return 0;
}


#include <iostream>

#include<vector>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<utility>

#include<cstdio>

#include<cstring>

#include<stack>

#include<queue>

#include<map>

#include<iomanip>

#define vii vector< pair<int,int> >

#define vi vector<int>

#define INF 1000000007

#define MS 1000001

#define endl "\n"

#define ff first

#define ss second

#define lli long long int

#define ulli unsigned long long int

using namespace std;

int main() {

 ios_base::sync_with_stdio(false);

    cin.tie(NULL);

   int a,b;

   cin>>a>>b;

   cout<<abs(2*a+100-b)<<endl;

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
#define mkunique(a) a.resize(unique(a.begin(),a.end())-a.begin());
const ll mod=1e9+7;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    ll a,b;
    cin>>b>>a;
    cout<<max(0ll,2*b+100-a);

    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}


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

typedef long long ll;

int main(){

    ll N, W;
    cin >> N >> W;
    vector<ll> C(200000);
    ll total = 0;
    int flag = 0;

    for(ll i = 0; i < 200000; i++){
        C.at(i) = 0;
    }

    ll S, T, P;

    for(ll i = 0; i < N; i++){
        cin >> S >> T >> P;
        C.at(S) += P;
        if(T < 200000){
            C.at(T) -= P;
        }
    }

    for(ll i = 0; i < 200000; i++){
        total += C.at(i);
        if(total > W){
            flag = 1;
            break;
        }
    }

    if(flag == 1){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)

int main()
{
    ll N, K, M, tmp, sum = 0., ans;
    cin >> N >> K >> M;
    repi(i, N-1, 0)
    {
        cin >> tmp;
        sum += tmp;
    }
    ans = max(0LL,M * N - sum);
    if (ans <= K)
    {
        cout << ans << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front

typedef long long ll;
typedef unsigned long long ull;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int nMax = 1e6+5;
const ll mod = 1e9+7;

ll n,sum;

ll hitung(ll x, ll y) {
	ll ans = 0;
	if (y & 1)
		ans = ((y+1) / 2) * y;
	else
		ans = (y / 2) * (y + 1);

	x--;
	if (x & 1)
		ans -= ((x+1) / 2) * x;
	else
		ans -= (x / 2) * (x + 1);

	return ans;
}
bool binser(ll num) {
	ll l = 1, r = n/num + 1;
	while(l <= r) {
		ll mid = (l+r)/2;
		ll total = hitung(mid,mid+num-1);

		if (total == n)
			return 1;
		else if (total > n)
			r = mid-1;
		else
			l = mid+1;
	}
	return 0;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> n;
	sum = 0;
	for (ll i=1;i<=1e7;i++) {
		if (binser(i)) {
			sum += 2;
		}
	}
	cout << sum << "\n";
	return 0;

}

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

int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  for(long long i = 1; i * i < n*2+1; i++){
    if (n % i == 0){
      if (i % 2 == 1) ans++;
    }
    if (2 * n % i == 0)
      if (n % i != 0)
        ans++;
  }
  cout << ans * 2 << endl;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int n, len, sum = 0;
    map < int, int > haha;
    string str;
    cin >> str;
    len = str.size();
    for(auto &a : str){
        n = (a - '0') % 3;
        haha[n]++;
        sum += n;
    }
    sum = sum - ((sum / 3) * 3);
    if(sum % 3 == 0)
        cout << 0 << "\n";
    else if(sum % 3 == 2 && len > 1 && haha[2] >= 1)
        cout << 1 << "\n";
    else if(sum % 3 == 2 && len > 2 && haha[1] >= 2)
        cout << 2 << "\n";
    else if(sum % 3 == 1 && len > 1 && haha[1] >= 1)
        cout << 1 << "\n";
    else if(sum % 3 == 1 && len > 2 && haha[2] >= 2)
        cout << 2 << "\n";
    else
        cout << "-1\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main () {
  int N=0;
  cin >> N;
  int an;
  an=N%2;
  if (an==1){
    cout << "Black" << endl;
  }
  if (an==0){
    cout << "White" << endl;
  }
}


#include <bits/stdc++.h>
#define ll long long
#define endl "\n"

#define spacex ios_base::sync_with_stdio(false);cin.tie(NULL)

using namespace std;

long long int score(string temp)
{
    vector<long long int> cnt(10,0);

    // iota(cnt.begin(),cnt.end(),0);
    // that is, it will assign or make increasing vector by +1
    // 0,1,2,3,4,5,6,7,8,9
    for(long long int i=0;i<10;i++)
    {
        cnt[i]=i;
    }
    for(char x:temp)
    {
        cnt[x-'0']*=10;
    }
    return accumulate(cnt.begin(),cnt.end(),0);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    freopen("o.txt", "w", stdout);
    #endif
    spacex;

    int k;
    cin>>k;
    string s,t;
    cin>>s>>t;
    vector<long long int> count(10,k);
    for(int i=0;i<4;i++)
    {
        count[s[i]-'0']--;
    }
    for(int i=0;i<4;i++)
    {
        count[t[i]-'0']--;
    }
    long long int win=0;
    for(int i=1;i<=9;i++)
    {
        for(int j=1;j<=9;j++)
        {
            s.back()='0'+i;
            t.back()='0'+j;

            if(score(s)<=score(t))
            {
                continue;
            }
            else
            {
                win+=(count[i]*(count[j]-(i==j)));
            }
        }
    }

    const ll rem = 9 * k - 8;
    cout << double(win) / rem / (rem - 1) << endl;

    return 0;
}


#include <cstdio>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <sstream>
#include <ostream>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <iomanip>
#include <set>
#include <bitset>
#define INT_MINs -2000000000
#define INT_MAXs 1000000001
#define MID int mid=(l+r)/2
#define REP1(i,x,y) for(int i=x;i<y;i++)
#define REP2(i,x,y) for(int i=x;i<=y;i++)
#define ls (2*k)
#define rs (2*k+1)
#define lson l,mid,2*k
#define rson mid+1,r,2*k+1
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define IOS ios::sync_with_stdio(0);
#define pb(a) push_back(a)
#define pi acos(-1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod=1000000007;
const ll ba=131;
ll qk(ll x,ll y){ll ans=1;while(y){if(y&1) ans=ans*x%mod;y>>=1;x=x*x%mod;}return ans;}
const int dx[8] = { 0,-1,0,1,-1,-1,1,1}, dy[8] = { -1,0,1,0,-1,1,-1,1};
const int dxx[8]= {2,1,-1,-2,-2,-1, 1, 2},dyy[8]= {1,2,2,1, -1,-2,-2,-1};
int a[200005],b[200005];
ll c[200005];
int d[400005];
ll num[400005];
int cnt;
void solve()
{
    int n;
    ll m;
    scanf("%d%lld",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d%d%lld",&a[i],&b[i],&c[i]);
        d[++cnt]=a[i];
        d[++cnt]=b[i]+1;
    }
    sort(d+1,d+1+cnt);
    cnt=unique(d+1,d+1+cnt)-(d+1);
    //printf("%d\n",cnt);
    for(int i=1;i<=n;i++){
        int l=lower_bound(d+1,d+1+cnt,a[i])-d;
        int r=lower_bound(d+1,d+1+cnt,b[i]+1)-d;
        num[l]+=c[i];
        num[r]-=c[i];
    }
    ll sum=0;
    for(int i=1;i<=cnt;i++){
        num[i]+=num[i-1];
        if(m<=num[i]){
            sum+=m*1ll*(d[i+1]-d[i]);
        }else{
            sum+=num[i]*1ll*(d[i+1]-d[i]);
        }
    }
    printf("%lld\n",sum);
}
int main()
{
    //IOS;
    solve();
    return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i:x){cout << i << " ";} cout << endl;}
#define isin(x,l,r) ((l)<=(x) && (x)<(r))
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<typename T>bool chmin(T&x,const T&y) {if(x>y){x=y;return true;} else return false;}
template<typename T>bool chmax(T&x,const T&y) {if(x<y){x=y;return true;} else return false;}

int main() {
    ll N, C;
    cin >> N >> C;
    vector<pii> event;
    rep(i, N) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        event.emplace_back(a, c);
        event.emplace_back(b+1, -c);
    }
    sort(event.begin(), event.end());
    ll ans = 0, temp = 0, now = 0;
    for (auto [day, cost] : event) {
        if (day != now) {
            ans += min(C, temp) * (day - now);
            temp += cost;
            now = day;
        } else temp += cost;
    }
    cout << ans << '\n';
    return 0;
}


#include <iostream>
using namespace std;

int main(){
  double  a,b,c,d;

  cin>>a>>b>>c>>d;

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

#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int a[4];
    for(int i = 0; i < 4; ++i) cin >> a[i];
    for(int i = 1; i < 16; ++i) {
        int s = 0, t = 0;
        for(int j = 0; j < 4; ++j) {
            if((i >> j) & 1) s += a[j];
            else t += a[j];
        }
        if(s == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define BOOM ios_base::sync_with_stdio(false);cin.tie(NULL);cout<<setprecision(10);
#define NEWLINE cout<<'\n';
#define ll long long
#define pb push_back
#define all(v) v.begin(), v.end()
#define MOD  1000000007
#define mod  998244353
#define ff first
#define ss second
#define mset(a,b) memset(a, b, sizeof(a))
using namespace std;
#define MAXN 100005

int fastscan()
{
	bool negative = false;
	register int c;
	int number = 0;
	for(c = getchar(); !(c>47 && c<58) && c!= '-'; c= getchar());
	if (c=='-')  c = getchar(), negative = true;
	for (; (c>47 && c<58); c=getchar())  number = (number<<1) + (number<<3) + (c ^ 48);
	if (negative) return -number;
	return number;
}
int gcd(int a, int b) { if(!b) return a; return gcd(b,a%b); }
//LARGE POWERS
ll power(long long x, long long y, long long p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0){
		if (y & 1)  res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
	}
	return res;
}
struct HASH {
    static uint64_t splitmix64(uint64_t x)  {
        x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);
    }
};
int N;
bool sortbyff(const pair<int,int> &a, const pair<int,int> &b)  {
    if(a.ff!=b.ff)  return (a.ff<b.ff);
    return (abs(N - a.ss) > abs(N - b.ss));
}
int main()
{
	BOOM
	int  _=1, n, m, k, l=0, r=0, b, c, i, j, tt=1, t, sum=0,x,y,z=1;
	bool flag=0;
	// string s,ss;
	// tt = fastscan();
	// cin>>tt;
	// while(tt--){
	for(_=1;_<=tt;_++) {
		// int q;
		cin>>N>>m;
		// for(i=0;i<n;i++) cin>>a[i];
		int cur=0, sum=0, ans=0;
		pair<int,int> a[m];
		for(i=0;i<m;i++) cin>>a[i].ff>>a[i].ss;
			sort(a, a+m, sortbyff);
		// if(a[0].ff == n && )
		// cout<<"a = \n"; for(auto i:a) cout<<i.ff<<' '<<i.ss<<'\n'; NEWLINE
		unordered_map<int,pair<int,int>,HASH> w;
		set<int> s;
		s.insert(N); w[N] = {INT_MAX,0};
			// cout<<"set = "; for(int j:s) cout<<j<<' '; NEWLINE
		std::vector<int> v;
		for(i=0;i<m;i++) {
			if (s.count(a[i].ss - 1) > 0 && w.find(a[i].ss - 1) != w.end() && (w[a[i].ss - 1].ff < a[i].ff || w[a[i].ss - 1].ss < a[i].ff) ||
				s.count(a[i].ss + 1) > 0 && w.find(a[i].ss + 1) != w.end() && (w[a[i].ss + 1].ff < a[i].ff || w[a[i].ss + 1].ss < a[i].ff)) {
				s.insert(a[i].ss);
				if (w.find(a[i].ss) == w.end())
					w[a[i].ss] = { INT_MAX, a[i].ff };
				else
					w[a[i].ss] = { w[a[i].ss].ss, a[i].ff };
			}
			else
				// s.erase(a[i].ss), w.erase(a[i].ss);
				v.push_back(a[i].ss);

			if(i==n-1 || a[i+1].ff != a[i].ff)	{
				for(int x : v)
					s.erase(x), w.erase(x);
				v.clear();
			}

			// cout<<"set = "; for(int j:s) cout<<j<<' '; NEWLINE
		}
		// w.clear(); for(int i:s) w[i] = 1;
		cout<<s.size();
		// cout<<"dp = "; for(int i:dp) cout<<i<<' '; NEWLINE
		// cout<<*max_element(dp, dp+n);

		// cout<<"Case #"<<_<<": "<<ans<<'\n';
		// if(!flag)
			// cout<<-1<<'\n';
			// cout<<"YES"<<"\n";
		// else
			// cout<<"NO"<<"\n";
	}
	return 0;

}

#include <bits/stdc++.h>

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; for(int tt = 0; tt < t; ++tt)
#define sz(x) (int)(x).size()
#define sort_unique(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()));
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << " end.\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 800 + 5;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
/**
Read problem statement carefully
**/
int arr[N][N];

int n, k;
bool check(int mid, int L){
    vector<vector<int>> pre(n+1, vector<int>(n+1));
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= n; ++j)
            pre[i][j] = pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1] + (arr[i-1][j-1] >= mid);

    bool ok = 1;
    for(int i = 0; i+k <= n; ++i){
        for(int j = 0; j+k <= n; ++j){
            int res = pre[i+k][j+k] - pre[i+k][j] - pre[i][j+k] + pre[i][j];
            if(res < L) ok = 0;
        }
    }
    return ok;
}

void solve(int T){
    int n, m;
    cin >> n >> m;
    map<int, vector<int>> mp;
    for(int i = 0, x, y; i < m; ++i){
        cin >> x >> y;
        mp[x].push_back(y);
    }

    set<int> st;
    st.insert(n);
    for(auto &[x, v]: mp){
        vector<int> add;
        for(auto &y: v){
            if(st.count(y-1) || st.count(y+1))
                add.push_back(y);
        }
        for(auto &y: v) st.erase(y);
        for(auto &y: add) st.insert(y);
    }

    cout << sz(st) << "\n";
}

int main()
{
    Fast;
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // louisfghbvc
        solve(1);
    return 0;
}

/**
Enjoy the problem.
**/


#include <iostream>
#include <vector>
#include <math.h>
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

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; }

int main() {
    long long l;
    cin >> l;
    long long sa = l - 1;
    long long ans = 1;
    for(int i = 1; i <= 11; i++){
        ans *= sa;
        ans /= i;
        sa--;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
#define ll long long
#define M 1000000007
using namespace std;
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(0);
   srand(chrono::high_resolution_clock::now().time_since_epoch().count());
   int n;
   cin>>n;
   float res = 1.08*n;
   res = round(res);
  // cout<<res<<"\n";
   if(res<206)
     cout<<"Yay!"<<"\n";
   else if(res==206.0)
    cout<<"so-so"<<"\n";
   else
    cout<<":("<<"\n";
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,j,n) for(int i=j;i<n;i++)
#define readvec(v,n) for(int i=0;i<n;i++){cin>>v[i];}
#define MOD 1000000007
int n,m;
vector<vector<int>> v;
vector<vector<int>> dp;
int rec(int i,int j)
{
  if(dp[i][j]!=INT_MIN)return dp[i][j];
  int a=INT_MIN,b=INT_MIN;
  if(i+1<n)a=rec(i+1,j);
  if(j+1<m)b=rec(i,j+1);
  dp[i][j]=v[i][j]-max(a,b);
  return dp[i][j];
}
int main()
{
  cin>>n>>m;
  v = vector<vector<int>>(n,vector<int>(m,0));
  dp = vector<vector<int>>(n,vector<int>(m,INT_MIN));
  rep(i,0,n)rep(j,0,m){char ch;cin>>ch;if(ch=='-')v[i][j]=-1; else v[i][j]=1;}
  dp[n-1][m-1] = v[n-1][m-1];
  int ans = v[0][0]-rec(0,0);
  //cout<<ans;
  if(ans<0)cout<<"Aoki\n"; else if(ans>0)cout<<"Takahashi\n"; else cout<<"Draw\n";
  return 0;
}

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int INT_MAX_SQRT = sqrt(INT_MAX);
int pwi(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    int tmp = pwi(x, p / 2);
    if (tmp > INT_MAX_SQRT) return 0;  // overflow
    if (p % 2 == 0)
        return tmp * tmp;
    else
        return tmp * tmp * x;
}

long LONG_MAX_SQRT = sqrt(LONG_MAX);
long pwl(long x, long p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    long tmp = pwl(x, p / 2);
    if (tmp > LONG_MAX_SQRT) return 0;  // overflow
    if (p % 2 == 0)
        return tmp * tmp;
    else
        return tmp * tmp * x;
}

map<long, long> factorization(long N) {
    map<long, long> res;
    long SQRT_N = ceil(sqrt(N));
    for (long i = 2; i < SQRT_N; i++) {
        while (N % i == 0) {
            if (res.find(i) == res.end()) {
                res[i] = 1;
            } else {
                res[i] += 1;
            }
            N /= i;
        }
    }
    if (N > SQRT_N) res[N] = 1;
    return res;
}

void debug_vec(string name, vector<int> vec) {
    cout << name << endl;
    for (auto e: vec) cout << e << endl;
}

void debug_vec(string name, vector<long> vec) {
    cout << name << endl;
    for (auto e: vec) cout << e << endl;
}

void debug_mat(string name, vector<vector<long>> mat) {
    cout << name << endl;
    for (auto vec: mat) {
        for (auto e: vec) cout << e << "   ";
        cout << endl;
    }
}

int tonum(string s, vector<char> c, vector<int> v) {
    int ans = 0;
    for (int n = 0; n < c.size(); n++) {
        int i = distance(c.begin(), find(c.begin(), c.end(), s[n]));
        ans = ans * 10 + v[i];
    }
    return ans;
}

void ppp(string s, vector<char> c, vector<int> v) {
    for (int n = 0; n < c.size(); n++) {
        int i = distance(c.begin(), find(c.begin(), c.end(), s[n]));
        cout << v[i];
    }
    cout << endl;
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> grid(H), dp(H);
    for (int h = 0; h < H; h++) {
        grid[h] = vector<int>(W);
        char c;
        for (int w = 0; w < W; w++) {
            cin >> c;
            grid[h][w] = (c == '+' ? 1 : -1) * ((h + w) % 2 == 1 ? 1 : -1);
        }
        dp[h] = vector<int>(W);
    }

    for (int w = W - 2; w >= 0; w--)
        dp[H - 1][w] = dp[H - 1][w + 1] + grid[H - 1][w + 1];

    for (int h = H - 2; h >= 0; h--) {
        dp[h][W - 1] = dp[h + 1][W - 1] + grid[h + 1][W - 1];
        for (int w = W - 2; w >= 0; w--) {
            int r = dp[h + 1][w] + grid[h + 1][w];
            int d = dp[h][w + 1] + grid[h][w + 1];
            if ((h + w) % 2 == 0)
                dp[h][w] = r > d ? r : d;
            else
                dp[h][w] = r > d ? d : r;
        }
    }

    if (dp[0][0] > 0)
        cout << "Takahashi" << endl;
    else if (dp[0][0] < 0)
        cout << "Aoki" << endl;
    else
        cout << "Draw" << endl;
    return 0;
}


#include <bits/stdc++.h>
/* #include <atcoder/lazysegtree> */
#include <iostream>
using namespace std;
/* using namespace atcoder; */
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (long long i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    if (v.size() == 0) return os;
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    os << v[v.size() - 1];
    return os;
}

void solve() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string tmpstr = s;
    while (k >= 1) {
        if (tmpstr.size() % 2 == 1) {
            string tmp = tmpstr;
            REP(i, tmp.size()) {
                tmpstr.push_back(tmp[i]);
            }
        }
        string newstr;
        REP(i, tmpstr.size()/2) {
            char f1 = tmpstr[2*i], f2 = tmpstr[2*i+1];
            if (f1 == f2) {
                newstr.push_back(f1);
            } else if (((f1 == 'R') && (f2 == 'S')) || ((f2 == 'R') && (f1 == 'S'))) {
                newstr.push_back('R');
            } else if (((f1 == 'P') && (f2 == 'R')) || ((f2 == 'P') && (f1 == 'R'))) {
                newstr.push_back('P');
            } else if (((f1 == 'S') && (f2 == 'P')) || ((f2 == 'S') && (f1 == 'P'))) {
                newstr.push_back('S');
            }
        }
        tmpstr = newstr;
        --k;
    }
    cout << tmpstr[0] << endl;
}

int main() {
    solve();
    char tmp;
    while (cin >> tmp) {
        cin.putback(tmp);
        solve();
    }
}

#include <bits/stdc++.h>
#define bug1(x) cout<<#x<<" = "<<x<<endl
#define bug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl
#define bug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl
#define bug4(x,y,z,m) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#m<<" = "<<m<<endl

using namespace std;

template<class L, class R>
ostream& operator<<(ostream &os, const pair<L,R> &input) {
    os << "(";
	os << input.first << "," << input.second;
	return os << ")";
}

template<class T>
ostream& operator<<(ostream &os, const vector<T> &input) {
    os << "[ ";
    for(auto elem : input) {
		os << elem << " ";
	}
	return os << "]";
}

template<class T>
ostream& operator<<(ostream &os, const set<T> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << elem << " ";
	}
	return os << "}";
}

template<class T>
ostream& operator<<(ostream &os, const unordered_set<T> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << elem << " ";
	}
	return os << "}";
}

template<class T>
ostream& operator<<(ostream &os, const multiset<T> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << elem << " ";
	}
	return os << "}";
}

template<class T>
ostream& operator<<(ostream &os, const unordered_multiset<T> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << elem << " ";
	}
	return os << "}";
}

template<class L, class R>
ostream& operator<<(ostream &os, const map<L,R> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << "(" << elem.first << " , " << elem.second << ") ";
	}
	return os << "}";
}

template<class L, class R>
ostream& operator<<(ostream &os, const unordered_map<L,R> &input) {
    os << "{ ";
    for(auto elem : input) {
		os << "(" << elem.first << " , " << elem.second << ") ";
	}
	return os << "}";
}

#define ll long long
const int MAXN = 500005;
const int INF = 1e9;
const int MOD = 998244353;

class TaskC {
private:
	int n;
	vector<int> a , b, who, types;
	bool ok(int from, int upto) {
		int sz = upto - from + 1;
		assert(sz % 2 == 0);
		int len = sz / 2;
		for(int i = from, it = 0;  it < len; i++, it++) {
			if(who[i] == -1 && who[i+len] == -1) {
				continue;
			}
			if(who[i+len] == -1) {
				if(types[i] == 1) {
					return false;
				}
			} else if(who[i] == -1) {
				if(types[i+len] == 0) {
					return false;
				}
			} else {
				if(who[i] != who[i+len] || types[i] >= types[i+len]) {
					return false;
				}
			}
		}
		return true;
	}

	vector<int> memo;
	bool rec(int pos) {
		if(pos == 2*n) {
			return true;
		}
		if(memo[pos] != -1) {
			return memo[pos];
		}
		bool ans = 0;
		for(int upto = pos+1; upto < 2*n; upto += 2) {
			if(ok(pos, upto)) {
				ans |= rec(upto+1);
			}
		}
		return memo[pos] = ans;
	}

public:
	void solveOne(int it){
		cin >> n;
		a.assign(n, -1);
		b.assign(n, -1);
		vector<bool> used(2*n, false);
		who.assign(2*n, -1);
		types.assign(2*n, -1);
		for(int i = 0; i < n; i++) {
			cin >> a[i] >> b[i];
			if(a[i] != -1) {
				a[i]--;
				if(used[a[i]]) {
					cout << "No\n";
					return;
				}
				used[a[i]] = true;
				who[a[i]] = i;
				types[a[i]] = 0;
			}
			if(b[i] != -1) {
				b[i]--;
				if(used[b[i]]) {
					cout << "No\n";
					return;
				}
				used[b[i]] = true;
				who[b[i]] = i;
				types[b[i]] = 1;
			}
			if(a[i] != -1 && b[i] != -1 && a[i] >= b[i]) {
				cout << "No\n";
				return;
			}
		}
		memo.assign(2*n+1, -1);
		int ans = rec(0);
		cout << (ans ? "Yes":"No") << endl;
	}

	void solve(){
		int tc = 1;
		for(int it = 1; it <= tc; it++){
			solveOne(it);
		}
	}
};

int main(){
	ios_base::sync_with_stdio(false);
	TaskC solver;
	solver.solve();
	return 0;
}


//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); ++i)
#define all(x) (x).begin(), (x).end()
const int INF = 1e9;
const ll llINF = 1e18;
/*#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
*/

int main() {
    int N;
    cin >> N;
    vector<ll> X(N), Y(N);
    rep(i,0,N) cin >> X[i] >> Y[i];
    int M;
    cin >> M;
    vector<pair<int,ll>> op(M+1);
    rep(i,1,M+1) {
        cin >> op[i].first;
        if (op[i].first > 2) cin >> op[i].second;
    }
    int Q;
    cin >> Q;
    vector<pair<pair<int,int>,int>> q(Q);
    rep(i,0,Q) {
        int a, b;
        cin >> a >> b;
        q[i] = {{a, b-1}, i};
    }
    sort(all(q));

    vector<pair<ll,ll>> ans(Q);
    int cur = 0;
    while (cur < Q && q[cur].first.first == 0) {
        ans[q[cur].second] = {X[q[cur].first.second],Y[q[cur].first.second]};
        ++cur;
    }
    vector<ll> x = {1,0,0};
    vector<ll> y = {0,1,0};
    rep(i,1,M+1) {
        vector<ll> tmp_x, tmp_y;
        switch (op[i].first)
        {
        case 1:
            tmp_x = y;
            y = {-x[0], -x[1], -x[2]};
            x = tmp_x;
            break;

        case 2:
            tmp_y = x;
            x = {-y[0], -y[1], -y[2]};
            y = tmp_y;
            break;

        case 3:
            x[0] *= -1;
            x[1] *= -1;
            x[2] *= -1; x[2] += 2*op[i].second;
            break;

        case 4:
            y[0] *= -1;
            y[1] *= -1;
            y[2] *= -1; y[2] += 2*op[i].second;
            break;
        }

        while (cur < Q && q[cur].first.first == i) {
            ans[q[cur].second].first = x[0]*X[q[cur].first.second] + x[1]*Y[q[cur].first.second] + x[2];
            ans[q[cur].second].second = y[0]*X[q[cur].first.second] + y[1]*Y[q[cur].first.second] + y[2];
            ++cur;
        }
    }
    rep(i,0,Q) cout << ans[i].first << " " << ans[i].second << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define FI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pL pair<ll, ll>

const int MX=300000;
const ll mod=998244353;

int x[MX], y[MX];
vector<pair<ll, pair<int, int> > >dist;
vector<pL>dx, dy;

void cal(int i, int j)
{
    ll d=dx[j].ff-dx[i].ff;
    int jx=dx[j].ss, ix=dx[i].ss;
    if(jx<ix) swap(jx, ix);

    dist.push_back({d, {ix, jx}});
}

void cal2(int i, int j)
{
    ll d=dy[j].ff-dy[i].ff;
    int jx=dy[j].ss, ix=dy[i].ss;
    if(jx<ix) swap(jx, ix);

    dist.push_back({d, {ix, jx}});
}

ll ans()
{
    int m=5;
    while(m)
    {
        if(dist[m].ss==dist[m-1].ss) m--;
        else return dist[m-1].ff;
    }
}

int main()
{
    FI;

    int n; cin>>n;
    for(int i=1; i<=n; i++) cin>>x[i]>>y[i];

    for(int i=1; i<=n; i++) dx.push_back({x[i], i}), dy.push_back({y[i], i});

    sort(dx.begin(), dx.end());
    sort(dy.begin(), dy.end());

    cal(0, n-1);
    cal(0, n-2);
    cal(1, n-1);

    cal2(0, n-1);
    cal2(0, n-2);
    cal2(1, n-1);

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

    cout<<ans()<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1LL << 60;
const int inf = (1 << 30);
const ll mod = 998244353;
const ll MOD = 1000000007;
const ld PI = acos(-1.0L);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    string s;
    cin >> s;
    deque<char>deq;
    int n = s.size();
    bool frip = false;
    for(int i=0;i<n;i++){
        char c = s[i];
        if(s[i]=='R') frip = !frip;
        else{
            if(deq.empty()){
                if(frip) deq.push_front(c);
                else deq.push_back(c);
            }
            else{
                if(frip){
                    if(deq.front()==c){
                        deq.pop_front();
                    }
                    else{
                        deq.push_front(c);
                    }
                }
                else{
                    if(deq.back()==c){
                        deq.pop_back();
                    }
                    else{
                        deq.push_back(c);
                    }
                }
            }
        }
    }
    string ans;
    for(char c:deq){
        ans.push_back(c);
    }
    if(frip) reverse(ans.begin(),ans.end());
    cout << ans << endl;
}

#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <deque>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <utility>
#include <climits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef pair<ull,ull> pull;
typedef vector<int> vi;
typedef vector<ll> vl;

#define mp make_pair
#define pb push_back
#define fr first
#define sc second

#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define rep(s, i, n) for (int(i) = (s); (i) < (n); (i)++)
#define repe(s, i, n) for (int(i) = (s); (i) <= (n); (i)++)
#define rrep(s, i, n) for (int(i) = (s); (i) > (n); (i)--)
#define rrepe(s, i, n) for (int(i) = (s); (i) >= (n); (i)--)
#define allof(a) (a).begin(), (a).end()

int main(int argc, char const *argv[])
{
    string s;
    cin>>s;

    deque<char> T;
    int r=0;

    rep(0,i,s.length()){
        if(s[i]=='R'){
            r=1-r;
        }
        else{
            if(r){
                if(!T.empty()&&T.front()==s[i]){
                    T.pop_front();
                }
                else{
                    T.push_front(s[i]);
                }
            }
            else{
                if(!T.empty()&&T.back()==s[i]){
                    T.pop_back();
                }
                else{
                    T.push_back(s[i]);
                }
            }
        }
    }

    if(r){
        for(auto i=T.rbegin();i!=T.rend();i++){
            cout<<*i;
        }
        cout<<endl;
    }
    else{
        for(auto i=T.begin();i!=T.end();i++){
            cout<<*i;
        }
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ep emplace
#define epb emplace_back
#define scll static_cast<long long>
#define sz(x) static_cast<int>((x).size())
#define pfll(x) printf("%lld\n", x)
#define ci(x) cin >> x
#define ci2(x, y) cin >> x >> y
#define ci3(x, y, z) cin >> x >> y >> z
#define co(x) cout << x << endl
#define co2(x, y) cout << x << " " << y << endl
#define co3(x, y, z) cout << x << " " << y << " " << z << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int>> PQG;
typedef priority_queue<P> PQP;
typedef priority_queue<P, vector<P>, greater<P>> PQPG;

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int n;
string s, t;

int main() {
    ci(n);
    ci(s);
    ci(t);
    vector<int> sind, tind;
    rep(i, n) {
        if (s[n - i - 1] == '1') sind.epb(n - i - 1);
        if (t[n - i - 1] == '1') tind.epb(n - i - 1);
    }
    if (sz(sind) < sz(tind) || sz(sind) % 2 != sz(tind) % 2) {
        co(-1);
        return 0;
    }
    for (int i = 0, e = sz(tind); i < e; i++) {
        if (sind[i] < tind[i]) {
            co(-1);
            return 0;
        }
    }
    ll ans = 0;
    while (!sind.empty()) {
        int i1, i2;
        while (tind.empty() || sind.back() < tind.back()) {
            i1 = sind.back(); sind.pop_back();
            i2 = sind.back(); sind.pop_back();
            ans += i2 - i1;
            if (sind.empty()) break;
        }
        if (!tind.empty() && !sind.empty()) {
            i1 = tind.back(); tind.pop_back();
            i2 = sind.back(); sind.pop_back();
            ans += i2 - i1;
        }
    }
    co(ans);
    return 0;
}

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <set>

typedef long long int64;

const int N = 500000 + 10;

int n;
char s[N], t[N];

int main() {
    static std::set<int> set;
    std::set<int>::iterator it;
    int i, x;
    int64 tot = 0;

    scanf("%d", &n);
    scanf("%s %s", s + 1, t + 1);
    for (i = 1; i <= n; i++)
        if (s[i] == '1')
            set.insert(i);

    for (i = 1; i <= n; i++) {
        if (s[i] ^ t[i]) {
            it = set.upper_bound(i);
            if (it == set.end()) {
                printf("%d\n", -1);
                return 0;
            }
            x = (*it);
            set.erase(it);

            tot += x - i;
            std::swap(s[i + 1], s[x]);
            s[i + 1] = '0';
        }
    }
    printf("%lld\n", tot);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define swap(a,b) (a^=b^=a^=b)
#define ll long long int
#define ull unsigned long long int
#define uint unsigned int
#define format(a) memset(a,0,sizeof(a))
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define dec(x,y,z) for(int x=y;x>=z;x--)
#define mst(x) memset(x,0,sizeof(x))
const int maxn=1e5+20;
inline int read()
{
    int ans=0;
    char last=' ',ch=getchar();
    while(ch<'0'|ch>'9')last=ch,ch=getchar();
    while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
    if(last=='-')ans=-ans;
    return ans;
}
int n,x,y;
int c[maxn],ok[maxn];
map<int,int>ma;
vector<int>node[maxn];
void dfs(int cur,int fa)
{
    if(ma[c[cur]])ok[cur]=0;
    else ok[cur]=1;
    ma[c[cur]]++;
    for(int i=0;i<node[cur].size();i++)
    {
        int nxt=node[cur][i];
        if(nxt==fa)continue;
        dfs(nxt,cur);
    }
    ma[c[cur]]--;
}
int main()
{
    n=read();
    rep(i,1,n)c[i]=read();
    rep(i,1,n-1)
    {
        int x=read(),y=read();
        node[x].push_back(y);
        node[y].push_back(x);
    }
    dfs(1,0);
    rep(i,1,n)
    {
        if(ok[i])cout<<i<<"\n";
    }
    return 0;
}

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

int main()
{
	int r, c;
	cin >> r >> c;
	vector<vector<P>> g(2 * r * c);
	//横方向
	rep(i, r)rep(j, c - 1)
	{
		int a; cin >> a;
		int idx = i * c + j;
		g[idx].emplace_back(idx+1,a);
		g[idx + 1].emplace_back(idx, a);
	}
	//縦方向
	rep(i, r - 1)rep(j, c)
	{
		int b; cin >> b;
		int idx = i * c + j;
		g[idx].emplace_back(idx + c, b);
	}
	//高速道路の出入口
	rep(i, r)rep(j, c)
	{
		int idx = i * c + j;
		g[idx].emplace_back(idx + r * c, 1);
		g[idx+r*c].emplace_back(idx, 0);
	}
	//高速道路
	reps(i,1,r)rep(j, c)
	{
		int idx = i * c + j + r * c;
		g[idx].emplace_back(idx - c, 1);
	}

	const int INF = 1e9;
	priority_queue<P, vector<P>, greater<P>> pq;
	pq.emplace(0, 0);
	vector<int> dist(2 * r * c, INF);
	dist[0] = 0;
	while (!pq.empty())
	{
		int c, s;
		tie(c, s) = pq.top();
		pq.pop();
		if (c > dist[s])continue;
		for (auto [es,ec]: g[s])
		{
			if (dist[s] + ec >= dist[es])continue;
			dist[es] = dist[s] + ec;
			pq.emplace(dist[es],es);
		}
	}
	cout << dist[r * c - 1] << endl;
	return 0;
}


// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const long double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

class DIJ{
	public:
	struct edge{
		Def to,cost;
	};
	vector<vector<edge> >G;
	Def n;
	vi d;//distance
	DIJ(Def size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(Def a,Def b,Def c){
		edge e={b,c},ee={a,c};
		G[a].pb(e);
		G[b].pb(ee);
	}
	vi dij(Def s){
		d=vi(n,inf);
		d[s]=0;
		priority_queue<pii>q;
		q.push(pii(0,s));
		while(!q.empty()){
			pii p=q.top();
			q.pop();
			Def pos=p.second,cost=-p.first;
			if(cost>d[pos])continue;
			rep(i,G[pos].size()){
				edge e=G[pos][i];
				Def to=e.to;
				Def nowcost=cost+e.cost;
				if(nowcost<d[to]){
					d[to]=nowcost;
					q.push(pii(-d[to],to));
				}
			}
		}
		return d;
	}
};

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

	int n,m;
	cin>>n>>m;
	DIJ dij(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		dij.add_edge(a,b,1);
	}
	int k;
	cin>>k;
	vi in(k);
	rep(i,k)cin>>in[i],in[i]--;
	vvi G(k);
	rep(i,k)G[i]=dij.dij(in[i]);

	vvi dp(1<<k,vi(k,inf));
	rep(i,k)dp[1<<i][i]=1;
	rep(i,1<<k)rep(j,k)if(dp[i][j]+inf)rep(l,k)if(!(i&1<<l)){
		cmin(dp[i|1<<l][l],dp[i][j]+G[j][in[l]]);
	}
	int out=inf;
	rep(i,k)cmin(out,dp.back()[i]);
	if(out==inf)out=-1;
	cout<<out<<endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353
#define N 400005
#define l(x) (x&(-x))
int n,a[N],b[N],c[N];
vector<int>to[N];
struct lsh{
	int pos,val;
}a_[N<<1],b_[N];
inline void add(int x){while(x<N)++c[x],x+=l(x);}
inline int sum(int x){int ret=0;while(x)ret+=c[x],x-=l(x);return ret;}
inline bool cmp(lsh aa,lsh bb){
	return aa.val<bb.val;
}
int i,cnt;
long long ans;
int main(){
	cin>>n;
	for(i=1;i<=n;++i)cin>>a[i],a[i]+=i,a_[i].val=a[i],a_[i].pos=i;
	for(i=1;i<=n;++i)cin>>b[i],b[i]+=i,a_[i+n].val=b[i],a_[i+n].pos=i+n;
	sort(a_+1,a_+n+n+1,cmp);
	for(i=1;i<=n+n;++i){
		if(a_[i].val!=a_[i-1].val)++cnt;
		if(a_[i].pos>n)b[a_[i].pos-n]=cnt;
		else a[a_[i].pos]=cnt;
	}
	for(i=1;i<=n;++i)++c[a[i]],--c[b[i]];
	//,cout<<a[i]<<" "<<b[i]<<"\n";
	for(i=1;i<=n+n;++i){
		if(c[i])return cout<<"-1",0;
	}
	for(i=1;i<=n;++i)to[a[i]].push_back(i);
	for(i=1;i<=n;++i){
		++c[b[i]];
		b[i]=to[b[i]][c[b[i]]-1];
	}
	memset(c,0,sizeof(c));
	for(i=1;i<=n;++i){
		ans+=sum(b[i]);
		add(b[i]);
	}
	cout<<1ll*n*(n-1)/2-ans;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1)
inline int lowbit(const int & x) { return x & (-x);}
int n;
int tot;
const int maxn = 200 + 10;
int P[maxn];
bool visa[maxn], visb[maxn];
int f[maxn][maxn];
void no() { puts("No"); exit(0);}
int dp(int i, int c)
{
	if(~f[i][c]) return f[i][c];
	if(i == 2 * n + 1) return 1;
	for(int j = i + 1; j <= 2 * n; j += 2)
	{
		int cur = c;
		bool flag = 1;
		int l = (j - i + 1) / 2;
		for(int p = i; (p <= i + l - 1) && flag; ++p)
		{
			if(P[p] != -1 && P[p] != p + l)
				flag = 0;
			if(P[p + l] != -1 && P[p + l] != p)
				flag = 0;
			if(visa[p + l] || visb[p])
				flag = 0;
			if(!visa[p] && !visb[p + l]) --cur;
			if(cur < 0)
				flag = 0;
		}
		//cout << i << ' ' << c << ' ' << flag << ' ' << j + 1 << ' ' << cur << ' ' << dp(j + 1, cur) << endl;
		if(flag && dp(j + 1, cur))
			return f[i][c] = 1;
	}
	return f[i][c] = 0;
}
int main()
{
	memset(f, -1, sizeof f);
	memset(P, -1, sizeof P);
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		if(~a && (visa[a] || visb[a])) no();
		if(~b && (visa[b] || visb[b])) no();
		if(~a && ~b && a >= b) no();
		if(a == -1 && b == -1) ++tot;
		if(~a) P[a] = b, visa[a] = 1;
		if(~b) P[b] = a, visb[b] = 1;
	}
	//cout << dp(5, tot) << endl;
	if(dp(1, tot)) puts("Yes");
	else puts("No");
	return 0;
}
/*
2
-1 -1
2 3
*/

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
const int mxN = 205;

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int st[mxN], en[mxN];
int dp[mxN];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vector<pi> p(n);
	int f2 = 1;
	rep(i, n){
		cin >> p[i].fi >> p[i].se;
		if(p[i].fi != -1 && p[i].se != -1){
			if(p[i].fi >= p[i].se){
				f2 = 0;
			}
		}
		if(p[i].fi != -1){
			if(en[p[i].fi]) f2 = 0;
			if(st[p[i].fi]) f2 = 0;
			st[p[i].fi] = p[i].se;
		}
		if(p[i].se != -1){
			if(en[p[i].se]) f2 = 0;
			if(st[p[i].se]) f2 = 0;
			en[p[i].se] = p[i].fi;
		}
	}
	if(!f2){
		cout << "No" << endl;
		return 0;
	}
	dp[0] = 1;
	rep(i, 2 * n + 1) if(dp[i]){
		rep(k, n + 1){
			//so k is b - a - 1
			int nm = (k + 1) * 2;
			if((i + nm) > (2 * n)) continue;
			int f1 = 1;
			repn(l, i + 1, i + k + 2){
				if(st[l] && st[l] != -1){
					if((st[l] - l - 1) != k){
						f1 = 0;
						break;
					}
				}
				if(st[l] && st[l] == -1){
					if(en[l + k + 1]) f1 = 0;
				}
				if(en[l]){
					f1 = 0;
					break;
				}
			}
			repn(l, i + k + 2, i + nm + 1){
				if(st[l]){
					f1 = 0;
					break;
				}
				if(en[l] && en[l] != -1){
					if((l - en[l] - 1) != k){
						f1 = 0;
						break;
					}
				}
				if(en[l] && en[l] == -1){
					if(st[l - k - 1]) f1 = 0;
				}
			}
			if(f1) dp[i + nm] = 1;
		}
	}
	cout << (dp[2 * n] ? "Yes" : "No") << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}

void main() {
    int a,b,c,d;
    R(a,b,c,d);
    int ans=-10000;
    REP1(i,a,b) REP1(j,c,d) chmax(ans,i-j);
    W(ans);
}

 // {{{ main
}}
int main() { unolight::main(); return 0; }
// }}}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b;
    cin >> c >> d;
    cout << (b-c) << endl;
}


/*
	Problem:	A.cpp
	Time:		2021-05-08 11:22
	Author:		CraZYali
	E-Mail:		yms-chenziyang@outlook.com
*/

#define REP(i, s, e) for (register int i(s), end_##i(e); i <= end_##i; i++)
#define DEP(i, s, e) for (register int i(s), end_##i(e); i >= end_##i; i--)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)

#define chkmax(a, b) (a < (b) ? a = (b) : a)
#define chkmin(a, b) (a > (b) ? a = (b) : a)

#include <iostream>
#include <cstdio>

using namespace std;

	template <typename T>
inline T read()
{
	T ans = 0, flag = 1;
	char c = getchar();
	while (!isdigit(c))
	{
		if (c == '-') flag = -1;
		c = getchar();
	}
	while (isdigit(c))
	{
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * flag;
}

#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)

int main()
{
#ifdef CraZYali
	file("A");
#endif
	int n = read<int>();
	REP(i, 1, n) printf("%d %d\n", (2 * i) % n + 1, (2 * i + 1) % n + 1);
	return 0;
}

#include<fstream>
#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
#include<cmath>
#include<unordered_map>
#include<map>
#include<queue>
#include<tuple>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<set>
#include<array>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using graph = vector<vector<int>>;
const long long MOD = 1000000007;
const long long INF = 1e18;
using ll = long long;
using P = pair<int,int>;
using matrix = vector<vector<ll>>;

void chmin(int &x,int y){ x = min(x,y); }

int digit(ll x){
  int count = 1;
  while(x/10>0){
    count ++;
    x /= 10;
  }
  return count;
}

bool prime(ll x){
  if(x==1) return false;
  for(ll i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}

void decom(ll x,map<ll,int> &hatano){
  for(ll i=2;i*i<=x;i++){
    if(x%i==0&&prime(i)){
      while(x%i==0){
      x /= i;
      hatano[i] ++;
    }
    }
  }
  if(x!=1) hatano[x] ++;
}

ll speedpow(ll x,ll y){
  ll res = 1;
  ll test = x;
  for(int i=0;i<31;i++){
    if(y&(1<<i)) res *= test;
    res = res%MOD;
    test = (test*test)%MOD;
  }
  return res;
}

ll combination(ll x,ll y){
  ll test = 1;
  ll test1 = 1;
  for(ll i=0;i<y;i++){
    test = (test*(x-i))%MOD;
    test1 = (test1*(i+1LL))%MOD;
  }
  return (test * speedpow(test1,MOD-2))%MOD ;
}

int euclid(int x,int y){
  if(y==0) return x;
  return euclid(y,x%y);
}

//行列累乗

matrix mul(matrix &a, matrix &b) {
  int p = a.size();
    matrix res(p, vector<long long>(p, 0));
    for(int i = 0; i < p; i++)
        for(int j = 0; j < p; j++)
            for(int k = 0; k < p; k++)
                (res[i][j] += a[i][k] * b[k][j]) %= MOD;
    return res;
}

matrix pow(matrix m, long long k) {
  int p = m.size();
    matrix res(p, vector<long long>(p, 0));
    for(int i = 0; i < p; i++)
        res[i][i] = 1; // 単位行列にする

    while(k > 0) {
        if(k & 1) res = mul(res, m);
        m = mul(m, m);
        k >>= 1;
    }
    return res;
}

int main(){
    int n,m,q;cin >> n >> m >> q;
    int v[n],w[n];
    vector<P> hatano;
    int x[m];
    vector<P> konishi;

    int l[q],r[q];
    rep(i,n){
      cin >> w[i] >> v[i];
      hatano.push_back(make_pair(v[i],w[i]));
    }

    sort(hatano.rbegin(),hatano.rend());
    rep(i,m){
      cin >> x[i];
      konishi.push_back(make_pair(x[i],i));
    }
    sort(konishi.begin(),konishi.end());
    vector<int> ans;

    rep(i,q){
      cin >> l[i] >> r[i];
      l[i] --;r[i] --;
    }
    rep(i,q){
      int test=0;
      vector<bool> check(m,true);
      for(int s=l[i];s<=r[i];s++) check[s] = false;

        rep(j,n){
          rep(k,m){
            if(konishi[k].first>=hatano[j].second&&check[konishi[k].second]){
              test += hatano[j].first;
              check[konishi[k].second] = false;
             // cout << hatano[j].first << endl;
              break;
            }
          }
        }
        ans.push_back(test);
      //  cout << endl;
    }

    for(auto e:ans) cout << e << endl;

  }


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
int n,a[100010];
void MAIN() {
	int i;
	cin>>n;
	for(i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	ll sa=0,sb=0;
	for(i=n;i>=1;i-=2)sa+=a[i];
	for(i=n-1;i>=1;i-=2)sb+=a[i];
	bool win=sa==sb;
	if(n%2==0)win=!win;
	cout<<(win?"First":"Second")<<'\n';
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1 << 30) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define ull unsigned long long
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); i--)
#define For(i, k, j) for(rint i = (k); i <= (j); i++)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define Fin(s) freopen(s, "r", stdin)
#define Fout(s) freopen(s, "w", stdout)
#define file(s) Fin(s".in"), Fout(s".out")
#define int long long
const int P = 1000000007; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(int &a, int b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}

inline void printarray(int *a, int n) {For(i, 1, n) fprintf(stderr, "%d ", a[i]); fprintf(stderr, "\n");}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n) return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
};
inline int read() {rint x; FI(x); return x;}
int n, a[100005];
signed main()
{
    #ifndef ONLINE_JUDGE
        file("pro");
    #endif
    int T = read();
    while(T--) {
    	n = read();
	    For(i, 1, n) a[i] = read();
	    if(n & 1) cout << "Second" << endl;
	    else {
	    	map < int, int > vis;
	    	For(i, 1, n) vis[a[i]]++;
	    	bool o = 0;
	    	for(auto it : vis) {
	    		if(it.second & 1) {
	    			cout << "First" << endl, o = 1;
	    			break;
				}
			}
			if(!o) cout << "Second" << endl;
		}
	}

    return FastIO::Fflush(), 0;
}
/*

*/


#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

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...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

int main() {

	int a, b, c, d; cin >> a >> b >> c >> d;
	cout << a*d - b*c;

	return 0;
}

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

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

#define MAXCHAR 255
#define ll long long

using namespace std;
const ll dividend = 1000000007;
const ll limit = pow(10, 18);
const ll bigNum = pow(10, 9);

ll funcComb(int n, int k)
{
	ll output = 1;
	int sum = n + k;
	vector<int> dividends;
	for (int i = 0; i < k; i++)
	{
		dividends.push_back(k - i);
	}
	for (int i = 0; i < k; i++)
	{
		output *= sum - i;
		for (auto it = dividends.begin(); it != dividends.end(); it++)
		{
			if (*it == 0)
				continue;
			if (output % *it == 0)
			{
				output /= *it;
				*it = 0;
			}
		}
		if (output > dividend)
		{
			output %= dividend;
		}
	}

	return output;
}

ll funcPow(int n, int r)
{
	ll ret = 1;
	for (int i = 1; i <= r; i++)
	{
		ret *= n;
		if (ret > dividend)
			ret %= dividend;
	}
	return ret;
}

vector<int> broken;

ll funcA(int step)
{
	for (auto it = broken.begin(); it != broken.end(); it++)
	{
		if (step == *it)
			return 0;
	}
	if (step == 1)
		return 1;
	if (step == 2)
		return 2;
	return funcA(step - 1) % dividend + funcA(step - 2) % dividend;
}

vector<int> C;
vector<vector<int>> tree;

int main()
{
	int X, Y, Z, out;
	cin >> X >> Y >> Z;

	out = Z * Y / X;
	if (out * X == Z * Y)
		out--;

	cout << out << endl;
	return 0;
}