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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define endl            "\n"
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

char myHeap[200 * 1024 * 1024];
int sz = 0;
void assert_tle(bool q) { while (!q); }
void* operator new  ( std::size_t count ) {
    sz += count;
    assert_tle(sz <= 200 * 1024 * 1024);
    return myHeap + sz - count;
}

void operator delete (void *ptr) { }

void fastIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

double memo[100][100][100];

double dp(int a,int b,int c)
{
    //debug(a,b,c);
    if(a>=100||b>=100||c>=100) return 0;
    if(memo[a][b][c]) return memo[a][b][c];
    double tot=a+b+c;
    double pa=a/tot;
    double pb=b/tot;
    double pc=c/tot;

    double ans=pa*(1+dp(a+1,b,c))+pb*(1+dp(a,b+1,c))+pc*(1+dp(a,b,c+1));
    memo[a][b][c]=ans;

    return ans;
}

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    memset(memo,0.0,sizeof memo);
    cout<<fixed<<setprecision(9);
    cout<<dp(a,b,c);

}

int32_t main()
{
    fastIO();
    //w(t)
    {
        solve();
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
int n,m,a[100010],ans=1;
inline int ksm(int a,int b){
	int res=1;
	while(b){
		if(b&1)res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
	    scanf("%lld",&a[i]);
	    m=max(m,a[i]);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(a[i]==a[i-1])continue;
		ans=ans*(a[i]-a[i-1]+1)%mod;
	}
	printf("%lld",ans);
	return 0;
}

#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define rep(i,n) for(ll i=0;i<(n);++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define revlp(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#define sz(x) (ll)(x).size()
#define endl '\n'
typedef long long ll;        typedef long double ld;
typedef pair<ll,ll> pi;     typedef vector<ll> vi;
typedef vector<pi> vpi;       typedef vector<vi> graph;
long long mod=1000000007;     long double EPS=1e-9;
#ifndef ONLINE_JUDGE
#define debarr(a,n)cerr<<#a<<":";for(int i=0;i<n;i++)cerr<<a[i]<<" ";cerr<<endl;
#define debmat(mat,row,col)cerr<<#mat<<":\n";for(int i=0;i<row;i++){for(int j=0;j<col;j++)cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...)dbs(#__VA_ARGS__,__VA_ARGS__)
template<class S,class T>ostream &operator<<(ostream &os,const pair<S,T> &p){return os<<"("<<p.first<<","<<p.second<<")";}
template<class T>ostream &operator<<(ostream &os,const vector<T> &p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const set<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>ostream &operator<<(ostream &os,const multiset<T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class S,class T>ostream &operator<<(ostream &os,const map<S,T>&p){os<<"[";for(auto&it:p)os<<it<<" ";return os<<"]";}
template<class T>void dbs(string str,T t){cerr<<str<<":"<<t<<"\n";}
template<class T,class...S>void dbs(string str,T t,S... s){int idx=str.find(',');cerr<<str.substr(0,idx)<<":"<<t<<",";dbs(str.substr(idx+1),s...);}
#else
#define pr(...){}
#define debarr(a,n){}
#define debmat(mat,row,col){}
#endif

void solve(){
    ll n;
    cin>>n;
    vector<ll> arr(n);
    rep(i,n)    cin>>arr[i];
    sort(all(arr));
    vector<ll> dp(n);
    dp[0]=arr[0]+1;
    repe(i,1,n-1){
        dp[i]=(dp[i-1]*(arr[i]-arr[i-1]+1))%mod;
    }
    cout<<dp[n-1]<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //cout<<fixed<<setprecision(15);
    //clock_t begin = clock();
    ll tc=1;//cin>>tc;
    for(ll i=1;i<=tc;i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    // clock_t end = clock();double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;cerr << elapsed_secs;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define fi first
#define se second
using namespace std;

typedef long long LL;
typedef pair <int, int> P;
const int inf = 0x3f3f3f3f, N = 3e5 + 10;
template <typename T>
void rd_(T &x) {
	x = 0; int f = 1;
	char ch = getchar();
	for (; ch > '9' || ch < '0'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x*10 + ch - '0';
	x *= f;
}

int n, x[N], y[N];
LL ans;

int main() {
	cin>>n;
	rep (i, 1, n) cin>>x[i];
	rep (i, 1, n) {
		cin>>y[i];
		ans += x[i]*y[i];
	}
	printf("%s\n", ans == 0 ? "Yes" : "No");
}

#include <bits/stdc++.h>
using namespace std;
using i64 = unsigned long long;
#define rep(i, n) for (i64 i = 0; i < (n); i++)
#define IN_i64(n) \
    i64 n; \
    cin >> n;
#define IN_veci64(a, n) \
    vector<i64> a((n)); \
    rep(i, n) cin >> a[i];
constexpr i64 INF64 = 1LL << 62LL;
inline i64 modpow(i64, i64, i64 = INF64);
inline i64 gcd(i64, i64);
template <class T> inline bool chmax(T &a, T b);
template <class T> inline bool chmin(T &a, T b);

int main()
{
    IN_i64(N);
    IN_i64(K);
    rep(i,K){
        if (N%200==0) N/=200;
        else{
            N*=1000;
            N+=200;
        }
    }
    cout<<N<<endl;
}

i64 modpow(i64 base, i64 exp, i64 mod)
{
    i64 ans = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
        {
            ans *= base;
            ans %= mod;
        }
        exp /= 2;
        base *= base;
        base %= mod;
    }
    return ans;
}

i64 gcd(i64 a, i64 b)
{
    if (b == 0) return a;
    return gcd(b, a % b);
}

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


#include <stack>
#include <queue>
#include <set>
#include <array>
#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[])
{
    int n;
    cin>>n;

    map<int,int> m;
    ll res=0;
    rep(0,i,n){
        int a;
        cin>>a;
        a%=200;
        res+=m[a];
        m[a]++;
    }
    cout<<res<<endl;

    return 0;
}

#include <bits/stdc++.h>  // This will work only for g++ compiler.
using namespace std;
#define fo(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define fon(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
//short hand for usual tokens
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
#define INF (int)1e9
// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())
// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
    int n;
    cin >> n;
    vi v(1<<n);
    for(int i = 0 ;i< 1<<n ;i++){
        cin >> v[i];
    }
    int mid =  (1 << n) / 2;
    int pos = 0;
    int elem = min(*max_element(v.begin(),v.begin()+mid) , *max_element(v.begin()+mid , v.end()));
    for(int i = 0; i < (1<<n) ; i++){
        if(elem == v[i]){
            pos = i+1;
            break;
        }
    }
    cout << pos << '\n';
    return 0;
}


#include<string>
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    ll re = 0;
    char last_char = '\n';
    int last_int = 0;
    int last_pos = s.size();
    for (int i = s.size() - 3; i >= 0; i--)
    {
        if (s[i] == s[i + 1] && s[i] != s[i + 2])
        {
            for (int j = i + 2; j < last_pos; j++)
            {
                if (s[i] == s[j])re--;
            }
            if (s[i] != last_char)
            {
                last_int = s.size() - (i + 2);
                re += last_int;
                last_char = s[i];
            }
            else
            {
                re += last_pos-(i+2);
                last_char = s[i];
            }

            last_pos = i;
        }
    }
    printf("%lld\n", re);
}

//

#include <iostream>

using namespace std;

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

  long ans = 0;
  long i = 0;
  while (ans < N)
    ans += (++i);

  cout << i << "\n";

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};

bool can(string& x,string& y){
	int st = 0;
	for(int p=0;p<sz(x);p++){
		if(st==sz(y)) return true;
		if(x[p]==y[st]) st++;
	}
	return (st==sz(y));
}
void solve(int tc){
	int n;
	string a[3],b[3];
	cin >> n >> a[0] >> a[1] >> a[2];
	b[0] = a[0] + a[0];
	b[1] = a[1] + a[1];
	b[2] = a[2] + a[2];
	string f1 = "";
	string f2 = "";
	for(int e=0;e<n;e++) f1 += "0";
	for(int e=0;e<n;e++) f1 += "1";
	for(int e=0;e<n;e++) f2 += "1";
	for(int e=0;e<n;e++) f2 += "0";
	{
		string f3 = "0" + f1;
		bool suc = true;
		for(int p=0;p<3;p++) if(!can(b[p],f3)) suc = false;
		if(suc){
			cout << f3 << "\n";
			return;
		}
	}
	{
		string f3 = f1 + "0";
		bool suc = true;
		for(int p=0;p<3;p++) if(!can(b[p],f3)) suc = false;
		if(suc){
			cout << f3 << "\n";
			return;
		}
	}
	{
		string f3 = "1" + f2;
		bool suc = true;
		for(int p=0;p<3;p++) if(!can(b[p],f3)) suc = false;
		if(suc){
			cout << f3 << "\n";
			return;
		}
	}
	{
		string f3 = f2 + "1";
		bool suc = true;
		for(int p=0;p<3;p++) if(!can(b[p],f3)) suc = false;
		if(suc){
			cout << f3 << "\n";
			return;
		}
	}
}

int main(void){

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int tc = 1;

		cin >> tc;

	for(int test_number=1;test_number<=tc;test_number++){
		solve(test_number);
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
void solve(){
        long long n,m,k,tot=0,cnt=0;
        int a=0,b=0,c=0;
        string s;
        cin>>n;

        while( n && n%10==0) n/=10;
        s=to_string(n);
        for(int i=0;i<s.size()/2;i++){if(s[i]!=s[s.size()-1-i]){cout<<"No";return ;}}
        cout<<"Yes"<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    long long q(1);
    //cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(int i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(int i=(r)-1;i>=(l);i--)
#define pb push_back
#define ins insert
#define se second
#define fi first
#define all(x) x.begin(),x.end()
using vi=vector<int>;
using vl=vector<ll>;
using vvi= vector<vector<int>>;
using vvl= vector<vector<ll>>;
using pii= pair<int,int>;
using pll= pair<ll,ll>;
const ll mod = INF;
const int dxn[9]={-1,0,1,-1,0,1,-1,0,1};
const int dyn[9]={-1,-1,-1,0,0,0,1,1,1};
const int dxf[4]={0,1,0,-1};
const int dyf[4]={-1,0,1,0};
const int maxn = 1000;

int main(){
    int n,m;
    ll a[maxn+1],b[maxn+1];
    ll dp[maxn+1][maxn+1]={0};

    cin >> n>>m;
    rep(i,n)cin >> a[i+1];
    rep(i,m)cin >> b[i+1];

    rep(i,m+1)dp[0][i]=i;
    rep(i,n+1)dp[i][0]=i;

    repl(i,1,n+1){
        repl(j,1,m+1){
            int p=1;
            if(a[i]==b[j])p=0;
            dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+p);
        }
    }

    cout << dp[n][m]<<endl;

    return 0;
}

#include<stdio.h>
#include<bits/stdc++.h>
#define vi vector<int>
#define int long long
#define pf printf
#define mod 1000000007
using namespace std;
void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int pow(int n,int m){
    if(m%2==0){
      int pro=pow(n,m/2);
      return ((pro)%mod*(pro)%mod)%mod;
    }else{
       return ((n)%mod*(pow(n,m-1))%mod)%mod;
    }
}
int dp[1000][1000];
int findans(vector<int>&a,vector<int>&b,int i,int j){
    if(i==a.size() || j==b.size()){
        //pf("i is %lld and j is %lld ans is %lld\n",i,j,(a.size()-i)+(b.size()-j));
        return (a.size()-i)+(b.size()-j);
    }
    if(dp[i][j]!=-1) return dp[i][j];
    if(a[i]==b[j]){
        return dp[i][j]=findans(a,b,i+1,j+1);
    }else{
        int t=1+findans(a,b,i+1,j+1);
        int l=1+findans(a,b,i+1,j);
        int r=1+findans(a,b,i,j+1);
        return dp[i][j]=min({l,r,t});
    }
}
int32_t main(){
  boost();
 int n,m;
 cin>>n>>m;
 vector<int> a,b;
 memset(dp,-1,sizeof(dp));
 for(int i=0;i<n;i++){
     int ele;
     cin>>ele;
     a.push_back(ele);
 }
 for(int i=0;i<m;i++){
     int ele;
     cin>>ele;
     b.push_back(ele);
 }
 int ans=findans(a,b,0,0);
 pf("%lld\n",ans);
return 0;
}


//#include "input.h"
//#include "output.h"
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

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

#define all(c) c.begin(), c.end()

typedef int64_t i64;

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

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

//bool __hack = std::ios::sync_with_stdio(false);
//auto __hack1 = cin.tie(nullptr);

struct Input {

    Input(istream &in) : in(&in) {}

    template<class T>
    T next() const {
        T x;
        *in >> x;
        return x;
    }

    int ni() const {
        return next<int>();
    }

    template<class T>
    vec<T> nVec(int n) const {
        vec<T> v(n);
        for (int i = 0; i < n; ++i) {
            v[i] = next<T>();
        }
        return v;
    }

    vec<i64> nvi64(int n) const {
        return nVec<i64>(n);
    }

    istream *in;
};

Input in(cin);

class Output {

private:
ostream *out;

template<typename T>
void printSingle(const T &value) {
    *out << value;
}

public:
Output(ostream &out) : out(&out) {}

inline void print() {}

template<typename T, typename...Ts>
inline void print(const T &f, const Ts&... args) {
    printSingle(f);
    if (sizeof...(args) != 0) {
        *out << ' ';
        print(args...);
    }
}

template<typename...Ts>
inline void println(const Ts&... args) {
    print(args...);
    (*out) << '\n';
}

template<typename...Ts>
inline void operator() (const Ts&... args) {
    println(args...);
}

};

Output out(cout);

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

void solve(istream& inStream, ostream& outStream) {
    in = Input(inStream);
    out = Output(outStream);
    auto n = in.ni();
    auto a = in.nvi64(n);
    auto b = in.nvi64(n);
    auto sum = accumulate(all(a), i64(0));
    vec<i64> evens, odds;
    FOR(i, n) {
        if (i % 2 == 0) {
            evens.push_back(b[i] - a[i]);
        } else {
            odds.push_back(b[i] - a[i]);
        }
    }
    sort(all(evens));
    sort(all(odds));
    while (!evens.empty()) {
        if (sum <= sum + evens.back() + odds.back()) {
            sum = sum + evens.back() + odds.back();
            evens.pop_back();
            odds.pop_back();
        } else {
            break;
        }
    }
    out(sum);
}

//#include <fstream>

int main() {
//  ifstream fin("input.txt");
//  ofstream fout("output.txt");
//    Input in(in);
//    Output out(out);
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define nn int
#define dd double
#define ll long long int
#define ss string
int main()
{
	ss s;
	cin>>s;
	reverse(s.begin(),s.end());
	for(nn i=0;i<s.size();i++)
	{
		if(s[i]=='6') s[i]='9';
		else if(s[i]=='9') s[i]='6';
	}
	cout<<s<<"\n";

}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    #define int int64_t
    int a,b,c;
    map<int,int> p;
    cin>>a>>b>>c;
    p[a]+=1,p[b]+=1,p[c]+=1;
    if(p.size()==3){
        cout<<0<<endl;
    }
    else{
        for(auto c:p){
            int cnt = c.second;
            if(cnt==1 || cnt==3){
                cout<<c.first<<endl;
                return 0;
            }
        }
    }
    return 0;
}

/*---------------------------------------
   BISMILLAHIR RAHMANIR RAHIM
   AUTHOR : Md. Sajjat Hossen
   TIME :
----------------------------------------*/

#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  long double             ld;
typedef  unsigned long long      ull;
typedef  pair<int, int>          pii;
typedef  pair<ll, ll>            pll;
typedef  vector<int>             vi;
typedef  vector<ll>              vll;
typedef  tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds_set;
typedef  tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds_multiset;

inline int Int() { int x; scanf("%d", &x); return x; }
inline ll Long() { ll x; scanf("%lld", &x); return x; }

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

const int N       = (int) 2e5 + 5;
const int mxN     = (int) 1e6 + 6;
const int MOD     = (int) 1e9 + 7;
const int INF     = (int) 1e9 + 9;
const double EPS  = (double) 1e-9;

#define    debug(x)    cerr << #x << " = " << x << '\n';
#define    all(x)      x.begin(), x.end()
#define    szof(x)     (int) x.size()
#define    ff          first
#define    ss          second
#define    pb          push_back
#define    mp          make_pair
#define    PI          acos(-1.0)
#define    TN          typename
#define    nl          '\n'
#define    Fast_IO     ios_base::sync_with_stdio(false); cin.tie(nullptr);

inline int add(int a, int b, int mod) { a += b; return a >= mod ? a - mod : a < 0 ? a + mod : a; }
inline int mult(int a, int b, int mod) { return (ll) a * b % mod; }

template <TN T> inline void umin(T &x, T y) { x = x < y ? x : y; }
template <TN T> inline void umax(T &x, T y) { x = x > y ? x : y; }

template <TN T> T gcd(T a, T b) { return !b ? a : gcd(b, a % b); }
template <TN T> T lcm(T a, T b) { return a * (b / gcd(a, b)); }

int main() {
    // Fast_IO
    // clock_t tStart = clock();
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int test = 1, tc = 0;
    while (test--) {
        vi v(3, 0);
        v[0] = Int(), v[1] = Int(), v[2] = Int();
        if (v[0] == v[1]) printf("%d\n", v[2]);
        else if (v[0] == v[2]) printf("%d\n", v[1]);
        else if (v[1] == v[2]) printf("%d\n", v[0]);
        else printf("0\n");
    }
    // fprintf(stderr, "\nRuntime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  cout << (a+b)/2 << ' ' << (a-b)/2 << endl;
}


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

/*#include<atcoder/all>
using namespace atcoder;*/

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> pii;
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
#define pb push_back
#define mk make_pair
#define en '\n'

void solve(){
    float a,b;
    cin >> a >> b;
    cout << (a*b)/100 << en;
}

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

    //freopen("div7.in","r",stdin);
    //freopen("div7.out","w",stdout);

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

#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define sz(s) int(s.size())
#define deb(x) cout << #x": " << (x) << endl;
#define all(s) begin(s), end(s)
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;

lli f(lli u, lli v) {
  if(u == 0) return 0;
  if(u % v) return (v + u - (u % v)) / v;
  return u / v;
}

int main(){ _
  lli n, m;
  cin >> n >> m;
  if(m == 0) {
    cout << 1 << ENDL;
    return 0;
  }
  vi v(m); fore(i, 0, m) cin >> v[i];
  sort(all(v));
  lli prev = 0;
  lli mn = n;
  for(auto it : v) {
    lli aux = (it - prev - 1);
    prev = it;
    if(aux == 0) continue;
    mn = min(mn, aux);
  }
  lli aux = n - prev;
  if(aux != 0) mn = min(mn, aux);
  prev = 0;
  lli ans = 0;
  for(auto it : v) {
    lli aux = (it - prev - 1);
    prev = it;
    ans += f(aux, mn);
  }
  aux = n - prev;
  ans += f(aux, mn);
  cout << ans << ENDL;
  return 0;
}


#include <bits/stdc++.h>
#define Rajpoot ios_base::sync_with_stdio(0);   cin.tie(0);  cout.tie(0);
#define ll long long
#define loo(i,n) for(i=0;i<n;i++)
#define go(i,sp)  for(auto i=sp.begin();i!=sp.end();i++)
#define pb push_back
#define lb lower_bound
#define mo 1000000007
#define pi 3.14159265358979323846264338327950288419716939937510582
#define exp 2.71828182845904523536028747135266249775724709369995957
#define endl "\n"
using namespace std;

int main()
{
   Rajpoot
      //    freopen("input.txt","r",stdin);
      // freopen("output.txt","w",stdout);

    //int t; cin>>t;
   int t=1;
    while(t--)
    {
        ll a,b;
        cin>>a>>b; a=a+b;
        if(a>=15 && b>=8) cout<<1<<endl;
        else if(a>=10 && b>=3) cout<<2<<endl;
        else if(a>=3) cout<<3<<endl;
        else cout<<4<<endl;

    }

	return 0;
}

#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
#define mod(n) (n) % 1000000007
#define sp << " "
#define ff first
#define ss second
#define precision(n) cout << fixed << setprecision(n);
#define startTime time_t start, end;time(&start);
#define endTime time(&end);double tt = double(end-start);cout<<"Time taken : "<<fixed<<tt<<setprecision(5);cout <<" sec"<< endl;

using namespace std;

int main() {
    IOS;
    ll A, B;
    cin >> A >> B;
    if (A + B >= 15 && B >= 8) cout << 1 << endl;
    else if (A + B >= 10 && B >= 3) cout << 2 << endl;
    else if (A + B >= 3) cout << 3 << endl;
    else cout << 4 << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,i,j;
    cin >> a;
    set<int>st;
    vector<int>vec;
    for(i=0;i<=2*a+1;i++)
        st.insert(i);
    for(j=0;j<a;j++)
    {
        cin >> c;
        if(st.count(c))
        {
            st.erase(c);

        }
        vec.push_back(*st.begin());
    }
for(i=0;i<vec.size();i++)
{
    cout << vec[i] << " ";
}
cout << endl;

}

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

template<typename T> bool chmax( T &a, const T b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }

int main()
{
	ll n; cin >> n;
	vector<ll> p( n );
	rep( i, n ) cin >> p[i];
	priority_queue<ll, vector<ll>, greater<ll>> pq;
	map<ll, ll> m;
	rep( i, 200001 ) pq.push( i );

	rep( i, n )
	{
		m[p[i]]++;
		auto x = pq.top();
		while ( m[x] >= 1 )
		{
			pq.pop();
			x = pq.top();
		}
		cout << x << endl;
	}

	return ( 0 );
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	map<int,int> mm;
  	int n;
  cin>>n;
  for(int i=1;i<=n;i++){
  	int x;
    cin>>x;
    mm[x]++;
  }
  for(int i=1;i<=n;i++){
  	if(mm[i]!=1){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())

const unsigned int BIT_FLAG_0 = (1 << 0);  // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1);  // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2);  // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3);  // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4);  // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5);  // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6);  // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7);  // 0000 0000 1000 0000

const double PI = 3.14159265358979323846;

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

#define H_MAX 500
#define W_MAX 500
#define INF 1e9 + 7
const long long MOD = 998244353;

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

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

    for (int i = 0; i < N; i++)
    {
        if(i+1 != A[i]) {
            No;
            return 0;
        }
    }
    Yes;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
template<class T> using vvvc = vc<vvc<T>>;
template<class T> using vvvvc = vvc<vvc<T>>;
template<class T> using PQ = priority_queue<T>;
template<class T> using invPQ = priority_queue<T, vector<T>, greater<T>>;
using IP = pair<int, int>;
using LP = pair<ll, ll>;
#define mp make_pair
#define pb push_back
#define all(x) begin(x), end(x)
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); i++)
#define repr(i, n) for (int i = n; (i) >= (int)(n); i--)
#define rep3r(i, m, n) for (int i = (n); (i) >= (int)(m); i--)
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; }
constexpr int INF = 1070000000;
constexpr long long LINF = 4611686015206162431;
template <class T> void checkarray(T &v) { for (auto &a : v) cout << a << " "; cout << endl; }

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

    ll N;
    cin >> N;

    ll ans = N;
    int ssize = sqrtl(N);
    vc<bool> seen(ssize+1);
    for (ll i = 2; i*i <= N; i++) {
        if (seen[i]) continue;
        ll n = i;
        while (n < N) {
            n *= i;
            if (n <= N) {
                ans--;
                if (n <= ssize) seen[n] = true;
            }
        }
    }

    cout << ans << endl;
}

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

int main(){
  long long n; cin >> n;
  set<long long> s;
  for(long long i=2;i*i<=n;i++){
    long long x=i*i;
    while(x<=n){
      s.insert(x);
      x*=i;
    }
  }

  cout << n-s.size() << endl;
}


#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int x[N],y[N];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            double res=abs((double)y[i]-y[j])/abs((double)x[i]-x[j]);
            if(res>=-1 && res<=1) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>

#define fileio                                                  \
    freopen("C:\\Users\\PRISM17\\Desktop\\in.txt", "r", stdin); \
    freopen("C:\\Users\\PRISM17\\Desktop\\out.txt", "w", stdout);
#define fastio                   \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define dbg(x) cout << #x << " : " << x << endl;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const int inf = 0x3f3f3f3f;
const int INF = 1e9;
const int mod = 1e9 + 7;

const int N = 4e5 + 7;
int fa[N], vis[N];
int find(int x) {
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

int main() {
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i < N; i++) fa[i] = i;
    for (int i = 1, u, v; i <= n; i++) {
        cin >> u >> v;
        u = find(u), v = find(v);
        if (u != v && (!vis[u] || !vis[v])) fa[u] = v, vis[v] |= vis[u], ++ans;
        else if (!vis[u]) ++ans, vis[u] = 1;
    }
    cout << ans << endl;
}


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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min<ll>(a,b)
#define rmax(a,b) a = max<ll>(a,b)

#define fi first
#define se second

const int N = 2e5+10;
int dp_pego[N], dp_val[N], dp_qnt[N];

vector<int> g[N];
int mdist;

void dfs(int no, int from){
	//prin(no);
	int dist_prox_pego = INT_MAX/2, dist_longe_need = 0;
	dp_qnt[no] = 0;
	for(auto &it : g[no]){
		if(it==from) continue;
		dfs(it,no);
		dp_qnt[no]+=dp_qnt[it];
		if(dp_pego[it]){
			rmin(dist_prox_pego,dp_val[it]+1);
		} else{
			rmax(dist_longe_need,dp_val[it]+1);
		}
	}
	if(dist_prox_pego<=mdist){
		if(dist_prox_pego+dist_longe_need<=mdist){
			dp_pego[no] = 1;
			dp_val[no] = dist_prox_pego;
		} else{
			if(dist_longe_need==mdist){
				dp_qnt[no]++;
				dp_pego[no] = 1;
				dp_val[no] = 0;
			} else{
				dp_pego[no] = 0;
				dp_val[no] = dist_longe_need;
			}
		}
	} else{
		if(dist_longe_need==mdist){
			dp_qnt[no]++;
			dp_pego[no] = 1;
			dp_val[no] = 0;
		} else{
			dp_pego[no] = 0;
			dp_val[no] = dist_longe_need;
		}
	}
	if(no==0 and !dp_pego[no]) dp_qnt[no]++;
}

int need(int _mdist){
	mdist = _mdist;
	dfs(0,-1);
	return dp_qnt[0];
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n, k; cin >> n >> k;
	fr(i,n-1){
		int a, b; cin >> a >> b; a--,b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	int lo = 1, hi = n;
	while(lo<hi){
		int mid = (lo+hi)/2;
		if(need(mid)<=k) hi = mid;
		else lo = mid+1;
	}
	cout << lo << "\n";
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 10, inf = 0x3f3f3f3f;
vector<int>e[N];
int n, k, mid, ret;
int f[N], g[N];
void dfs(int u, int fa) {
    g[u] = 0, f[u] = inf;
    for (int v : e[u]) {
        if (v == fa)continue;
        dfs(v, u);
        f[u] = min(f[u], f[v] + 1);
        g[u] = max(g[u], g[v] + 1);
    }
    if (f[u] + g[u] <= mid) g[u] = -inf;
    else if (g[u] == mid) f[u] = 0, g[u] = -inf, ret++;
}
bool check() {
    ret = 0;
    dfs(1, 0);
    if (g[1] >= 0)ret++;
    return ret <= k;
}
void solve() {
    cin >> n >> k;
    for (int i = 1, u, v; i < n; ++i) {
        cin >> u >> v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    int l = 0, r =  n, ans = n;
    while (l <= r) {
        mid = (r + l) >> 1;
        if (check())r = mid - 1, ans = mid;
        else l = mid + 1;
    }
    cout << ans;
}
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    solve();
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  //external policy based dsa accociate container
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define fbo                   find_by_order  // return pointer to kth element
#define ook                   order_of_key   // return number of element strictly less than a given value
#define ff                    first
#define ss                    second
#define int                   long long int
#define pb                    push_back
#define mp                    make_pair
#define pii                   pair<int,int>
#define vi                    vector<int>
#define mii                   map<int,int>
#define pqb                   priority_queue<int>
#define pqs                   priority_queue<int,vi,greater<int> >

#define setbits(x)            __builtin_popcountll(x)
#define zrobits(x)            __builtin_ctzll(x)

#define max_ull               18446744073709551615
#define max_ll                9223372036854775807
#define eps                   1e-10
#define mod                   1000000007
#define inf                   1e18

#define ps(x,y)               fixed<<setprecision(y)<<x
#define mk(arr,n,type)        type *arr=new type[n];

#define w(x)                  int x; cin>>x; while(x--)

//#define rep(a,b,c)            for(i=a;i<=b;i+=c)
#define min3(a, b, c)         min(a, min(b, c))
#define max3(a, b, c)         max(a, max(b, c))
#define min4(a, b, c, d)      min(min(a, b), min(c, d))
#define max4(a, b, c, d)      max(max(a, b), max(c, d))
#define max5(a, b, c, d, e)   max(max3(a, b, c), max(d, e))
#define min5(a, b, c, d, e)   min(min3(a, b, c), min(d, e))

#define lead_zero(x)          __builtin_clzll(x)
#define trail_zero(x)         __builtin_ctz(x)
#define total_1s(x)           __builtin_popcount(x)
#define first_1(x)            __builtin_ffs(x)
#define log2_(x)              __builtin_clz(1) - __builtin_clz(x)

#define isLeap(x)             ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define set(N, cur)           N = (N | (1 << cur))
#define reset(N, cur)         N = (N & (~(1 << cur)))
#define check(N, cur)         ((N & (1 << cur)) == 0)

mt19937                       rng(chrono::steady_clock::now().time_since_epoch().count());

typedef unsigned long long    ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

/* Direction arrays */
/* int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1}; */                        // 4 Direction
/* int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */   // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */            // Hexagonal Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */            // Hexagonal Direction
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
}
// int powe(int n,int k,int mod1)
// {
//     int res=1;
//     while(k!=0)
//     {
//         if(k&1)
//             res=(res*n)%mod1;
//         k=k/2;
//         n=(n*n)%mod1;
//     }
//     return res;
// }
// int seive[100005];
// void me()
// {

//     int n=100005;
//     for(int i=0;i<n;i++)
//     {
//         seive[i]=1;
//     }
//     seive[0]=0;
//     seive[1]=0;
//     for(int i=2;i*i<=n;i++)
//     {
//         if(seive[i]==1)
//         {
//             for(int j=i*i;j<=n;j+=i)
//                 seive[j]=0;
//         }
//     }
// }
main()
{
  c_p_c();
  int n,a,b;
  cin>>n>>a>>b;
  int ans=(n-a)+b;
  cout<<ans<<endl;
}

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

int n ;
int A[1007] ;

int main(){
    cin >> n ;
    rep(i,n) cin >> A[i] ;
    int sum = 0 ;
    rep(i,n){
        if(A[i] > 10) sum += A[i] - 10 ;
    }
    cout << sum << endl ;
}


#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a, b, c, d, ans = 3;
  cin >> a >> b >> c >> d;
  ll x = c - a, y = d - b;
  if (c == a && d == b)
    ans = 0;
  else if (x == y || x == -y || abs(x) + abs(y) <= 3)
    ans = 1;
  else if ((x + y) % 2 == 0 || abs(x + y) <= 3 || abs(x - y) <= 3 ||
           abs(x) + abs(y) <= 6)
    ans = 2;
  cout << ans << endl;
  return 0;
}

#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
void local() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

signed main() {
    IOS;
    //local();

    int a[3]; cin>>a[0]>>a[1]>>a[2];
    sort(a, a+3);
    if(a[0]==a[1] ) cout<<a[2];
    else if(a[1]==a[2]) cout<<a[0];
    else cout<<0;

    return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 1e3+5;
const int mod = 1e9+7;
using namespace std;

ll mp[maxn][maxn];

void solve() {
	int n; cin >> n;
	ll k = 1e18;
	bool ok = 1;
	vector<ll> a(n), b(n);
	rep(i,0,n) rep(j,0,n) cin >> mp[i][j];
	rep(i,0,n) k = min(k, mp[0][i]);
	rep(i,0,n) {
		b[i] = mp[0][i] - k;
		if (b[i] < 0) {
			ok = 0;
			break;
		}
	}
	a[0] = k;
	rep(i,1,n) {
		a[i] = mp[i][0] - b[0];
		if (a[i] < 0) {
			ok = 0;
			break;
		}
		rep(j,0,n) {
			if (a[i] + b[j] != mp[i][j]) {
				ok = 0;
				break;
			}
		}
	}
	if (ok) {
		cout << "Yes\n";
		rep(i,0,n) cout << a[i] << " \n"[i==n-1];
		rep(i,0,n) cout << b[i] << " \n"[i==n-1];
	} else cout << "No\n";
}

int main(int argc, char * argv[]) {
	ios_base::sync_with_stdio(false); cin.tie(0);
	//int t; cin >> t; while(t--)
	solve();

    return 0;
}


#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <tuple>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <random>
#include <chrono>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    int N;
    scanf("%d", &N);
    vector<int> A(N, 0);
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);
    vector<LL> psum(N, 0);
    for (int i = 0; i < N; i++) {
        if (i) psum[i] = psum[i - 1];
        int offs = 1;
        if (i % 2) offs = -1;
        psum[i] += offs * A[i];
    }
    map<LL, int> cnt;
    cnt[0] = 1;
    LL ans = 0;
    for (int i = 0; i < N; i++) {
        LL cur = psum[i];
        ans += cnt[cur];
        cnt[cur]++;
    }
    printf("%lld\n", ans);

    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
by Benq;
*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll mod = 1e9 + 7;
const ll linf = 1LL << 62;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

ll ans, N, L;
vector<int> A, B;

int main() {
    cin >> N >> L;
    int pre = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        A.push_back(a - pre - 1);
        pre = a;
    }
    A.push_back(L - pre);
    A.push_back(0);
    pre = 0;
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        B.push_back(b - pre - 1);
        pre = b;
    }
    B.push_back(L - pre);
    int idx = 0, l = 0, r = 0;
    for (int i = 0; i < N + 1; i++) {
        if (B[i] == 0) continue;
        while (A[idx] == 0) idx++;
        l = idx, r = idx;
        int sum = 0;
        for (; idx < N + 2; idx++) {
            if (sum >= B[i]) break;
            sum += A[idx];
            r = idx;
        }
        if (sum != B[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans += max(i - l, 0) + max(r - i, 0);
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 5e2 + 7;
int n , m;
vector<pair<int,int> > adj[N * N * 2] ;
int d[N * N * 2] ;

int id(int x, int y){
       return x * m + y ;
}

void edge(int u ,int v, int c){
       adj[u].push_back({v , c}) ;
}

int dijkstra(int st, int en){
       for(int i = 0 ;i < N * N * 2 ;++ i)d[i] = 1e9 ;
       d[st] = 0 ;

       priority_queue<pair<int,int> > pq ;
       pq.push({0 , st}) ;

       while(pq.size()){
              int dst = -pq.top().first ;
              int node = pq.top().second ;
              pq.pop() ;

              for(auto u : adj[node]){
                     if(dst + u.second < d[u.first]){
                            d[u.first] = dst + u.second;
                            pq.push({-d[u.first] , u.first}) ;
                     }
              }
       }

       return d[en] ;
}

int main()
{
       ios_base::sync_with_stdio(0);
       cin.tie(0);
#ifndef ONLINE_JUDGE
       freopen("in.in", "r", stdin);
#endif

       cin >> n >> m;

       for(int i = 0 ;i < n; ++ i){
              for(int j = 0 ;j + 1<m ; ++ j){
                     int x; cin >> x;
                     edge( id(i , j) , id(i , j + 1) , x ) ;
                     edge( id(i, j + 1) , id(i , j) , x ) ;
              }
       }

       for(int i = 0 ; i + 1 < n; ++ i){
              for(int j = 0 ;j < m; ++ j){
                     int x; cin >> x;
                     edge( id(i , j) , id(i + 1, j) , x ) ;
              }
       }

       for(int i = 0 ;i < n;++ i){
              for(int j = 0 ;j < m ;++ j){
                     edge( id(i , j) , id(i , j) + n * m , 1 ) ;
                     edge( id(i, j) + n * m, id(i , j) , 0 ) ;
                     if(i > 0){
                            edge( id(i , j) + n * m, id(i -1, j) + n * m , 1 ) ;
                     }
              }
       }
       cout << dijkstra(0 , n * m - 1) ;
       return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int b = nextLong();
  int N = (1 << b);

  vector<int> A(N);
  REP(i, N) A[i] = nextLong();

  int h = max_element(ALL(A)) - A.begin();
  int ans = -1;
  if (h >= N/2) {
    ans = max_element(A.begin(), A.begin() + N/2) - A.begin();
  } else {
    ans = max_element(A.begin() + N/2, A.begin() + N) - (A.begin());
  }
  cout << (1+ans) << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


#include <bits/stdc++.h>
#include<vector>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;

int main(){
	int n;
	cin>>n;
	ll sum=0;
	ll ans=0;
	ll a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=0;i<n;i++){
		ans+=(a[i]*a[i])*(n-1);
		sum-=a[i];
		ans-=2*a[i]*sum;
	}
	cout<<ans;

	return 0;
}

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

int main() {
  ll N;
  cin >> N;
  vector<ll> cnt(401);
  for (ll i = 0; i < N; i++) {
    ll A;
    cin >> A;
    cnt[A + 200]++;
  }
  ll ans = 0;
  for (ll i = 0; i <= 400; i++)
    for (ll j = 0; j < i; j++) ans += (i - j) * (i - j) * cnt[i] * cnt[j];
  cout << ans << endl;
}


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

int main(){
  int k;
  int atime,btime;
  vector<int> A;
  vector<int> B;
  cin>>k;
  for (int i=0;i<k;i++){
    int a,b;
    cin>>a>>b;
    A.push_back(a);
    B.push_back(b);
  }
  atime=*min_element(A.begin(),A.end());
  B[distance(A.begin(),min_element(A.begin(),A.end()))]+=atime;
  btime=*min_element(B.begin(),B.end());
  cout<<max(atime,btime);
}

#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i = a;i<=b;++i)
#define For_(i,a,b) for(int i = a;i>=b;--i)
#define endl '\n'
#define IOS ios::sync_with_stdio(false)
typedef long long LL;
inline int read(){
    int r = 0,f = 1;
    char c = getchar();
    while(c<'0' || c >'9'){
        if(c =='-') f = -1;
        c = getchar();
    }
    while(c>='0' && c<='9'){
        r = (r<<1) + (r<<3) + c - '0';
        c = getchar();
    }
    return r * f;
}
#define max3(a,b,c) max(a,max(b,c));
const int N = 500000+ 5 ,M = N , INF = 0x3f3f3f3f;
int n,m;
long long s1,s3;
unsigned long long s2;
int main(){
    n = read();
    For(i,1,n){
        int x = read();
        x = abs(x);
        s1 += x;
        s2 += x*(LL)x;
        s3 = max(s3,(LL)x);
    }

    cout<<s1<<'\n';
    double ans2 = (double)sqrt(s2);
    printf("%.15lf\n",ans2);
    cout<<s3<<'\n';
    //system("pause");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

#define DIVIDER 1000000007LL

ll solve(ll N, ll A, ll B) {
  if (A + B > N) {
    return 0;
  }

  ll retv = (((N - A + 1) * (N - A + 1)) % DIVIDER) *
            (((N - B + 1) * (N - B + 1)) % DIVIDER);
  retv %= DIVIDER;

  ll x = (N - A + 1) * (N - B + 1) - (N - A - B + 1) * (N - A - B + 2);
  x = x % DIVIDER;
  retv = (retv - ((x * x) % DIVIDER) + DIVIDER) % DIVIDER;
  return retv;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int T;
  cin >> T;

  // main procedure
  vector<ll> ans;
  for (size_t i = 0; i < T; i++) {
    ll N, A, B;
    cin >> N >> A >> B;
    ans.push_back(solve(N, A, B));
  }

  // output
  for (size_t i = 0; i < T; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

#pragma GCC optimize("O3")
#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;
#define ordered_set     tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k):    It returns to an iterator to the kth element (counting from zero) in the set
// order_of_key(k) :    It returns to the number of items that are strictly smaller than our item k
#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb              push_back
#define f               first
#define s               second
#define F(i,a,b)        for(i=a;i<b;i++)
#define nl              "\n"
#define sp              " "
#define all(c)          (c).begin(),(c).end()
#define rev(i,b,a)      for(int i=b;i>=a;i--)
#define iota            cout<<-1<<nl
#define cty             cout<<"YES"<<nl
#define ctn             cout<<"NO"<<nl
#define lmax            LLONG_MAX
#define lmin            LLONG_MIN
#define sz(v)           (v).size()
#define deci(n)         fixed<<setprecision(n)
#define c(x)            cout<<(x)
#define csp(x)          cout<<(x)<<" "
#define c1(x)           cout<<(x)<<nl
#define c2(x,y)         cout<<(x)<<" "<<(y)<<nl
#define c3(x,y,z)       cout<<(x)<<" "<<(y)<<" "<<(z)<<nl
#define c4(a,b,c,d)     cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<nl
#define c5(a,b,c,d,e)   cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<nl
#define c6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<nl
typedef long double     ld;
typedef long long       ll;
typedef vector<ll>      vll;
typedef pair<ll,ll>     pll;
typedef vector<pll>     vpll;
const int mod=998244353;
const int mod1=1000000007;
const double pi=3.14159265358979323846264338327950288419716939937510582097494459230;
// priority_queue<t>
ll max(ll a , ll b){ if(a>b)return a; return b;}
ll min(ll a , ll b){ if(a<b)return a; return b;}
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll pct(ll x) { return __builtin_popcount(x); } // # of bits set
ll poww(ll a, ll b) { ll res=1; while(b) { if(b&1)	res=(res*a); a=(a*a); b>>=1; } return res; }
ll modI(ll a, ll m=mod) { ll m0=m,y=0,x=1;  if(m==1) return 0;  while(a>1)  { ll q=a/m; ll t=m;  m=a%m;  a=t; t=y; y=x-q*y;  x=t; } if(x<0) x+=m0; return x;}
ll powm(ll a, ll b,ll m=mod) {ll res=1;	while(b) {	if(b&1)	res=(res*a)%m;	a=(a*a)%m; b>>=1;	}	return res;}
//*******************************************************************************************************************************************//
void iamzeus()
{ ll i,j,x=0,y,ans=0,n,m,d,cnt=0,z,c=2,k;
  cin>>n;
 vpll v(n);
 for(i=0;i<n;i++)cin>>v[i].f>>v[i].s;
 vector<pair<pll,ll>>v1,v2;
 for(i=0;i<n;i++)
 {
     v1.pb({{v[i].f,v[i].s},i});
     v2.pb({{v[i].s,v[i].f},i});

 }
 sort(all(v1));
 sort(all(v2));
 vector<pair<ll,pll>>v4;
 v4.pb({v1[n-1].f.f-v1[0].f.f,{min(v1[n-1].s,v1[0].s),max(v1[n-1].s,v1[0].s)}});
  v4.pb({v1[n-1].f.f-v1[1].f.f,{min(v1[n-1].s,v1[1].s),max(v1[n-1].s,v1[1].s)}});
 v4.pb({v1[n-2].f.f-v1[0].f.f,{min(v1[n-2].s,v1[0].s),max(v1[n-2].s,v1[0].s)}});
 v4.pb({v2[n-1].f.f-v2[0].f.f,{min(v2[n-1].s,v2[0].s),max(v2[n-1].s,v2[0].s)}});
  v4.pb({v2[n-1].f.f-v2[1].f.f,{min(v2[n-1].s,v2[1].s),max(v2[n-1].s,v2[1].s)}});
 v4.pb({v2[n-2].f.f-v2[0].f.f,{min(v2[n-2].s,v2[0].s),max(v2[n-2].s,v2[0].s)}});
sort(all(v4),greater<pair<ll,pll>>());
 map<pll,ll>mp;
 cnt=0;
 for(auto u:v4)
 {
     if(mp.find({u.s.f,u.s.s})==mp.end())
     {
         cnt++;
         if(cnt==2)
         {
             c1(u.f);
             return;
         }
     }
     mp[{u.s.f,u.s.s}]=1;
 }

};
int main()
{fast;
    int t;
 t=1;
//cin >>t;
 while(t--)
     iamzeus();
}


#include <bits/stdc++.h>
#define rep(i, begin, end) for (i=begin;i<end;i++)
#define printint(i0, i1) printf("%d %d\n", i0, i1)
#define MAX_N 1000

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
ll i, j, n, m, k, ans, l;
ll rest[10], takahashi[10], aoki[10];
string s, t;

int main() {
    scanf(" %lld", &k);
    rep(i,1,10) {
        rest[i] = k;
        takahashi[i] = 0;
        aoki[i] = 0;
    }
    cin >> s;
    cin >> t;

    rep(i,0,4) {
        takahashi[s[i] - '0']++;
        aoki[t[i] - '0']++;
        rest[s[i] - '0']--;
        rest[t[i] - '0']--;
    }
    ll cnt = 0;
    rep(i,1,10) {
        rep(j,1,10) {
            if (rest[i] == 0 || rest[j] == 0) continue;
            takahashi[i]++; aoki[j]++;
            ll score_t = 0, score_a = 0;
            rep(l, 1, 10) {
                score_t += l * pow(10, takahashi[l]);
                score_a += l * pow(10, aoki[l]);
            }
            if (score_t > score_a) cnt += i != j ? rest[i] * rest[j] : rest[i] * (rest[i] - 1);
            takahashi[i]--; aoki[j]--;
        }
    }
    double all = (9 * k - 8) * (9 * k - 9);
    printf("%12.10lf\n", (double)cnt / all);
}

// 問題の URL を書いておく
//

#include <bits/stdc++.h>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = long long;

int calcScore(vector<ll>& hand)
{
    ll score = 0;
    rep(i, 9)
    {
        auto ti = 1 + i;
        score += ti * (ll)pow(10, hand[ti]);
    }
    return score;
}

int main(int, const char**)
{
    ll K;
    cin >> K;
    string S, T;
    cin >> S >> T;
    vector<ll> nums(10, K);

    vector<vector<ll>> hands(2, vector<ll>(10, 0));

    rep(i, 4)
    {
        auto sn = S[i] - '0';
        hands[0][sn]++;
        nums[sn]--;

        auto tn = T[i] - '0';
        hands[1][tn]++;
        nums[tn]--;
    }

    set<pair<int, int>> wp;
    for(int i = 1; i <= 9; ++i)
    {
        for(int j = 1; j <= 9; ++j)
        {
            if(i == j)
            {
                if(!(nums[i] >= 2)) continue;
            }
            if(!(nums[i] >= 1)) continue;
            if(!(nums[j] >= 1)) continue;
            hands[0][i]++;
            hands[1][j]++;
            auto ts = calcScore(hands[0]);
            auto as = calcScore(hands[1]);
            hands[0][i]--;
            hands[1][j]--;
            if(ts > as)
            {
                wp.insert({i, j});
            }
        }
    }

    ll u = 0;

    for(auto& p : wp)
    {
        if(p.first == p.second)
        {
            u += nums[p.first] * (nums[p.first] - 1);
        }
        else
        {
            u += nums[p.first] * nums[p.second];
        }
//        printf("%d, %d\n", p.first, p.second);
    }
    ll d = (K * 9 - 8) * (K * 9 - 9);
    auto ans = u / (double)d;
    printf("%.10f\n", ans);

    return 0;
}


//pragma region Macros
// #pragma GCC target("avx2")
#pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define SUM(v) accumulate(all(v), 0LL)
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
using ll=long long int ;

int main()
{
	/*int t ;
	cin>>t;
	while(t--)
	{  */

	ll k ;
    cin>>k;

    ll ans =0;

    for(int x=1;x<=k;x++)
    {
      for(int y=1;x*y<=k;y++)
      {
        for(int z=1;x*y*z<=k;z++)
        {
          if(x*y*z<=k)
            ans++;
        }
      }
    }

  cout<<ans<<endl;

   // }
	return 0;
}

#include<stdio.h>
#define putint(a) printf("%lld\n", a)
#define nextint(a) scanf("%lld\n", &a)
int N;
int main(){
  if(nextint(N)==1){
    int ans = 0;
    for(long long int i=1; i<=N; i++){
      for(int j=1; i*j<=N; j++){
        ans+= N/(i*j);
      }
    }
    putint(ans);
  }
}


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

int H, W;
char grid[2009][2009];
int memo[2009][2009];
int INF = 10000000;
int MARKER = 2*INF;

int score(int x, int y) {
  if (grid[x][y] == '+') return 1;
  if (grid[x][y] == '-') return -1;
  assert(false);
}

int p1_advantage(int x, int y) {

  if (memo[x][y] != MARKER) return memo[x][y];

  int px = -INF;
  int py = -INF;

  if (x + 1 < H) px = score(x+1, y) - p1_advantage(x+1, y);
  if (y + 1 < W) py = score(x, y+1) - p1_advantage(x, y+1);

  if (px == -INF && py == -INF) return memo[x][y] = 0;

  return memo[x][y] = max(px, py);
}

int main() {

  cin >> H >> W;
  for (int i=0; i<H; i++) for (int j=0; j<W; j++) {
    cin >> grid[i][j];
    memo[i][j] = MARKER;
  }

  for (int i=0; i<H; i++) for (int j=0; j<W; j++) {
    char c = grid[i][j];
    assert(c == '+' || c == '-');
  }

  int r = p1_advantage(0, 0);

  if (r == 0) cout << "Draw" << endl;
  if (r > 0) cout << "Takahashi" << endl;
  if (r < 0) cout << "Aoki" << endl;

  return 0;
}

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD
#define MODSUB(SUB_X,SUB_Y)  ((SUB_X-SUB_Y)+MOD)%MOD
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD
#define LCM(LCM_X,LCM_Y) (LCM_X/__gcd(LCM_X,LCM_Y))*LCM_Y
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int dp[2025][2025][2],vis[2025][2025][2],mat[2025][2025],n,m;
pair<int,int> recur(int x,int y,int f)
{
    if(x==n || y==m)
        return {0,0};
    if(vis[x][y][f])
        return {dp[x][y][0],dp[x][y][1]};
    vis[x][y][f]=1;

    if(!f)
    {
        pair<int,int>r= {0,0},d= {0,0},ans= {0,0};
        if(x+1<n && y+1<m)
        {
            d=recur(x+1,y,f^1);
            d.first+=mat[x+1][y];
            r=recur(x,y+1,f^1);

            r.first+=mat[x][y+1];

            if(r.first-r.second>d.first-d.second)
                ans=r;
            else
                ans=d;
        }
        else if(x+1<n)
        {
            ans=recur(x+1,y,f^1);
            ans.first+=mat[x+1][y];
        }
        else if(y+1<m)
        {
            ans=recur(x,y+1,f^1);
            ans.first+=mat[x][y+1];
        }
        dp[x][y][0]=ans.first;
        dp[x][y][1]=ans.second;
       // cout<<x<<" "<<y<<" "<<ans.first<<endl;
        return ans;
    }
    else
    {
        pair<int,int>r= {0,0},d= {0,0},ans= {0,0};
        if(x+1<n && y+1<m)
        {
            d=recur(x+1,y,f^1);
            d.second+=mat[x+1][y];

            r=recur(x,y+1,f^1);
            r.second+=mat[x][y+1];

            if(r.second-r.first>d.second-d.first)
                ans=r;
            else
                ans=d;
        }
        else if(x+1<n)
        {
            ans=recur(x+1,y,f^1);
            ans.second+=mat[x+1][y];
        }
        else if(y+1<m)
        {
            ans=recur(x,y+1,f^1);
            ans.second+=mat[x][y+1];
        }
        dp[x][y][0]=ans.first;
        dp[x][y][1]=ans.second;
        if(x==2 && y==2)
            bug
        return ans;
    }
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);

    cin>>n>>m;
    for(int i=0; i<n; i++)
    {
        string s;
        cin>>s;
        for(int j=0; j<m; j++)
        {
            if(s[j]=='+')
                mat[i][j]=1;
            else
                mat[i][j]=-1;
        }
    }
    pair<int,int>p=recur(0,0,0);

    if(p.first>p.second)
        cout<<"Takahashi"<<endl;
    else if(p.first<p.second )
        cout<<"Aoki"<<endl;
    else
        cout<<"Draw"<<endl;

    return 0;
}


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> //Policy Based Data Structure
// using namespace __gnu_pbds;              //Policy Based Data Structure
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; //Policy Based Data Structure
// #define gc              getchar_unlocked
// #define pqb             priority_queue<int>
// #define pqs             priority_queue<int, vi, greater<int> >
// #define mk(arr,n,type)  type *arr = new type[n]
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int             long long
#define nn              '\n'
#define w(t)            cin>>tc; while(tc--)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x,y)       cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define all(x)          x.begin(), x.end()
#define clr(x)          memset(x, 0, sizeof(x))
#define sortall(x)      sort(all(x))
#define tr(it,a)        for(auto it = a.begin(); it != a.end(); it++)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define PI              3.1415926535897932384626
#define inf             1e18
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());  //Random Shuffler
typedef pair<int, int>   pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
typedef map<int, int>    mii;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
// const int N = 3e5, M = N;
// vi g[N];
// no of prime numbers in range : (70,19) , (1000,168) , (100000,1229) , (sqrt(10^9),3409)
//=======================

void sol()
{
	int i, j, k, t, n, x, y, z, m, tc;
	string s;
	cin >> n >> m >> t;
	y = n;
	int a[m], b[m];
	bool bo = true;
	fo(i, m)
	cin >> a[i] >> b[i];
	int prev = 0;
	fo(i, m)
	{
		n -= (a[i] - prev);
		if (n <= 0)
		{
			bo = false;
			break;
		}
		n = min(n + b[i] - a[i], y);
		prev = b[i];
	}
	if (bo)
	{
		n -= (t - prev);
		if (n <= 0)
			cout << "No" << nn;
		else
			cout << "Yes" << nn;
	}
	else
	{
		cout << "No" << nn;
	}
}

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

	sol();

	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % mod;
		base = (base * base) % mod;
		exp >>= 1;
	}
	return result;
}

// void ipgraph(int n, int m){
//     int i, u, v;
//     while(m--){
//         cin>>u>>v;
//         g[u-1].pb(v-1);
//         g[v-1].pb(u-1);
//     }
// }
//
// void dfs(int u, int par){
//     for(int v:g[u]){
//         if (v == par) continue;
//         dfs(v, u);
//     }
// }

#include<iostream>
using namespace std;

int main()
{
	int a , b , c , d ,x ,y ,diff;

	cin >> a >> b ;

	cout << endl ;

	cin >> c >> d ;

	x = a ;
	y = c ;
	diff = x - y ;

    while ( x <= b )
    {
    	y = c ;

    	while ( y <= d)
    	{
    		int temp_diff;

    		if( y > d) break ;

    		temp_diff = x - y ;

    		if(temp_diff > diff)
    		{
    			diff = temp_diff ;
			}

            y++;
		}

		//increment in x

		++x ;
	}

	cout << diff ;

	return 0;
}


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
#define REP_R(i, n) for (int i = (int)(n)-1; (i) >= 0; --(i))
#define REP3R(i, m, n) for (int i = (int)(n)-1; (i) >= (int)(m); --(i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;

template <typename T>
void print_vector(T& vec) {
    stringstream ss;
    //ss << "{";
    for (auto v : vec) ss << v << " ";
    //ss << "}" << endl;
    cout << ss.str() << endl;
}

template <typename T>
void print_pairs(T& vec) {
    stringstream ss;
    ss << "{";
    for (auto v : vec) ss << v.first << "," << v.second << " ";
    ss << "}" << endl;
    cout << ss.str() << endl;
}

template <typename T>
string string_vector(vector<T>& vec) {
    stringstream ss;
    //ss << "{";
    for (auto v : vec) ss << v << endl;
    //ss << "}\n";
    return ss.str();
}

template <typename T>
string string_vector(vector<vector<T>>& vec) {
    stringstream ss;
    //ss << "{";
    for (auto v : vec) {
        //ss << "{";
        for (auto vv : v) ss << vv << " ";
        //ss << "}";
    }
    //ss << "}\n";
    return ss.str();
}

using ll = long long;
class Solution {
   public:
    vector<int> seen;
    vector<int> loc;

    vector<int> solve(int N, vector<ll>& P) {
        int val = 1, pos = 0, start;
        vector<int> res;

        for(int i = 1; i <=N ; ++i) {
            if(loc[i] == i ) continue;
            for (int j = loc[i] - 1; j >= i; j--) {
                if(seen[j]++) {
                    res.clear();
                    return res;
                }

                loc[P[j]] = j+1;
                loc[P[j+1]] = j;
                swap(P[j], P[j+1]);
                res.push_back(j);
            }
        }
        return res;
    }
};

// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    Solution sol;
    int N;
    cin >> N;
    vector<ll> P(N+1);
    sol.loc.resize(N+1);
    sol.seen.resize(N+1);
    REP (i, N) { cin >> P[i+1]; sol.loc[ P[i+1] ] = i+1;}
    vector<int> ans = sol.solve(N, P);
    if(ans.size() != N - 1) cout << -1 << endl;
    else cout << string_vector(ans) << endl;
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" "
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
// #define no cout<<"NO\n";
// #define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
void no()
{
    cout<<-1<<endl;
    exit(0);
}
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;cin>>n;
    vector<int>a(n);in(a,n);
    vector<int>b(n);in(b,n);
    vector<int>p(n);in(p,n);
    vector<int>inv(n);
    for (int i = 0; i < n; ++i)
    {
        p[i]--;
        inv[p[i]]=i;
    }

    // return 0;
    vpr operations;
    vb completed(n,false);
    for(int i=0;i<n;i++)
    {
        if(completed[i])
            continue;
        int u=i;
        vector<int>cycle;
        while(p[u]!=i)
        {
            cycle.pb(u);
            completed[u]=true;
            u=p[u];
        }
        // continue;
        cycle.pb(u);
        completed[u]=true;
        if(sz(cycle)!=1)
        {
            priority_queue<pi,vector<pi>,greater<pi> > que;
            for(auto it:cycle)
            {
                que.push({a[it],it});
            }
            for(int j=0;j<cycle.size()-1;j++)
            {
                int lightest_i=que.top().second;
                que.pop();
                if(b[p[lightest_i]] >= a[lightest_i])
                    no();
                int a=inv[lightest_i];
                operations.pb({lightest_i,a});
                int b=p[lightest_i];
                inv[b]=a;
                p[a]=b;
            }
        }
    }
    cout<<operations.size()<<endl;
    for(auto it:operations)
        cout<<it.first+1<<" "<<it.second+1<<endl;
    return 0;
}


//
// Created by whq on 2021/2/20.
//

#include <bits/stdc++.h>

#define uset unordered_set
#define umap unordered_map
#define debug cout<<"ok"<<endl
#define ll long long
#define ii pair<ll, ll>
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vvl vector<vector<ll>>
#define vl vector<ll>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define For(i, n) for (int i = 0; i < n; i++)
#define forn(i, a, b) for(int i=a;i<=b;i++)
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define lowbit(x) x&(-x)
using namespace std;
class A{
public:
    void solve(){
        int x;
        cin>>x;
        cout<<100-x%100<<endl;
    }
};
class B{
public:
    void solve(){
        string s;
        cin>>s;
        int n=s.size();
        bool ok=true;
        for(int i=0;i<n;i++){
            if(i%2==0&&isupper(s[i])) {
                ok=false;
                break;
            }
            if(i%2==1&&islower((s[i]))){
                ok=false;
                break;
            }
        }
        if(ok) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    B ans;
    ans.solve();
    return 0;
}

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

#define rep(i,_l,_r) for(signed i=(_l),_end=(_r);i<=_end;++i)
#define fep(i,_l,_r) for(signed i=(_l),_end=(_r);i>=_end;--i)
#define erep(i,u) for(signed i=head[u],v=to[i];i;i=nxt[i],v=to[i])
#define efep(i,u) for(signed i=Head[u],v=to[i];i;i=nxt[i],v=to[i])
#define print(x,y) write(x),putchar(y)
//#define debug(...) do {cerr<<__LINE__<<" : ("#__VA_ARGS__<<") = "; Out(__VA_ARGS__); cerr<<flush;} while(0)
//template <typename T> void Out(T x) {cerr<<x<<"\n";}
//template <typename T,typename ...I> void Out(T x,I ...NEXT) {cerr<<x<<", "; Out(NEXT...);}

template <class T> inline T read(const T sample) {
    T x=0; int f=1; char s;
    while((s=getchar())>'9'||s<'0') if(s=='-') f=-1;
    while(s>='0'&&s<='9') x=(x<<1)+(x<<3)+(s^48),s=getchar();
    return x*f;
}
template <class T> inline void write(const T x) {
    if(x<0) return (void) (putchar('-'),write(-x));
    if(x>9) write(x/10);
    putchar(x%10^48);
}
template <class T> inline T Max(const T x,const T y) {if(x>y) return x; return y;}
template <class T> inline T Min(const T x,const T y) {if(x<y) return x; return y;}
template <class T> inline T fab(const T x) {return x>0?x:-x;}
template <class T> inline T gcd(const T x,const T y) {return y?gcd(y,x%y):x;}
template <class T> inline T lcm(const T x,const T y) {return x/gcd(x,y)*y;}
template <class T> inline T Swap(T &x,T &y) {x^=y^=x^=y;}

#include <map>
using namespace std;

typedef long long ll;

const int maxn=3e5+5;

int n;
ll a[maxn],ans;
map <ll,int> mp;

int main() {
	n=read(9);
	rep(i,1,n) a[i]=a[i-1]+read(9)*((i&1)?1:-1);
	mp.insert(make_pair(0,1));
	rep(i,1,n) {
		if(mp.count(a[i])) ans+=(mp[a[i]]++);
		else mp.insert(make_pair(a[i],1));
	}
	print(ans,'\n');
	return 0;
}


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

using namespace std;
using ll =long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vp =vector<pair<ll,ll>>;
using vvp =vector<vp>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define eb emplace_back
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
#define dup(x,y) (((x)+(y)-1)/(y))
#define fi first
#define se second
#define sz(x) (ll)(x).size()
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){

  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
//cout<<""<<endl;
// ./a.out
// g++ 201110.cpp
//cout << fixed << setprecision(10) <<   << endl;

int main() {
  string S;cin>>S;
  bool can=false;
  rep(j,12){
    bool ok=true;
    rep(i,S.size()/2){
      if(S[i]!=S[S.size()-1-i])ok=false;
    }
    S='0'+S;
    if(ok){
      can=true;
      break;
    }
  }
  if(can)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

int main() {
    int64_t n;
    cin >> n;
    while(n % 10 == 0 && n > 0) n /= 10;

    vector<int> n_dig;
    while(n > 0) {
        n_dig.push_back(n % 10);
        n /= 10;
    }

    bool can_palindrome = true;
    int dig_num = n_dig.size();
    for(int i = 0; i < dig_num/2; i++) {
        if(n_dig[i] != n_dig[dig_num - 1 - i]) can_palindrome = false;
    }

    if(can_palindrome) cout << "Yes" << endl;
    else               cout << "No"  << endl;

    return 0;
}


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

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

int main(){
    sync;

    ll ans = 0;
    int n, m;
    cin >> n >> m;
    string t;
    for(int i = 1; i <= n; ++i){
        cin >> t;
        int cnt=0;
        for(int j = 0; j < m; ++j){
            if(t[j]=='1') cnt++;
        }
        if(cnt&1) ans++;
    }
    cout << ans*(n-ans) << endl;

	return 0;
}

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>
#include <unordered_map>
#include <unordered_set>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
using LL = long long;

typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;

const double PI = 3.14159265358979323846264338327950L;
const int mod = 1e9+7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

const ll INF = 1LL<<60;

struct container {
    int bottom, top, id;
    container(int id, int bottom, int top) : top(top), bottom(bottom), id(id) {
    }
};

struct Edge {
    ll to, from, cost;
    Edge(ll to, ll from, ll cost) :to(to), from(from), cost(cost) {}
    Edge(): to(-1), from(-1), cost(0){}
};

struct Data {
    ll cost,val;
    Data(ll cost=0, ll val=0) : cost(cost), val(val){}
    bool operator<(const Data& a) const {
        return cost > a.cost;
    }
};

struct edge{
    int a,b,c;
    edge(int a = -1,int b = -1, int c = -1):a(a),b(b),c(c){}
    bool operator<(const edge& a) const {
        return c > a.c;
    }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

void solve(){
    int n,m;
    cin >> n >> m;
    ll ans = 0;
    vector<ll> cntr(2);
    rep(i,n){
        int cnt = 0;
        string s;
        cin >> s;
        for(auto e:s){
            if (e=='1') cnt^=1;
        }
        cntr[cnt]++;
    }
    cout << cntr[0]*cntr[1];
}

int main() {
    int T = 1;
    // cin >> T;

    while (T--) {
        solve();
        // cout << endl;
    }
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define endl            "\n"
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

char myHeap[200 * 1024 * 1024];
int sz = 0;
void assert_tle(bool q) { while (!q); }
void* operator new  ( std::size_t count ) {
    sz += count;
    assert_tle(sz <= 200 * 1024 * 1024);
    return myHeap + sz - count;
}

void operator delete (void *ptr) { }

void fastIO()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

struct djsets
{
    vector<int> leader;
    vector<int> rank;

    void init(int n)
    {
        rank.assign(n,1);
        for(int i=0;i<n;i++)
        {
            leader.push_back(i);
        }
    }

    int retleader(int node)
    {
        if(leader[node]==node)
            return node;
        int p= retleader(leader[node]);
        leader[node]=p;

        return p;
    }
    void connect(int a,int b)
    {
        a=retleader(a);
        b=retleader(b);

        if(rank[a]>rank[b])
        {
            leader[b]=a;
        }
        else if(rank[b]>rank[a])
        {
            leader[a]=b;
        }
        else
        {
            leader[b]=a;
            rank[a]++;
        }
    }

    int retans()
    {
        int ans=0;
        for(int i=0;i<leader.size();i++)
            if(leader[i]==i&&rank[i]>1) ans++;

        return ans-1;
    }
};

void solve()
{
    int h,w;
    cin>>h>>w;

    string str[h];

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

    str[0][0]=str[h-1][0]=str[h-1][w-1]=str[0][w-1]='#';

    djsets d;
    d.init(h+w);

    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(str[i][j]=='#')
            {
                d.connect(i,h+j);
            }
        }
    }

    int rows=0,col=0;

    for(int i=0;i<h;i++)
    {
        if(d.rank[d.retleader(i)]==1) rows++;
    }
    for(int i=h;i<h+w;i++)
    {
        if(d.rank[d.retleader(i)]==1) col++;
    }
    cout<<d.retans()+min(rows,col);

}

int32_t main()
{
    fastIO();
    //w(t)
    {
        solve();
        cout<<endl;
    }
    return 0;
}

// Artur Kraska, II UWr

#include <bits/stdc++.h>

#define forr(i, n)                  for(int i=0; i<n; i++)
#define FOREACH(iter, coll)         for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll)        for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,PRED)            ({typeof(P) X=P,RRR=(R), PPP = P; while(PPP<RRR) {X = (PPP+(RRR-PPP)/2); if(PRED) RRR = X; else PPP = X+1;} PPP;})
#define testy()                     int _tests; scanf("%d", &_tests); FOR(_test, 1, _tests)
#define CLEAR(tab)                  memset(tab, 0, sizeof(tab))
#define CONTAIN(el, coll)           (coll.find(el) != coll.end())
#define FOR(i, a, b)                for(int i=a; i<=b; i++)
#define FORD(i, a, b)               for(int i=a; i>=b; i--)
#define MP                          make_pair
#define PB                          push_back
#define ff                          first
#define ss                          second
#define deb(X)                      X;

#define M 1000000007
#define INF 1000000007LL

using namespace std;

int n, m, a;
char slowo[1007][1007];
int o[1000007], byl[1000007];

int Find(int nr)
{
    if(o[nr] < 0)
        return nr;
    o[nr] = Find(o[nr]);
    return o[nr];
}

void Union(int a, int b)
{
    a = Find(a);
    b = Find(b);
    if(a != b)
        o[a] = b;
}

int solve()
{
    forr(i, n+5)
    {
        o[i] = -1;
        byl[i] = 0;
    }
    Union(0, n-1);

    FOR(i, 1, n-2)
        if(slowo[i][0] == '#' || slowo[i][m-1] == '#')
            Union(i, 0);

    FOR(j, 1, m-2)
    {
        int last = -1;
        FOR(i, 0, n-1)
            if(slowo[i][j] == '#')
            {
                if(last != -1)
                {
                    Union(last, i);
                }
                last = i;
            }
    }

    byl[Find(0)] = 1;
    int res = 0;
    FOR(i, 0, n-1)
    {
        int x = Find(i);
        if(!byl[x])
        {
            byl[x] = 1;
            res++;
        }
    }

    return res;
}

int main()
{
    scanf("%d %d", &n, &m);
    forr(i, n)
    {
        scanf("%s", slowo[i]);
    }

    int x = solve();
    swap(n, m);

    FOR(i, 0, max(n, m))
        FOR(j, 0, i-1)
        {
            swap(slowo[i][j], slowo[j][i]);
        }

    int y = solve();

    printf("%d\n", min(x, y));

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int res=0;
    char c;
    bool zf=0;
    while(((c=getchar())<'0'||c>'9')&&c!= '-');
    if(c=='-')zf=1;
    else res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
    if(zf)return -res;
    return res;
}
signed main(){
	int T=read();
	while(T--){
		int n=read();
		for(register int i=0;i<3;++i){
			string s;cin>>s;
		}
		for(register int i=1;i<=n;++i){
			putchar('0');
		}
		for(register int i=1;i<=n;++i){
			putchar('1');
		}
		puts("0");
	}
	return 0;
}

#include <iostream>

using namespace std;

void solve() {
  int n;
  string s1,s2,s3;
  cin >> n >> s1 >> s2 >> s3;
  cout << string(n,'0') << string(n,'1') << '0' << endl;
}

int main() {
  int t;
  cin >> t;
  for (int _=0; _<t; _++) solve();
  return 0;
}


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll n;
    cin >> n;
    vector<pair<int, int>> a(n + 1);
    int empty = 0;
    vector<int> fl(n * 2 + 10, empty);
    REP(i, 1, n + 1)
    {
        cin >> a[i].first >> a[i].second;
        if (a[i].first != -1)
        {
            if (fl[a[i].first] != empty)
            {
                cout << "No" << endl;
                return 0;
            }
            fl[a[i].first] = i;
        }
        else
            a[i].first = empty;
        if (a[i].second != -1)
        {
            if (fl[a[i].second] != empty)
            {
                cout << "No" << endl;
                return 0;
            }
            fl[a[i].second] = -i;
        }
        else
            a[i].second = empty;
    }

    auto ok = [&](int l, int r) {
        if (r > 2 * n || fl[l] < 0 || fl[r] > 0)
            return false;
        if (fl[l] == empty && fl[r] == empty)
            return true;
        if (fl[l] == empty && fl[r] < 0 && a[-fl[r]].first == empty)
            return true;
        if (fl[r] == empty && fl[l] > 0 && a[fl[l]].second == empty)
            return true;
        if (fl[l] == -fl[r])
            return true;
        return false;
    };

    auto solve = [&](int l, int r) {
        int d = r - l;
        if (!ok(l, r))
            return false;

        REP(i, l + 1, r)
        {
            if (!ok(i, i + d))
                return false;
        }

        return true;
    };

    vector<bool> dp(2 * n + 2);
    dp[1] = 1;

    REP(i, 1, 2 * n)
    if (dp[i] && fl[i] >= 0)
    {
        if (fl[i] > 0)
        {
            if (a[fl[i]].second != empty)
            {
                if (solve(i, a[fl[i]].second))
                {
                    dp[2 * a[fl[i]].second - i] = 1;
                }
            }
            else
            {
                REP(j, i + 1, 2 * n + 1)
                if (solve(i, j))
                {
                    dp[2 * j - i] = 1;
                }
            }
        }
        else
        {
            REP(j, i + 1, 2 * n + 1)
            {
                if (solve(i, j))
                {
                    dp[2 * j - i] = 1;
                }
            }
        }
    }

    if (dp.back())
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

const ll MOD = 1000000007;

struct point {
  ll x, y;
};
int main(void) {
  point s, g;
  cin >> s.x >> s.y >> g.x >> g.y;

  ll ans = 0;
  if (s.x == g.x && s.y == g.y) {
    cout << 0;
    return 0;
  } else if (abs(s.x - g.x) + abs(s.y - g.y) <= 3 || s.x + s.y == g.x + g.y ||
             s.x - s.y == g.x - g.y) {
    cout << 1;
    return 0;
  }
  for (ll i = 0; i <= 3; i++) {
    if (s.x + s.y + i == g.x + g.y || s.x + s.y == g.x + g.y + i ||
        s.x + s.y - i == g.x + g.y || s.x + s.y == g.x + g.y - i ||
        s.x - s.y + i == g.x - g.y || s.x - s.y == g.x - g.y + i ||
        s.x - s.y - i == g.x - g.y || s.x - s.y == g.x - g.y - i) {
      cout << 2;
      return 0;
    }
  }
  if (s.y == g.y && abs(s.x - g.x) <= 6 || s.x == g.x && abs(s.y - g.y) <= 6) {
    cout << 2;
    return 0;
  }
  if ((abs(g.x - s.x) + abs(g.y - s.y)) % 2 == 0) {
    cout << 2;
    return 0;
  } else {
    cout << 3;
    return 0;
  }
}