#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <array>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

//typedef modint998244353 mint;

const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000 + 5;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const double EPS = 1e-7;
const int MAX = 2e5 + 5;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		if (a[i] > b[i]) {
			swap(a[i], b[i]);
		}
	}
	map<int, vector<int>> m;
	for (int i = 0; i < n; i++) {
		m[a[i]].emplace_back(i);
		m[b[i]].emplace_back(i);
	}
	map<int, int> cnt;
	priority_queue<pii, vector<pii>, greater<pii>> pq;
	for (auto it = m.begin(); it != m.end(); it++) {
		pq.push(make_pair(it->second.size(), it->first));
		cnt[it->first] = it->second.size();
	}
	vector<int> isUsed(n);
	set<int> checkedColors;
	int ans = 0;
	while (!pq.empty()) {
		int c = pq.top().second;
		int size = pq.top().first;

		pq.pop();
		if (checkedColors.find(c) != checkedColors.end()) {
			continue;
		}
		for (int mi : m[c]) {

			if (isUsed[mi]) {
				continue;
			}

			isUsed[mi] = true;
			pq.push(make_pair(--cnt[a[mi]], a[mi]));

			pq.push(make_pair(--cnt[b[mi]], b[mi]));
			ans++;
			break;
		}
		checkedColors.insert(c);

	}
	cout << ans << endl;
}

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

const int Max = 200001;

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

  vector<int> vec(n);
  for(int& nvec:vec) cin >> nvec;

  vector<vector<int>> from(Max);
  for(int i=0;i<n/2;i++){
    from[vec[i]].emplace_back(vec[n-1-i]);
    from[vec[n-1-i]].emplace_back(vec[i]);
  }

  queue<int> que;
  vector<bool> memo(Max,false);

  int ans=0;
  //vecの値でまわす
  for(int nvec:vec){
    if(memo[nvec]) continue;
    int cou = 0;
    que.push(nvec);
    cou++;
    memo[nvec]=true;
    //連結している部分をみる
    while(que.size()){
      int q;
      q = que.front();que.pop();
      for(int p:from[q]){
        if(memo[p]) continue;
        que.push(p);
        cou++;
        memo[p]=true;
      }
    }
    ans+=cou-1;
  }
  cout << ans << endl;
}


//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F first
#define S second
typedef long long ll;
#define REP(i,n) for(register int i=0;i<(n);++i)
#define REP1(i,a,b) for(register int i=(a);i<=(b);++i)
#define em emplace_back
#define mkp make_pair
#define pb push_back
#define ALL(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define Rosario ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
//#define lb(x) (x&-x)

int ans,n,eg,cnt,mx;
vector<int> v[400005];
bool vis[400005];
void dfs(int x,int p){
	vis[x]=1; ++cnt;
	for(auto &i:v[x]) {
		if(i!=p) ++eg;
		if(!vis[i]) dfs(i,x);
	}
}
int main(){Rosario
	cin>>n;
	for(int x,y,i=0;i<n;++i) {
		cin>>x>>y;
		v[x].em(y),v[y].em(x),mx=max({mx,x,y});
	}
	REP1(i,1,mx) if(!vis[i]&&!v[i].empty()){
		eg=cnt=0; dfs(i,0);
		if(cnt==eg+1) ans+=eg;
		else ans+=cnt;
	}
	cout<<ans;
	return 0;
}

/**
 *  In The Name Of God
 *  author : Behradm
 *  Idvwhu wkdq idvw, Txlfnhu wkdq txlfn, L dp Oljkwqlqj, Vshhg, L dp Vshhg.
**/
#include "bits/stdc++.h"

using namespace std;

const int N = 1e5 + 11;
int c[N];
bool mk[N];
int col[N];
vector<vector<int>> g;
vector<int> out;

void dfs(int u) {
  if (col[c[u]] == 0)
    out.push_back(u);

  mk[u] = 1;
  col[c[u]]++;
  for (int v : g[u]) {
    if (mk[v])
      continue;
    dfs(v);
  }
  col[c[u]]--;
  return;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> c[i];
  g.resize(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  dfs(1);
  sort(out.begin(), out.end());
  for (int u : out)
    cout << u << '\n';
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll N;
    cin >> N;
    unordered_set<ll> s;
    for(ll a = 2; a * a <= N; a++){
        ll x = a * a;
        while(x <= N){
            s.insert(x);
            x *= a;
        }
    }
    cout << N - s.size() << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
// #define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()

/*** Define fues ***/
#define mx 200005
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 100005
const char nl = '\n';

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, fue) memset(name, fue, sizeof(name))

/*** STLs ***/
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a, pll b) { if (a.ff == b.ff)return a.ss < b.ss; return a.ff > b.ff; }

#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": "

/*** Functions
ll BigMod(ll base, ll pow, ll modfue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modfue);ll total = ((ans % modfue) * (ans % modfue)) % modfue;  if(pow % 2 == 0) return total; else{ return (total * (base % modfue) ) % modfue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool checkprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
ll sumofdigit(ll n){ll sum=0;while(n){sum=sum+n%10;n=n/10;}return sum;}
ll countDigit(ll n) { if (n == 0) return 0; return 1 + countDigit(n / 10); }
ll countDigit(ll n) { return floor(log10(n) + 1); } //only positive
 ***/

template <class T> inline T gcd(T a, T b) {if (b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b, T p) {ll ans = 1; while (p--) ans *= b; return ans;}

void solve()
{
	ll n;cin>>n;
	if(n%100)cout<<((n/100)+1);
		else
	cout<<n/100;
}

int main()
{

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

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
typedef long long ll;
/*
#define REPE(i,a) for(i=(a). begin();i!=(a). end();++i)
#define PERE(i,a) for(i=(a).rbegin();i!=(a).rend();--i)
template<class IT>inline void cmx(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmn(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline bool bmx(IT &a,IT b){if(a<b){a=b;return true;}else return false;}
template<class IT>inline bool bmn(IT &a,IT b){if(b<a){a=b;return true;}else return false;}*/
const int N=105,Z=(N*N*N)>>1,B=Z<<1;

/*
inline void ac(){
	int n,i;
	scanf("%d",&n);
	rep(i,1,n);
}*/
int m,D[B+1];
inline void add(int &a){if(a>=m)a-=m;}
inline void sub(int &a){if(a< 0)a+=m;}
inline void A(int a,int k){
	k*=a;
	int i;
	rep(i,a,B)add(D[i]+=D[i-a]);
	per(i,B,k)sub(D[i]-=D[i-k]);
}
inline void S(int a,int k){
	k*=a;
	int i;
	rep(i,k,B)add(D[i]+=D[i-k]);
	per(i,B,a)sub(D[i]-=D[i-a]);
}
inline void M(int a,int k){
	k*=a;
	int i;
	per(i,B-a,0)add(D[i]+=D[i+a]);
	rep(i,0,B-k)sub(D[i]-=D[i+k]);
}
inline int s1(int x){return (x?x:m)-1;}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);

	int n,k,i,s;
	scanf("%d%d%d",&n,&k,&m);
	D[Z]=++k;
	REP(i,1,n)A(i,k);
	printf("%d",s1(D[Z]));
	REP(i,1,n){
		S(n-i,k);
		M(  i,k);
		printf("\n%d",s1(D[Z]));
	}
	return 0;
}

///====================== TEMPLATE STARTS HERE =====================///
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb push_back
#define MP make_pair
#define ff first
#define ss second
#define ABS(x) ((x)<0?-(x):(x))
#define FABS(x) ((x)+eps<0?-(x):(x))
#define LCM(x,y) (((x)/gcd((x),(y)))*(y))
#define POPCOUNT __builtin_popcountll
#define Set(N,p) ((N)|((1LL)<<(p)))
#define Reset(N,p) ((N)&(~((1LL)<<(p))))
#define Check(N,p) (!(((N)&((1LL)<<(p)))==(0)))
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)

#define LL long long
#define LLU long long unsigned int
typedef pair < int, int > pii;
typedef pair < LL, LL > pll;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<pll> vll;

#ifdef s_da_sailor
    #define line                    cout << "\n===================\n"
    #define trace(...)              __f( #__VA_ARGS__ , __VA_ARGS__ )
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " = " << arg1 << "\n";
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " = " << arg1 << " , ";
    __f(comma + 1, args...);
    }
#else
    #define line
    #define trace(...)
#endif // s_da_sailor

inline LL gcd ( LL a, LL b ) {
    a = ABS ( a ); b = ABS ( b );
    while ( b ) { a = a % b; swap ( a, b ); } return a;
}

LL ext_gcd ( LL A, LL B, LL *X, LL *Y ){
    LL x2, y2, x1, y1, x, y, r2, r1, q, r;
    x2 = 1; y2 = 0;
    x1 = 0; y1 = 1;
    for (r2 = A, r1 = B; r1 != 0; r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y ) {
        q = r2 / r1;
        r = r2 % r1;
        x = x2 - (q * x1);
        y = y2 - (q * y1);
    }
    *X = x2; *Y = y2;
    return r2;
}

inline LL modInv ( LL a, LL m ) {
    LL x, y;
    ext_gcd( a, m, &x, &y );
    x %= m;
    if ( x < 0 ) x += m;
    return x;
}

inline LL bigmod ( LL a, LL p, LL m ) {
    LL res = 1 % m, x = a % m;
    while ( p ) {
        if ( p & 1 ) res = ( res * x ) % m;
        x = ( x * x ) % m; p >>= 1; /// For bigmod2 multiply here using mulmod
    }
    return res;
}

//int knightDir[8][2] = { {-2,1},{-1,2},{1,2},{2,1},{2,-1},{-1,-2},{1,-2},{-2,-1} };
//int dir4[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
//int dir8[8][2] = {{-1,0},{0,1},{1,0},{0,-1},{-1,-1},{1,1},{1,-1},{-1,1}};
const LL inf = 2147383647;
const LL mod = 1000000007;
const double pi = 2 * acos ( 0.0 );
const double eps = 1e-11;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// For generating random numbers

///======================  TEMPLATE ENDS HERE  =====================///

void solve() {
    LL sx, sy, dx, dy;
    cin >> sx >> sy >> dx >> dy;

    if(sx==dx && sy==dy) {
        cout << "0\n";
    }
    else if(sx+sy==dx+dy || sx-sy==dx-dy || abs(sx-dx)+abs(sy-dy)<=3) {
        cout << "1\n";
    }
    else if((sx+sy)%2 == (dx+dy)%2) {
        cout << "2\n";
    }
    else if(abs(sx-dx)<=5 && abs(sy-dy)<=5) {
        cout << "2\n";
    }
    else if((sx==dx && abs(dy-sy)==6) || (sy==dy && abs(dx-sx)==6)) {
        cout << "2\n";
    }
    else if(abs((dx+dy)-(sx+sy))<=4 || abs((dx-dy)-(sx-sy))<=4) {
        cout << "2\n";
    }
    else {
        cout << "3\n";
    }
}

int main () {
    #ifdef s_da_sailor
    freopen ( "input.txt", "r", stdin );
    //freopen ( "output.txt", "w", stdout );
    #endif // s_da_sailor

    fast_cin;

    solve();

    return 0;
}


/*
....................../´¯/)
....................,/¯../
.................../..../
............./´¯/'...'/´¯¯`·¸
........../'/.../..../......./¨¯\
........('(...´...´.... ¯~/'...')
.........\.................'...../
..........''...\.......... _.·´
............\..............(
..............\.............\...
*/

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define ye cout<<"YES"
#define no cout<<"NO"
#define ln cout<<"\n";
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define pi 3.14159265358979323846
#define MOD 1000000007
// cout<<"Case #"<<ts<<": “;
//priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;

using namespace std;

ll mod(ll x, ll m) {
	return (x % m + m) % m;
}

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

ll fast_exp(ll base, ll exp) {
	ll res = 1;
	while (exp > 0) {
		if (exp % 2 == 1) res = (res * base) % MOD;
		base = (base * base) % MOD;
		exp /= 2;
	}
	return res % MOD;
}

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

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

	ll t = 1, r, n, a, d, c, b, x, y, sum, cnt, i, j, k, m, l, q, maxx, minn, temp, ans, flag, g, ts;
	ll mod = 1000000007;
	char ch, chh;
	double dans;
	string str, ttr;

	//cin >> t;

	for (ts = 1; ts <= t; ts++)
	{
		flag = 0; sum = 0; cnt = 0; ans = 0; k = 0; maxx = 0; minn = 0; a = 0; b = 0; temp = 0;

		n = 4;
		ll arr[4]; for (i = 0; i < n; i++) {cin >> arr[i];}
		sort(arr, arr + n);
		cout << arr[0];

		ln
	}
	return 0;
}

#include <algorithm>
#include <iostream>
#include <list>
#include <numeric>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <ostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <queue>
#include <cstdio>

using namespace std;

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

typedef long long ll;

template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}

#define all(t) t.begin(), t.end()
#define INF 1000000000

typedef vector<int> vi;
typedef vector<long long> vl;

template<class T> inline void check_min(T &a,T b){if(b<a) a=b;}
template<class T> inline void check_max(T &a,T b){if(b>a) a=b;}

string s;
int a, b, c;

int main() {
    ios::sync_with_stdio();
    cin.tie(0);
    cin>>a>>b>>c;
    if(a == b)cout<<c<<endl;
    else if(a == c)cout<<b<<endl;
    else if(b == c)cout<<a<<endl;
    else cout<<0<<endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }
const ll MOD = 1e9+7;
vector<vector<char>> v(2, vector<char>(2));
vector<int> H(5000, -1);
int solve(int n, int a, int b){
    if (n <= 1) return 1;
    int key = n * 4 + a * 2 + b;
    if (H[key]!=-1) return H[key];

    int ret = 0;
    int c = v[a][b] - 'A';
    for(int i=0; i<=n-1; i++){
        ret += (ll) solve(i, a, c) * solve(n-1-i, c, b) % MOD;
        ret -= MOD * (ret >= MOD);
    }
    return H[key] = ret;
}

int mp(char c){
    if (c == 'A') return 0;
    return 1;
}

set<string> S;
void bf(string s, int n){
    if (n == 0) {
        S.insert(s);
        return;
    }

    FOR(i, s.length()-1){
        string s2 = s.substr(0, i+1) + v[mp(s[i])][mp(s[i+1])] + s.substr(i+1);
        bf(s2, n-1);
    }
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int n;
    cin >> n;
    FOR(i, 2) FOR(j, 2) cin >> v[i][j];
    int sol = 1;
    if (n>=3)
    {
        if (v[0][1] == 'B') {
            if (v[1][1] == 'B')
                sol = 1;
            else {
                if (v[1][0] == 'A') {
                    FOR(i, n - 3) {
                        sol = 2 * sol % MOD;
                    }
                } else {
                    int x = 1, y = 1, z;
                    FOR(i, n - 3) {
                        z = x + y;
                        z %= MOD;
                        x = y;
                        y = z;
                    }
                    sol = z;
                }
            }
        } else {
            if (v[0][0] == 'A')
                sol = 1;
            else {
                if (v[1][0] == 'B') {
                    FOR(i, n - 3) {
                        sol = 2 * sol % MOD;
                    }
                } else {
                    int x = 1, y = 1, z;
                    FOR(i, n - 3) {
                        z = x + y;
                        z %= MOD;
                        x = y;
                        y = z;
                    }
                    sol = z;
                }
            }
        }
    }
    cout << sol << endl;
//    bf("AB", n-2);
//    cout << S.size() << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<int, int>
using namespace std;

int main(){
  ll r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;
  ll ans = 1e9;
  for(int i = -3; i <= 3; i++){
    for(int j = -3; j <= 3; j++){
      if(abs(i) + abs(j) > 3) continue;
      ll x = r2 + i, y = c2 + j;
      if((abs(r1 - x) + abs(c1 - y)) % 2 != 0) continue;
      ll cnt;
      if(i == 0 && j == 0) cnt = 0;
      else cnt = 1;
      if(x == r1 && y == c1){

      }
      else if(abs(r1 - x) + abs(c1 - y) <= 3){
        cnt++;
      }
      else if(r1 + c1 == x + y || r1 - c1 == x - y) cnt++;
      else cnt += 2;

      ans = min(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}


#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;

int main(void) {
    string S;
    cin >> S;

    int ans = 0;
    rep(i, 10) rep(j, 10) rep(k, 10) rep(l, 10) {
        vector<int> v(10, 0);
        v[i]++;
        v[j]++;
        v[k]++;
        v[l]++;
        bool ok = true;
        rep(m, v.size()) {
            if (v[m] > 0 && S[m] == 'x') ok = false;
            if (v[m] == 0 && S[m] == 'o') ok = false;
        }
        if (ok) ++ans;
    }

    cout << ans << endl;

    return 0;
}

#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,d[105][105];
char s[105][105];

int main()
{
	n=read(); rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n) rep(j,1,n) d[i][j]=s[i][j]-'0';
	rep(k,1,n) rep(i,1,n) rep(j,1,n) if(d[i][k]&&d[k][j]) d[i][j]=1;
	double ans=0;
	rep(i,1,n)
	{
		int cnt=0;
		rep(j,1,n) if(d[j][i]&&j!=i) cnt++;
		ans+=1.0/(cnt+1);
	}
	printf("%.10lf\n",ans);
	return 0;
}


//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);

	ll ans=16LL*27*25*7*11*13*17*19*23*29+1;
	cout<<ans<<endl;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#define int long long
#define loop(x) for (int i = 0; i < (int)(x); i++)
#define loop2(x) for (int j = 0; j < (int)(x); j++)
#define endl '\n'
using namespace std;
// vector<int> sieve;
// void sieveoferathostene()
// {
//     int x = 1000;
//     vector<bool> n(x);
//     loop(n.size()) for (int i = 2; i <= x; i++)
//     {
//         if (!n[i])
//         {
//             int p = i * 2;
//             for (; p <= x; p += i)
//             {
//                 n[p] = true;
//             }
//         }
//     }
//     for (int i = 2; i <= n.size(); i++)
//     {
//         if (!n[i])
//         {
//             sieve.push_back(i);
//         }
//     }
// }

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

int lcm(int x,int y){
    return (x*y)/gcd(x,y);
}
signed main()
{
    std::cin.tie(0);
    std::cout.tie(0);

    ios::sync_with_stdio(false);

    int n; cin>>n;
    int ans = 1;
    if(n==2){
        cout<<3<<endl;
    }else{
    for(signed i = 2;i<n;i++){
        ans = lcm(ans,lcm(i,i+1));
    }
    cout<<ans+1<<endl;
    }
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long i,j,l,q,t,m,n,h,p;
    long long k,z,p1,h1,x,y;
    string st="",st1="";
    t = 1;
    while(t--)
    {
        std::cin >> n >> q;
        std::vector<long long> a;
        for(i=0;i<n;i++)
        {
            std::cin >> x;
            a.push_back(x);
        }
        while(q--)
        {
            std::cin >> k;
            long long y = 0,ans = k;
            while(true)
            {
                long long x = lower_bound(a.begin(),a.end(),ans)-a.begin();
                if(a[x] == ans)
                    x++;
                if(y == x)
                    break;
                ans = k+x;
                y = x;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
ll mod = 1000000007;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

void solve()
{
    ll n,q,d;
    cin>>n>>q;
    ll a[n+1];
    ll sd[n+2];
    a[0] = 0;
    sd[0] = 0;
    sd[n+1] = LLONG_MAX;
    for(int i=1;i<n+1;i++)
    {
        cin>>a[i];
        d = a[i] - a[i-1] - 1;
        sd[i] = d + sd[i-1];
        //cout<<sd[i]<<" ";
    }
    //cout<<sd[n+1];
    cout<<'\n';
    for(int i=0;i<q;i++)
    {
        ll k;
        cin>>k;
        auto it = lower_bound(sd,sd+n+1,k);
        auto ind = (it - sd);
        //cout<<ind<<" ";
        ll ans = a[ind-1] + k - sd[ind-1];
        cout<<ans<<'\n';
        // for(int j=0;j<n;j++)
        // {
        //     d = a[j+1] - a[j] - 1;
        //     if(k > d)
        //     {
        //         k -= d;
        //     }
        //     else
        //     {
        //         ll ans = a[j] + k;
        //         cout<<ans<<'\n';
        //         break;
        //     }
        // }
    }
}
int main()
{
    solve();
    return 0;
}


#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define ll long long int
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define Mod 1000000007
#define limit 1000008
using namespace std;
ll x;
map<ll,ll>mymap;

ll rec(ll y)
{
    if(mymap[y])  return mymap[y];
    if(y<=x) return mymap[y] = x-y;

    if(y&1)
    {
        return mymap[y] = min(abs(y-x),2+min(rec((y+1)/2),rec((y-1)/2)));
    }
    else return mymap[y] = min(1+rec(y/2),y-x);
}

void solve(ll tc)
{
    ll i,y,m;
    cin >> x >> y;

    cout <<rec(y)<<endl;
    return ;
}
int  main()
{
//    Fast
//    Freed
//    Fout
    ll tc,tt=1;
   // cin >> tt;
    for(tc=1; tc<=tt; tc++)
        solve(tc);
    return 0;
}


/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define int      long long
#define double   long double
#define uint     unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
int google_itr = 1;
#define google(x) cout<<"Case #"<<x<<": "
#define pi 3.14159265358979323846264338327950L

vector<string> vec_splitter(string s) {
        s += ',';
        vector<string> res;
        while(!s.empty()) {
                res.push_back(s.substr(0, s.find(',')));
                s = s.substr(s.find(',') + 1);
        }
        return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx,
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
        if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
        stringstream ss; ss << H;
        cerr << args[idx] << " = " << ss.str();
        debug_out(args, idx + 1, LINE_NUM, T...);
}

#define XOX
#ifdef XOX
    #define deb(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
    #define deb(...) 42
#endif

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

void virus(){
        int n, m;
        cin >> n >> m;

        vector <string> arr(n);
        for(auto &i:arr) cin >> i;

        int ans = 0;
        for(auto i=0; i<n-1; i++) {
            for(auto j=0; j<m-1; j++) {
                int cnt = 0;
                cnt += arr[i][j] == '.';
                cnt += arr[i+1][j] == '.';
                cnt += arr[i][j+1] == '.';
                cnt += arr[i+1][j+1] == '.';
                ans += cnt%2;
            }
        }
        cout << ans << endl;
}

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

  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    int t = 1;
    //cin >> t;
    while(t--){
           auto start = system_clock::now();
           virus();
           auto stop = system_clock::now();
           duration<double> duration = (stop - start);
           //cerr << "\nTime: "<< fixed << setprecision(10) << (double)duration.count() <<"sec"<< endl;
           //your code goes here
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h, vector<char>(w));
    for(auto& sr : s){
        for(auto& si : sr){
            cin >> si;
        }
    }
    int ans = 0;
    for (int i = 0; i<h-1; i++){
        for (int j = 0; j<w-1; j++){
            int scount = 0;
            if(s[i][j] == '#') scount++;
            if (s[i][j+1] == '#')
                scount++;
            if (s[i+1][j] == '#')
                scount++;
            if (s[i+1][j+1] == '#')
                scount++;

            if(scount==1 || scount==3){
                ans++;
            }
        }
    }
    cout << ans << endl;
}


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

int main(){
  ll n, aa = 0, bb = 0, ai = -1, bi = -1, bbb = 0;
  cin >> n;
  vector<ll> a(n), b(n);
  vector<ll> ans(n), am(n), bm(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n){
    if (b[i] > bb){
      bb = b[i];
      bi = i;
    }
    if (i == 0){
      am[i] = a[i];
      cout << am[i]*bb << endl;
      continue;
    }
    am[i] = max(am[i-1], a[i]);
    if (a[i] > am[i-1]){
      am[i] = a[i];
      ai = i;
      bbb = b[i];
    } else{
      am[i] = am[i-1];
      bbb = max(bbb, b[i]);
    }
    if (bbb*am[i] > am[bi]*bb){
      bi = ai;
      bb = bbb;
    }
    cout << am[bi]*bb << endl;
  }
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int w, x, y, z;
    cin >> w >> x >> y >> z;

    cout << min(min(w, x), min(y, z)) << endl;

    return 0;
}


#include<bits/stdc++.h>
#define rep(i, N) for(i = 0; i < N; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define printYN(ans) ans ? cout << "Yes\n" : cout << "No\n"
#define printyn(ans) ans ? cout << "yes\n" : cout << "no\n"
#define clnt(a, b) ((a + b - 1) / b)
#define same(f1, f2) (abs(f1 - f2) <= EPS)
#define pow2(n) (n * n)
using namespace std;
using ll = int64_t;
const double EPS = 1e-8;
const int MAX_N = 1<<17;
const int MOD = 1e9+7;
const int INF = 1e9+10;
const int NIL = -1;

int main(){
    long double SX[101], SY[101], TX[101], TY[101];
    long double sumSX = 0, sumSY = 0, sumTX = 0, sumTY = 0;
    int N, i, j, k; cin >> N;

    rep(i, N){
        cin >> SX[i] >> SY[i];
        sumSX += SX[i], sumSY += SY[i];
    }
    rep(i, N){
        cin >> TX[i] >> TY[i];
        sumTX += TX[i], sumTY += TY[i];
    }
    sumSX /= N, sumSY /= N, sumTX /= N, sumTY /= N;

    int S0idx = -1, T0idx = -1;
    rep(i, N){
        SX[i] -= sumSX, SY[i] -= sumSY;
        TX[i] -= sumTX, TY[i] -= sumTY;
        if(same(SX[i], 0) && same(SY[i], 0)) S0idx = i;
        if(same(TX[i], 0) && same(TY[i], 0)) T0idx = i;
    }

    bool fnd = true, ans = true;
    int fidx = 0;

    if((S0idx == -1) != (T0idx == -1)) ans = false;
    else if(N == 1) ans = true;
    else{
        if(S0idx == 0) fidx = 1;
        long double sinS, cosS, sinT, cosT, RS, RT;

        RS = sqrt(pow2(SX[fidx]) + pow2(SY[fidx]));
        sinS = SY[fidx] / RS, cosS = SX[fidx] / RS;

        rep(i, N){
            if(i == T0idx) continue;
            ans = true;

            RT = sqrt(pow2(TX[i]) + pow2(TY[i]));
            sinT = TY[i] / RT, cosT = TX[i] / RT;

            rep(j, N){
                fnd = false;

                long double mvSX, mvSY;
                mvSX = cosT * SX[j] - sinT * SY[j], mvSY = cosT * SY[j] + sinT * SX[j];

                rep(k, N){
                    long double mvTX, mvTY;
                    mvTX = cosS * TX[k] - sinS * TY[k], mvTY = cosS * TY[k] + sinS * TX[k];
                    if(same(mvSX, mvTX) && same(mvSY, mvTY)) fnd = true;
                }

                if(fnd == false){
                    ans = false;
                    break;
                }
            }

            if(ans) break;
        }
    }

    printYN(ans);
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> A, B;
  for(int i = 0; i < n; ++i){
    int x, y;
    cin >> x >> y;
    x *= n, y *= n;
    A.emplace_back(x,y);
  }
  for(int i = 0; i < n; ++i){
    int x, y;
    cin >> x >> y;
    x *= n, y *= n;
    B.emplace_back(x,y);
  }

  auto convert = [](vector<pair<int,int>> A, int idx){
    const int n = A.size();
    vector<pair<int,int>> R;
    int gx = 0, gy = 0;

    for(auto [x,y] : A){
      gx += x/n, gy += y/n;
    }

    auto [xi,yi] = A[idx];
    xi -= gx, yi -= gy;

    for(auto [x,y] : A){
      x -= gx, y -= gy;
      R.emplace_back(x*xi+y*yi, x*yi-y*xi);
    }
    return R;
  };

  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      auto a = convert(A,i), b = convert(B,j);
      sort(a.begin(),a.end());
      sort(b.begin(),b.end());
      if(a == b){
        puts("Yes");
        return 0;
      }
    }
  }

  puts("No");
}


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

vector<int> to[200200];

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

void solve(){
    int n;
    cin >> n;

    double ans = 0.0;

    rep(i,n-1){
        double N = i+1;
        double M = n-N;
        double f = M/N;
        double f1 = N*(N+M)/(M*M);
        ans += f*f1;
    }

    cout << std::setprecision(15) << ans;

//     int N = 3;
//     int M = 11;
//     double c = 0;
//     rep(i,10000){
//         double j = i+1;
//         double m = 1;
//         rep(jj,j){
//             m *= double (N)/M;

//         }
//         c += j*m;
//     }
//     cout << c << endl;

//     cout << 1.*M*N/c;
}

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

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

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

double ans;
int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n; ++i) {
		ans += (double)n / (n - i);
	}
	printf("%.6lf", ans);
	return 0;
}


/****************************************** By Lord Sanskar Bhargava******************************/

#include<bits/stdc++.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define fastio ios::sync_with_stdio(0);cin.tie(0);
#define mp make_pair
#define pb push_back
#define ep emplace_back
#define all(v) (v).begin(),(v).end()
#define dll(v) (v).rbegin(),(v).rend()
#define set1(x) __builtin_popcount(x)
#define gcd(a,b) __gcd(a,b)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define bk(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second
#define sz(x) ((ll) (x).size())
#define mid(l,r) (l+(r-l)/2)
#define inf 1e18
const int mod = 1000000007;

template <typename T> T gcd(T a, T b){if(a%b) return gcd(b,a%b);return b;}
template <typename T> T lcm(T a, T b){return (a*(b/gcd(a,b)));}
template<typename T_vector>
void output_vector(const T_vector &v, bool add_one = false, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n');
}

unsigned mod_pow(unsigned a, unsigned b, unsigned mod)
{
    unsigned result = 1;

    while (b > 0) {
        if (b & 1)
            result = unsigned(uint64_t(result) * a % mod);

        a = unsigned(uint64_t(a) * a % mod);
        b >>= 1;
    }

    return result;
}
ll read(){
    ll i;
    cin>>i;
    return i;
}
vl readvl(ll n,ll off=0){
    vl v(n);
    rep(i,0,n)v[i]=read()+off;
    return v;
}
string readString(){
    string s;
    cin>>s;
    return s;
}

template<class T>
T sq(const T& t){
    return t*t;
}
void run_test()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(c*d-b<=0){
        cout<<-1<<endl;return;
    }
    else{
        cout<<(a+c*d-b-1)/(c*d-b)<<endl;return;
    }

}
int main(int argc, char const *argv[])
{
    clock_t begin = clock();
    fastio;
    int tt=1;
    // cin>>tt;
    while(tt--)
    {
        run_test();
    }
    #ifndef ONLINE_JUDGE
      clock_t end = clock();
      cout<<"\n\nExecuted In: "<<double(end - begin) / CLOCKS_PER_SEC*1000<<" ms";
    #endif
return 0;
}

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <bitset>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define ll long long
#define MOD 1000000007
#define rep(i, n) for( ll int i = 0; i < (n); i++ )

int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    // if (b >= c && a + b > c * d) {
    //     cout << -1 << endl;
    //     return 0;
    // }
    ll cnt = 0;
    // cout << a + cnt * b << c * cnt * d << endl;
    while (a + cnt * b > c * cnt * d && cnt < 100001) {
        cnt++;
    }
    if (cnt > 100000) {
        cout << -1 << endl;
        return 0;
    }
    cout << cnt << endl;
    return 0;
}


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

double n;
double x_0,y_0,x_2,y_2;

int main(){
    cin >> n;
    cin >> x_0 >> y_0;
    cin >> x_2 >> y_2;

    double cent_x = (x_0+x_2)/2;
    double cent_y = (y_0+y_2)/2;

    double dx = (x_0 - x_2)/2;
    double dy = (y_0 - y_2)/2;
    double sita = 2*PI/n;

    double x_1 = dx*cos(sita) - dy*sin(sita);
    double y_1 = dx*sin(sita) + dy*cos(sita);

    printf("%.10f %.10f\n",x_1+cent_x,y_1+cent_y);

}

#include<bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(4); }; } fast_ios_;
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A>
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pint;
typedef pair<ll,ll> plint;
const int mod = 1000000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

const int N = 2e5 + 10;

int n, m, k;
int out[N];
pair<ld,ld> f[N];

int main()
{
	cin >> n >> m >> k;
	rep (i,0,k) {
		int x;
		cin >> x;
		out[x] = 1;
	}

	f[n] = {0,0};
	pair<ld,ld> sum = {0,0};

	per (i,0,n) {
		if (out[i]) f[i] = {1, 0};
		else f[i] = {sum.fi / m, sum.se / m + 1};
		//dbg(i, f[i].fi, f[i].se );
		sum.fi += f[i].fi, sum.se += f[i].se;
		sum.fi -= f[i + m].fi, sum.se -= f[i + m].se;
	}
	//dbg(f[0].fi, f[0].se);
	if (fabs(f[0].fi - 1) < 1e-6) cout << -1 << endl;
	else {
		cout << f[0].se / (1 - f[0].fi) << endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
//#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define sa(a,n) rep(ii,n) cin>>a[ii];
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
#define MX 998244353
lli a[200010]={0};
int main() {
    int n,k;
    cin>>n>>k;
    reps(i,1,n+1){
        a[i+1]++;
        a[i+n+1]--;
    }
    reps(i,1,2*n+2){
        a[i]=a[i]+a[i-1];
    }
    lli ans=0;
    k=abs(k);
    reps(i,k+2,2*n+2){
        ans+=a[i]*a[i-k];
    }
    cout<<ans<<endl;
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n;

ll solve(int s){
	ll mx,mn;
	mx = std::min(n,s-1);
	mn = std::max(1,s-n);
	return std::max(mx-mn+1,0ll);
}

int main(void){
	int m,k,i;
	ll ans = 0ll;
	std::cin >> n >> k;
	m = n*2;
	for(i=2; i<=m; ++i){
		ans += solve(i)*solve(i-k);
	}
	std::cout << ans << std::endl;
	return 0;
}


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

#define ll long long
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()

const int MOD = (int)1e9 + 7;

void __print(int 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

const int N = 1000010;
int lpf[N];
int mobius[N];

// Function to calculate least
// prime factor of each number
void least_prime_factor()
{
    for (int i = 2; i < N; i++)

        // If it is a prime number
        if (!lpf[i])

            for (int j = i; j < N; j += i)

                // For all multiples which are not
                // visited yet.
                if (!lpf[j])
                    lpf[j] = i;
}

// Function to find the value of Mobius function
// for all the numbers from 1 to n
void Mobius()
{
    // To store the values of Mobius function

    for (int i = 1; i < N; i++) {

        // If number is one
        if (i == 1)
            mobius[i] = 1;
        else {

            // If number has a squared prime factor
            if (lpf[i / lpf[i]] == lpf[i])
                mobius[i] = 0;

            // Multiply -1 with the previous number
            else
                mobius[i] = -1 * mobius[i / lpf[i]];
        }
    }

    // for (int i = 1; i <= n; i++)
    //     cout << mobius[i] << " ";
}

ll f(ll x, ll y) {
	ll ans = 0;
	for (ll v = 1; v <= min(x, y); ++v) {
		ans += (x / v) * (y / v) * mobius[v];
	}
	return ans;
}

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

	least_prime_factor();
	Mobius();

	ll L, R;
	cin >> L >> R;

	ll tot = (R - L + 1) * (R - L + 1);

	ll mi = f(R, R);
	mi -= 2 * f(L - 1, R);
	mi += f(L - 1, L - 1);

	ll noncop = tot - mi;

	ll d = 0;
	for (ll x = L; x <= R; ++x) {
		if (x == 1) continue;
		ll no = (R / x) - ((L - 1) / x);
		// debug(x, no);
		d += 2 * no - 1;
	}

	// cout << noncop << " " << d << "\n";

	cout << noncop - d << "\n";

	return 0;
}

#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  llvec v(4);
  ll ans = 1e18;
  rep(i, 4)cin >> v[i];
  rep(i, 4)ans = min(ans,v[i]);
  cout<< ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
static constexpr ll LIM = 1e10;

constexpr ll mpow(const ll base, const ll exp) {
    if (!exp) return 1;
    if (exp % 2LL) return base * mpow(base, exp - 1LL);
    const ll q = mpow(base, exp / 2LL);
    return (q * q);
}

set<ll> all_powers() {
    set<ll> ans;

    for (ll a = 2LL; log2(a) * 2.0 < log2(2.0 * LIM); ++a) {
        for (ll b = 2LL; b * log2(a) < log2(2.0 * LIM); ++b) {
            const ll c = mpow(a, b);
            assert(c > 0LL);
            ans.insert(c);
        }
    }

    return ans;
}

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

    ll n;
    cin >> n;

    const auto ps = all_powers();

    const auto it = ps.upper_bound(n);
    const ll c = distance(cbegin(ps), it);
    const ll ans = n - c;

    cout << ans << '\n';
    return 0;
}

// DeNsE - EcLiPsE //
// WHAT is DEAD may NEVER die //

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstring>
#include <stack>
#include <sstream>
#include <queue>
#include <unordered_set>
#include <cstdlib>
//#include <bits/stdc++.h>

using namespace std;

#define nitro ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define double long double

const int inf = (1ll << 62) - 1;
const int mod = 998244353;
const int N = 2e5 + 10;

int bPow(int a, int b){
    int res = 1;
    while(b) {
        if (b & 1) {
            res = (res * a) % mod;
        }
        b >>= 1;
        a = (a * a) % mod;
    }
    return res % mod;
}

int gcd(int a, int b)
{
    if(a < b)
        swap(a, b);
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

vector<int> fact(N, 0ll);
void factorial(){
    fact[0] = 1, fact[1] = 1;
    for(int i = 2; i < N; i++){
        fact[i] = (fact[i - 1] * i) % mod;
    }
}

int ncr(int n, int r){
    if(r > n)
        return 0;
    int ans = fact[n] % mod;
    ans *= bPow(fact[r], mod - 2) % mod;
    ans %= mod;
    ans *= bPow(fact[n - r], mod - 2) % mod;
    ans %= mod;
    return ans;
}

set<int> canBe;

void countPowers(int x, int n){
    int cur = x, ct = 0;
    while(cur * x <= n){
        ct++;
        cur *= x;
        canBe.insert(cur);
    }
}

void solve(){
    int n;
    cin >> n;
    for (int i = 2; i * i <= n; ++i) {
        countPowers(i, n);
    }
    cout << n - canBe.size() << endl;
}

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


#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll dp[65][3];
string S[65];

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		cin >> S[i];
	}

	dp[0][1] = 1;
	dp[0][0] = 1;
	rep(i,N)
	{
		if (S[i] == "AND")
		{
			dp[i+1][1] = dp[i][1];
			dp[i+1][0] = 2 * dp[i][0] + dp[i][1];
		}
		else
		{
			dp[i+1][1] = dp[i][0] + 2 * dp[i][1];
			dp[i+1][0] = dp[i][0];
		}
	}
	cout << dp[N][1] << endl;
	return 0;
}

#include <bits/stdc++.h>
#include <string>
#include <map>
#include <set>
#include <sstream>
#include <queue>
#include <stack>
#include <deque>
#include <vector>

#define loop(i,a,b) for (int i = (a); i <= (b); i++)
#define loopr(i, a, b) for(int i = (a); i >= (b); i--)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pf 				push_front
#define mp              make_pair
#define mt              make_tuple
#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 all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)x.size()
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define mod1 998244353
using namespace std;

int fast_pow(int a, int p) {
  int res = 1;
  while (p) {
    if (p % 2 == 0) {
      a = a * 1ll * a % mod;
      p /= 2;
    } else {
      res = res * 1ll * a % mod;
      p--;
    }
  }
  return res;
}

int fact(int n) {
  int res = 1;
  for (int i = 1; i <= n; i++) {
    res = res * 1ll * i % mod;
  }
  return res;
}

int C(int n, int k) {
  return fact(n) * 1ll * fast_pow(fact(k), mod - 2) % mod * 1ll * fast_pow(fact(n - k), mod - 2) % mod;
}

vector<int> sieveOfEratosthenes(int n) {
	vector<int> primes;
	vector<bool> prime(n+1,true);
	for (int p = 2; p * p <= n; p++) {
		if (prime[p] == true) {
			for (int i = p * p; i <= n; i += p)
				prime[i] = false;
		}
	}
	for (int p = 2; p <= n; p++)
		if (prime[p])
			primes.push_back(p);
	return primes;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);
}

int modd(string num, int a)
{
    // Initialize result
    int res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
         res = (res*10 + (int)num[i] - '0') %a;

    return res;
}

int32_t main()
{
	fast_io;
	int n;
	cin>>n;
	vector<string> s(n);
	loop(i,0,n-1)
	{
		cin>>s[i];
	}
	int ans = 1;
	loop(i,0,n-1)
	{
		if(s[i]=="OR")
		{
			ans+= 1LL<<(i+1);
		}
	}
	cout<<ans<<endl;
}


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

#define rep(i, n) for(int i = 0, i##_len=(n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())

void _cin() {} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail) { cin >> head; _cin(forward<Tail>(tail)...); }
#define cin(Type, ...) Type __VA_ARGS__; _cin(__VA_ARGS__)
#define cinv(Type, xs, n) vector<Type> xs(n); rep(i, n) cin >> xs[i]
#define cinv2(Type, xs, ys, n) vector<Type> xs(n), ys(n); rep(i, n) cin >> xs[i] >> ys[i]
#define cinv3(Type, xs, ys, zs, n) vector<Type> xs(n), ys(n), zs(n); rep(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define cinvv(Type, xs, h, w) vector<vector<Type>> xs(h, vector<Type>(w)); rep(i, h) rep(j, w) cin >> xs[i][j]

void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class Type> void print(vector<Type> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class Type> void print(vector<vector<Type>> &df) { for (auto& vec : df) { print(vec); } }

void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void yesno(bool b) { cout << (b ? "yes" : "no") << endl; }
template<class Integer>bool chmax(Integer &a, const Integer &b) { if (a < b) { a = b; return 1; } return 0; }
template<class Integer>bool chmin(Integer &a, const Integer &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;

void Main() {
	cin(string, s);
	int n = len(s);
	ll ans = 0;
	char c;
	bool ok = false;
	int j = 0;
	vector<int> v;
	rep(i, n-1) {
		if (ok) {
			if (s[i] == s[i + 1] && (s[i] != c)) {
				c = s[i];
				v.emplace_back(1);
				j++;
				continue;
			}
			if (s[i] != c) {
				ans++;
			}
			v[j]++;
		}
		else if (s[i] == s[i + 1]){
			ok = true;
			c = s[i];
			v.emplace_back(1);
		}
	}
	if (!ok) {
		print(0);
		return;
	}
	if (s[n - 1] != c) {
		ans++;
	}
	v[j]++;
	reverse(all(v));
	rep(i, len(v) - 1) {
		ans += v[i];
		v[i + 1] += v[i];
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(16);
	//int t; cin >> t; while (t--)
	Main();
}


#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <numeric>
#include <unordered_set>
using namespace std;

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

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


#include <bits/stdc++.h>

#define fo(i, x, y) for (int i = (x); i <= (y); ++i)
#define fd(i, x, y) for (int i = (x); i >= (y); --i)
using namespace std;

typedef long long ll;

const int maxn = 1e6 + 5, lim = 1e6;

int l, r, tot;
int pri[maxn], v[maxn], cnt[maxn];
vector<int> fac[maxn], s[maxn];

int getint()
{
	char ch;
	int res = 0, p;
	while (!isdigit(ch = getchar()) && ch != '-');
	p = ch == '-'? ch = getchar(), -1 : 1;
	while (isdigit(ch))
		res = res * 10 + ch - '0', ch = getchar();
	return res * p;
}

int cal(int x)
{
	int sz = s[x].size(), allset = (1 << sz) - 1;
	int res = 0;
	fo(i, 1, allset)
	{
		int p = 1, ss = 0;
		fo(j, 0, sz - 1)
			if ((i >> j) & 1) p *= s[x][j], ss++;
		if (ss & 1) res += cnt[p];
		else res -= cnt[p];
	}
	return res;
}

void upd(int x)
{
	int sz = s[x].size(), allset = (1 << sz) - 1;
	fo(i, 1, allset)
	{
		int p = 1;
		fo(j, 0, sz - 1)
			if ((i >> j) & 1) p *= s[x][j];
		cnt[p]++;
	}
}

int main()
{
	//int st = clock();
	//freopen("t.in", "r", stdin);
	fo(i, 1, lim)
		fo(j, 1, lim / i)
			fac[i * j].push_back(i);
	fo(i, 2, lim)
	{
		if (!v[i]) v[i] = i, pri[++tot] = i;
		fo(j, 1, tot)
		{
			if (pri[j] > v[i] || pri[j] > lim / i) break;
			v[i * pri[j]] = pri[j];
		}
	}
	fo(i, 2, lim)
	{
		int x = i;
		while (x > 1)
		{
			int t = v[x];
			s[i].push_back(t);
			while (x > 1 && !(x % t)) x /= t;
		}
	}
	cin >> l >> r;
	if (l == 1) l++;
	ll ans = 0;
	fo(i, l, r)
	{
		upd(i);
		//cerr << cal(i) << " ";
		ans += cal(i);
		int cnt = fac[i].end() - lower_bound(fac[i].begin(), fac[i].end(), l);
		ans -= cnt;
		//cerr << cnt << " ";
	}
	//cerr << endl;
	ans <<= 1;
	cout << ans << endl;
	//cerr << clock() - st;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int l,r;
	cin >> l >> r;
	l = max(l,2LL);
	vector<int>dp(1000001);
	for(int i = 1000000; i>=1; i--){
		int nums = r/i - (l-1)/i;
		dp[i] = nums*nums;
		for(int j = 2*i; j<=1000000; j+=i){
			dp[i]-=dp[j];
		}
	}
	int ans = 0;
	for(int i = 2; i<=1000000; i++){
		ans+=dp[i];
	}
	ans-=r-l+1;
	for(int i = l; i<=r; i++){
		for(int j = 2*i; j<=r; j+=i){
			if(__gcd(i,j)!=1)
			ans-=2;
		}
	}
	cout << ans << "\n";
	return 0;
}


#include<bits/stdc++.h>
#define ll          long long
#define ull         unsigned long long
#define inf         999999999999
#define F           first
#define S           second
#define eb          emplace_back
#define mpp         make_pair
#define P(x)        cout<<__LINE__ <<": "<<#x<<' '<<(x)<<'\n'
#define dbg         cout<<__LINE__ <<": 0manush\n"
#define read(x)     freopen("input.txt","r",stdin);
#define write(x)    freopen("aoutput.txt","w",stdout)
#define fast        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi          2*acos(0.0)
#define lcm(a,b)    ((a)*((b)/__gcd(a,b)))
#define mem(a,b)    memset(a,b,sizeof(a))
#define ee          exp(1)
#define mx          100000
#define mod         1000000007
using namespace std;
map<ll,ll>mp;
int main(){//read(x);//write(x);
//fast;
ll a,b,c,d,e,g,h,i,j,k,l,n,t;
cin>>n;
a=1;b=1;
for(i=1;i<=37;i++){
    a*=3;
    mp[a]=i;
}a=0;
for(i=1;i<26;i++){
    b*=5;
    c=n-b;
    if(mp[c]>0){
        a++;
        cout<<mp[c]<<' '<<i<<endl;
        break;
    }
}
if(a==0)cout<<-1<<endl;

}

#include<bits/stdc++.h>

using namespace std;
void solve();
int main()
{
	solve();
	return 0;
}
void solve()
{
	int x, total=100;
	cin>>x;
	if (x%total==0)
	{
		cout<<total;
	}
	else
	{
		int q = x%total;
		int res = total - q;
		cout<<res;
	}
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define gp  __gnu_pbds
#define iset(T) gp::tree<T,gp::null_type,less<T>,gp::rb_tree_tag,gp::tree_order_statistics_node_update>
using namespace std;

#define SQ(x) ((x)*(x))
#define u unsigned
#define ull unsigned long long
#define ll  long long
#define ld  long double
#define test(x) cout<<"here "<<x<<endl;
#define debug(x) cout<<(#x)<<": "<<(x)<<endl;
#define inputstl(v) for(auto& x:v) cin>>x;
#define input(arr,n) for(ull i=0;i<n;++i){cin>>arr[i];}
#define print(arr,n) for(ull i=0;i<n;++i){cout<<arr[i]<<" ";}cout<<'\n';
#define printall(x) for(auto y:x){cout<<y<<' ';}cout<<'\n';
#define printallpii(x) for(auto y:x){cout<<y.fi<<','<<y.se<<' ';}cout<<'\n';
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define mod (ll)(1e9+7)
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define SENSITIVITY 1e-9
#define EQUAL(x1,x2) [](auto x1,auto x2){double ep=0.0001;double pos=x1-x2;if(pos<0){pos=-pos;}double maxi=(x1>x2)?(x1):(x2);if(pos/(maxi*ep)<SENSITIVITY)return true;else return false;}(x1,x2)
bool isPrime(ll a)
{
    ll lim=sqrt(a);
    lim++;
    if(a==1)
        return false;
    for(ll i=2; i<=lim; ++i)
    {
        if(a%i==0)
        {
            return false;
        }
    }
    return true;
}
bool isPali(string s)
{
    int _size=(s.length())/2;
    for(int i=0; i<_size; ++i)
    {
        if(s.at(i)!=s.at(s.length()-1-i))
        {
            return false;
        }
    }
    return true;
}
int gcd(int a,int b)
{
    if(a==0)
    {
        return b;
    }
    else if(b==0)
    {
        return a;
    }
    else
    {
        int shift=__builtin_ctz(a|b);
        a>>=__builtin_ctz(a);
        do
        {
            b>>=__builtin_ctz(b);
            if(a>b)
            {
                a=a^b;
                b=a^b;
                a=a^b;
            }
            b-=a;
        }
        while(b);
        return a<<shift;
    }
}
ll gcdll(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else if(b==0)
    {
        return a;
    }
    else
    {
        ll shift=__builtin_ctzll(a|b);
        a>>=__builtin_ctzll(a);
        do
        {
            b>>=__builtin_ctzll(b);
            if(a>b)
            {
                a=a^b;
                b=a^b;
                a=a^b;
            }
            b-=a;
        }
        while(b);
        return a<<shift;
    }
}
ll power(ll a,ll b,ll _mod)
{
    ll temp=a;
    ll ans=1;
    int limit=63-__builtin_clzll(b);
    int index=0;
    while(index<=limit)
    {
        if(b&(1ll<<index))
        {
            ans=(ans*temp)%_mod;
        }
        ++index;
        temp=(temp*temp)%_mod;
    }
    return ans;
}

int main()
{
//    #define cin fin
//    ifstream fin;
//    fin.open("input.txt",ios_base::in);
//    fastio;
    int tt=1;
//    cin>>tt;
    while(tt--)
    {
        int n,s,d;
        cin>>n>>s>>d;
        for(int i=0;i<n;++i)
        {
            int x,y;
            cin>>x>>y;
            if(x<s && y>d)
            {
                cout<<"Yes";
                return 0;
            }
        }
        cout<<"No";
    }
    return 0;
}

#include <bits/stdc++.h>
#define int long long
#define inf 5e18
#define MOD (int)(1e9 + 7)
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define vii vector<pii>
#define vi vector<int>
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define fast                       \
    ios_base ::sync_with_stdio(0); \
    cin.tie(NULL);                 \
    cout.tie(NULL)
using namespace std;

void __print(int 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 see(x...)                 \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define see(x...)
#endif

void solve() {
    int n,s,d;
    cin>>n>>s>>d;
    for(int i=0;i<n;i++) {
        int x,y;
        cin>>x>>y;
        if(x>=s||y<=d) ;
        else {
            cout<<"Yes";
            exit(0);
        }
    }
    cout<<"No";
}

signed main()
{
    fast;
    //test
    {
        solve();
    }
    return 0;
}


#include <cstdio>
#define int long long
int read()
{
	int x=0,f=1;char c;
	while((c=getchar())<'0' || c>'9') {if(c=='-') f=-1;}
	while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}
int T,n,cnt;
signed main()
{
	T=read();
	while(T--)
	{
		n=read();cnt=0;
		while(n%2==0) n/=2,cnt++;
		if(cnt==0) puts("Odd");
		else if(cnt==1) puts("Same");
		else puts("Even");
	}
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
#define check(x) if(x>=mod) x-=mod
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int qpow(int x,int y){
    int ret = 1;
    while(y) {
        if(y & 1) ret = (ll)ret * x % mod;
        x = (ll)x * x % mod;
        y >>= 1;
    }
    return ret;
}
int N,n;
vector<string> v[10];
int main()
{
    fastio;
    cin>>N;
    /*n = 1 << N;
    int a = n * (n - 1) / 2;
    int b = (n / 2) * (n / 2 - 1);
    int lcm = a/gcd(a,b)*b;*/
    /*printf("%d %d %d %d %d\n",a,b,lcm,lcm/a,lcm/b);
    v.pb(0b11001100);
    v.pb(0b11000011);
    v.pb(0b10101010);
    v.pb(0b10100101);
    v.pb(0b10011001);
    v.pb(0b10010110);
    int nn = v.size();
    rap(i,0,nn) v.pb(255^v[i]);
    rap(i,0,v.size()){
        int x = v[i];
        rap(j,0,n) rap(k,0,n) if(((1<<j)&x) && ((1<<k)&x)) {
            //printf("%d %d\n",j,k);
            deg[j][k]++;
        }
    }
    rap(i,0,n) rap(j,i+1,n) if(deg[i][j] < 3) printf("%d %d\n",i,j);*/
    //int times = lcm / b;
    rep(i,1,8) {
        int ii = (1<<i);
        rap(j,0,v[i-1].size()){
            string s = v[i-1][j];
            string t = s + s;
            v[i].pb(t);
            t = s;
            rap(k,0,s.size()) s[k] = 131 - s[k];
            t += s;
            v[i].pb(t);
        }
        string s;
        rap(i,0,ii/2) s += 'A';
        rap(i,0,ii/2) s += 'B';
        v[i].pb(s);
    }
    cout<<v[N].size()<<endl;
    rap(i,0,v[N].size()) cout<<v[N][i]<<'\n';
    return 0;
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std ;
typedef long long ll ;
const int mod=1000000007;
const int N=1e3 ;

ll max_ll(const ll &a,const ll &b){
	if(a>b)
		return a ;
	else
		return b ;
}

void solve(){

	int n;
	cin>>n;

	vector<ll> a(n),b(n) ;

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

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

	ll ma=a[0] ;
	vector<ll> c(n) ;
	c[0]=a[0]*b[0] ;

	for(int i=1;i<n;i++){
		ma=max_ll(ma,a[i]) ;
		c[i]=max_ll(c[i-1],ma*b[i]) ;
	}

	for(int i=0;i<n;i++){
		cout<<c[i]<<"\n" ;
	}

}

int main(){

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

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

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){

			solve() ;

		}

		return 0 ;
}

#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

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

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}

string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,x;
    cin>>n;
    ll a[n],ans=0;
    cin>>a[0];
    for (int i=1;i<n;++i)
    {
        cin>>a[i];
        a[i]=max(a[i],a[i-1]);
    }
    for (int i=0;i<n;++i)
    {
        cin>>x;
        ans=max(ans,a[i]*x);
        cout<<ans<<"\n";
    }
    return 0;
}


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

int main() {
  int 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;
  }

  return 0;

}

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main()
{
    fast_cin();
    int a, b;
    cin>>a>>b;
    if(a+b>=15 && b>=8) cout<<1<<ln;
    else if(a+b>=10 && b>=3) cout<<2<<ln;
    else if(a+b>=3) cout<<3<<ln;
    else cout<<4<<ln;
    return 0;
}


//                                      CPP
//                                      Mind_flayer404

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define pb push_back
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define len length()
#define vt vector

#define f(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=b-1; i>=a; i--)

ll const mod = 1e9+7;
ll const mod1 = 998244353;
ll const N = 1e+6;

ll power(ll a,ll b,ll m)
{
    ll res = 1;
    while(b>0)
    {
        if(b&1)
        {
            res = ((res%m)*(a%m))%m;
        }
        a = ((a%m)*(a%m))%m;
        b /= 2;
    }
    return res;
}

ll modi(ll a,ll p)
{
    return power(a,p-2,p);
}

ll max(ll a,ll b)
{
    return a>b?a:b;
}

ll min(ll a,ll b)
{
    return a>b?b:a;
}

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

ll bins(ll ar[],ll l,ll r,ll x)
{
    if(l<=r)
    {
        ll mid = l + (r-1)/2;
        if(ar[mid]==x)
            return mid;
        else if(ar[mid]>x)
        {
            bins(ar,l,mid-1,x);
        }
        else if(ar[mid]<x)
        {
            bins(ar,mid+1,r,x);
        }
    }
    return -1;
}

ll get(ll n)
{
    vt<ll> v;
    while(n>0)
    {
        v.pb(n%10);
        n /= 10;
    }
    ll a = 0,b = 0;
    sort(all(v));
    ll sz = v.size();
    rf(i,0,sz)
    {
        a += v[i]*pow(10,i);
    }
    f(i,0,sz)
    {
        b += v[i]*pow(10,sz - i - 1);
    }
    return a - b;
}

int main()
{
    fast;
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll ar[k+1];
        ar[0] = n;
        f(i,1,k+1)
        {
            ar[i] = get(ar[i-1]);
        }
        cout<<ar[k]<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void run(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int karp(int n){
	int f[11]={};
	int z=1,y=1;
	while(n>0){
		f[n%10]++;
		n/=10;
	}
		for(int i=9;i>=0;i--){
			for(int j=0;j<f[i];j++){
				y = y*10+i;
			}
		}
		for(int i=0;i<=9;i++){
			for(int j=0;j<f[i];j++){
			 z = z*10+i;
			}
		}
		return (y-z);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	run();
	int n,k; cin>>n>>k;
	for(int i=0;i<k;i++){
	   n = karp(n);
	}
	cout<<n<<endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
// Policy based data structure
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long int
#define pii pair<ll,ll>
#define rep(i,st,en) for(ll i=st;i<en;i++)
#define vi vector<ll>
#define vii vector<pii>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define eb emplace_back
#define yes cout<<"YES"<<endl; return;
#define no cout<<"NO"<<endl; return;
#define flus fflush(stdout);
#define gin(x) cerr<<#x<<" : "<<x<<" ";
#define fin cerr<<endl;
#define F first
#define S second
#define np next_permutation
#define inf 1e18
#define mod 1000000007
#define N 200009
#define PI 3.14159265358979323846
#define minpq priority_queue <ll, vector<ll>, greater<ll>>
#define maxpq priority_queue<ll>
void sout(){
	cout<<endl;
}
template <typename T,typename... Types>
void sout(T var1,Types... var2){
	cout<<var1<<" ";
	sout(var2...);
}

void solve(){
	int a,b,w;
	cin>>a>>b>>w;
	int M=0,m=1000000000;
	// ll m = inf;
	for(int i=1;i<=1000000;i++){
		if(a*i<=w*1000 && b*i>=w*1000){
			m=min(m,i);
		    M=max(M,i);
		}
	}

	if(M==0){
		cout<<"UNSATISFIABLE";
	    return;}
    else
	 cout<<m<<" "<<M;

}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	clock_t t1=clock();
	int t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}
	cerr<<"Time elapsed: "<<(double)(clock()-t1)/1000<<" s"<<endl;
}

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

int main(){
    int a, b, w, q, r;
    cin >> a >> b >> w;
    w *= 1000;
    r = w / a;
    if(w % b == 0) q = w / b;
    else q = w / b + 1;
    if(q > r) cout << "UNSATISFIABLE" << endl;
    else{
        cout << q << " " << r << endl;
    }
}


#include<cstdio>
int n,f,l;
struct node{
	int rating,id;
}a[65537];
inline int read() {
	int ln=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {
		ln=(ln<<3)+(ln<<1)+ch-'0';
		ch=getchar();
	}
	return ln;
}
int main() {
	l=1,f=2;
	n=(1<<read());
	for(int i=1;i<=n;i++) {
		a[i].rating=read();
		a[i].id=i;
	}
	while(f<n) {
		for(int i=1;i<=n;i+=f) {
			if(a[i].rating<a[i+l].rating) a[i]=a[i+l];
		}
		f<<=1;
		l<<=1;
	}
	if(a[1].rating<a[1+l].rating) printf("%d",a[1].id);
	else printf("%d",a[1+l].id);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cout << (i*2) % N + 1 << ' ' << (i*2+1) % N + 1 << '\n';
    }
    return 0;
    // 重複, 境界, 条件, ll (1e5のnCr), 0, -, 1i, for s&g, debug
}


#include              <bits/stdc++.h>
#define ll            long long int
#define w(t)          int t; cin>>t; while(t--)
#define F             first
#define S             second
#define pb            push_back
#define mp            make_pair
#define pii           pair<int,int>
#define mii           map<int,int>
#define sp(x,y)       fixed<<setprecision(y)<<x
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    int temp=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!='.'&&!temp)cout<<s[i];
        else if(s[i]=='.')temp=1;
    }
    return 0;
}

/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
int a[SIZE],b[SIZE];
int N;
void solve() {
    W(max(0,*min_element(b,b+N)-*max_element(a,a+N)+1));
}
void input() {
    R(N);
    REP(i,N)R(a[i]);
    REP(i,N)R(b[i]);
}
int main(){
    input();
    solve();
    return 0;
}


// Jai Shree Ram

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ook order_of_key
#define fbo find_by_order

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}

const int N=1e9+5;
const int M=1e7;

struct node{
	int l;int r;
	int val;
	int cnt;
}t[M];
int cnt=0;

int n;

void extend(int v){
	if(t[v].l==0){
		t[v].l=++cnt;
		t[v].r=++cnt;
	}
}

void pushup(int v){
	t[v].val = t[t[v].l].val + t[t[v].r].val;
	t[v].cnt = t[t[v].l].cnt + t[t[v].r].cnt;
}

void update(int v,int l,int r,pii val,int tl=0,int tr=1e9){
	if(tl>r || l>tr)return;
	if(l<=tl && tr<=r){
		assert(tl == tr);
		t[v].val += val.x;
		t[v].cnt += val.y;
		return;
	}
	extend(v);
	int mid=(tl+tr)/2;
	update(t[v].l,l,r,val,tl,mid);
	update(t[v].r,l,r,val,mid+1,tr);
	pushup(v);
}

pii query(int v,int l,int r,int tl=0,int tr=1e9){
	if(tl>r || l>tr)return {0,0};
	if(l<=tl && tr<=r){
		return {t[v].val,t[v].cnt};
	}
	int mid=(tl+tr)/2;
	extend(v);
	pii a =query(t[v].l,l,r,tl,mid);
	pii b =query(t[v].r,l,r,mid+1,tr);
	return {a.x+b.x,a.y+b.y};
}

int solve(){
		int n,m,q; cin >> n >> m >> q;

		int ans = 0;
		int roota = ++cnt;
		int rootb = ++cnt;

		vector<int>v1(n+1),v2(m+1);
		update(roota,0,0,{0,n});
		update(rootb,0,0,{0,m});

		rep(i,0,q){
			int t; cin >> t;
			int x,y; cin >> x >> y;
			if(t == 1){
				if(y > v1[x]){
					auto s = query(rootb,0,y);
					ans += s.y*y;
					s = query(rootb,v1[x]+1,y);
					ans -= s.x;
					s = query(rootb,0,v1[x]);
					ans -= v1[x]*s.y;
				}
				else if(y < v1[x]){
					auto s = query(rootb,0,v1[x]);
					ans -= s.y*v1[x];
					s = query(rootb,0,y);
					ans += s.y*y;
					s = query(rootb,y+1,v1[x]);
					ans += s.x;
				}
				update(roota,v1[x],v1[x],{-v1[x],-1});
				update(roota,y,y,{y,1});
				v1[x] = y;
			}
			else{
				if(y > v2[x]){
					auto s = query(roota,0,y-1);
					ans += s.y*y;
					s = query(roota,0,v2[x]-1);
					ans -= s.y*v2[x];
					s = query(roota,v2[x],y-1);
					ans -= s.x;
				}
				else if(y < v2[x]){
					auto s = query(roota,0,v2[x]-1);
					ans -= s.y*v2[x];
					s = query(roota,0,y-1);
					ans += s.y*y;
					s = query(roota,y,v2[x]-1);
					ans += s.x;
				}
				update(rootb,v2[x],v2[x],{-v2[x],-1});
				update(rootb,y,y,{y,1});
				v2[x] = y;
			}
			cout << ans << endl;
		}
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 1<<19;
int N, M, Q;
ll a[200005], b[200005];
vector<ll> v;
vector<pair<int, ll>> tree_a(MAXN), tree_b(MAXN);	// cnt, sum
int qt[200005], qx[200005], qy[200005];

void update(vector<pair<int, ll>> &tree, int node, int s, int e, int idx, int d) {
	if(idx < s || idx > e) return ;
	if(s == idx && idx == e) {
		tree[node].first += d;
		tree[node].second = tree[node].first * v[idx];
		return ;
	}
	int n1 = node << 1, n2 = node << 1 | 1;
	int mid = s + e >> 1;
	update(tree, n1, s, mid, idx, d);
	update(tree, n2, mid+1, e, idx, d);
	tree[node].first = tree[n1].first + tree[n2].first;
	tree[node].second = tree[n1].second + tree[n2].second;
}

pair<int, ll> query(vector<pair<int, ll>> &tree, int node, int s, int e, int l, int r) {
	if(l > e || r < s) return make_pair(0, 0);
	if(l <= s && e <= r) return tree[node];
	int n1 = node << 1, n2 = node << 1 | 1;
	int mid = s + e >> 1;
	pair<int, ll> p1 = query(tree, n1, s, mid, l, r);
	pair<int, ll> p2 = query(tree, n2, mid+1, e, l, r);
	return make_pair(p1.first + p2.first, p1.second + p2.second);
}

int main() {
	cin.tie(nullptr); ios::sync_with_stdio(false);
	cin >> N >> M >> Q;
	v.push_back(0);
	for(int i=0;i<Q;++i) {
		cin >> qt[i] >> qx[i] >> qy[i];
		v.push_back(qy[i]);
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	ll sum = 0;
	ll a_sum = 0, b_sum = 0;
	update(tree_a, 1, 0, v.size()-1, 0, N);
	update(tree_b, 1, 0, v.size()-1, 0, M);
	for(int i=0;i<Q;++i) {
		int idx = qx[i];
		ll val = qy[i];
		int q_idx = lower_bound(v.begin(), v.end(), val) - v.begin();
		if(qt[i] == 1) {
			int cur_idx = lower_bound(v.begin(), v.end(), a[idx]) - v.begin();
			pair<int, ll> pre = query(tree_b, 1, 0, v.size()-1, 0, cur_idx);
			int n = pre.first;
			ll pre_sum = n*a[idx] + b_sum - pre.second;
			a_sum -= a[idx];
			sum -= pre_sum;
			update(tree_a, 1, 0, v.size()-1, cur_idx, -1);
			a[idx] = val;
			a_sum += val;
			update(tree_a, 1, 0, v.size()-1, q_idx, 1);
			pair<int, ll> p = query(tree_b, 1, 0, v.size()-1, 0, q_idx);
			sum += p.first * a[idx] + b_sum - p.second;
		}
		else {
			int cur_idx = lower_bound(v.begin(), v.end(), b[idx]) - v.begin();
			pair<int, ll> pre = query(tree_a, 1, 0, v.size()-1, 0, cur_idx);
			int n = pre.first;
			ll pre_sum = n*b[idx] + a_sum - pre.second;
			b_sum -= b[idx];
			sum -= pre_sum;
			update(tree_b, 1, 0, v.size()-1, cur_idx, -1);
			b[idx] = val;
			b_sum += val;
			update(tree_b, 1, 0, v.size()-1, q_idx, 1);
			pair<int, ll> p = query(tree_a, 1, 0, v.size()-1, 0, q_idx);
			sum += p.first * b[idx] + a_sum - p.second;
		}
		cout << sum << '\n';
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)     for(long long int i=a; i<n; i++)
#define loop(i,a,n)     for(long long int i=a; i>=n; i--)

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

	int a;
	cin>>a;
	vector<pair<double,double>> v;
	forr(i, 0, a)
	{
		int x, y;
		cin>>x>>y;
		v.push_back({x, y});
	}
	int ans=0;
	forr(i, 0, a)
	{
		forr(j, i+1, a)
		{
			double d=(v[j].second-v[i].second)/(v[j].first-v[i].first);
			//cout<<v[i].first<<' '<<v[i].second<<' '<<v[j].first<<' '<<v[j].second<<' '<<d<<'\n';
			if(d>=-1.0 and d<=1.0)
				ans++;
		}
	}
	cout<<ans;

	return 0;
}

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

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

    vector<int> x(n), y(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=0; j<i; j++){
            int dx = abs(x[i] - x[j]);
            int dy = abs(y[i] - y[j]);

            if(dx >= dy) ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int nCr(int i,int j){
  int sum=1;
  for(int X=1;X<=j;X++){
    sum*=(i-X+1);sum/=X;
  }
  return sum;
}
signed main(){
  int A,B,K;cin>>A>>B>>K;
  int now=K;
  int NA=A,NB=B;
  string S="";
  for(int X=0;X<A+B;X++){
    if(now>nCr(NA+NB-1,NB)){
      now-=nCr(NA+NB-1,NB);
      NB--;
      S.push_back('b');
    }
    else{
      NA--;
      S.push_back('a');
    }
  }
  cout<<S<<endl;
}

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

vector<vector<ll>> c;

string kth(int a,int b,ll k) {
    if(a==0) return string(b, 'b');
    if(b==0) return string(a, 'a');
    if(k<=c[a-1][b]) return string("a")+kth(a-1,b,k);
    else return string("b")+kth(a, b-1, k-c[a-1][b]);
}

int main() {
  int a,b; ll k; cin >> a >> b >> k;
  c.resize(a+1, vector<ll>(b+1));
  c[0][0]=1;
  rep(i,a+1) rep(j,b+1) { if(i>0) c[i][j]+=c[i-1][j]; if(j>0) c[i][j]+=c[i][j-1]; }
  cout << kth(a,b,k) << endl;
}


#include<bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-20
#define fi first
#define se second
using namespace std;
using cd = complex<double>;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll a[105],d[100005];
int main(){
    ll n,sum=0;cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];sum+=a[i];
    }
    d[0]=1;
    for(ll i=1;i<=n;i++){
        for(ll j=sum;j>=a[i];j--){
            d[j]|=d[j-a[i]];
        }
    }
    ll ans=sum;
    for(ll i=0;i<=sum;i++){
        if(!d[i]) continue;
        ans=min(ans,max(i,sum-i));
    }
    cout<<ans<<endl;
}

#include <bits/stdc++.h>
using namespace std;
using Table = vector<vector<int>>;

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

int main()
{
    int N;
    cin >> N;
    vector<int> T(N);
    for (auto &Ti : T)
        cin >> Ti;
    constexpr int INF = 2e+5;
    int max_T = *max_element(T.begin(), T.end());
    Table dp(N + 1, vector<int>(max_T * N + 1, INF));
    dp[0][0] = 0;
    for (int i = 0; i < N; ++i) {
        auto Ti = T.at(i);
        for (int j = 0; j <= max_T * N; ++j) {
            int k = Ti + j;
            if (k <= max_T * N)
                chmin(dp[i + 1][k], dp[i][j]);
            chmin(dp[i + 1][j], dp[i][j] + Ti);
        }
    }
    int min_cost = INF;
    for (int j = 0; j <= max_T * N; ++j)
        chmin(min_cost, max(j, dp[N][j]));
    cout << min_cost << endl;
}


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

ll rd(){
	int f = 1;
	ll x = 0;
	char ch = getchar();
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}

ll ksm(ll a,ll b,ll m){
	ll base = a;
	ll ans = 1;
	while(b){
		if(b & 1) {
			ans *= base;
			ans %= m;
		}
		base *= base;
		base %= m;
		b >>= 1;
	}
	return ans;
}

int main(){
	int n = rd();
	vector<string> ans;
	ans.push_back("AB");
	for(int i = 2;i <= n;i++) {
		for(int j = 0;j < (1 << (i - 1)) - 1;j++)
			ans[j] += ans[j];
		for(int j = 0;j < (1 << (i - 1)) - 1;j++){
			string s = ans[j];
			for(int k = (1 << (i - 1));k < (1 << i);k++)
				s[k] ^= 'A' ^ 'B';
			ans.push_back(s);
		}
		ans.push_back(string(1 << (i - 1),'A') + string(1 << (i - 1),'B'));
	}
	cout << ans.size() << '\n';
	for(auto s:ans) cout << s << '\n';
}


#include <bits/stdc++.h>

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

    int max = 0;
    for(int i=0; i<N; i++){
        int cur_min = 1e9;
        int cur = 0;
        for(int j=i; j<N; j++){
            cur_min = std::min(cur_min, A[j]);
            max = std::max(max, cur_min * (j - i + 1));
        }
    }

    std::cout << max << std::endl;

    return 0;
}

// #define LOCAL
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (ll)s; i < (ll)n; i++)
#define rrep(i,n,e) for (int i = (ll)n; i > (ll)e; i--)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
// #define M_PI 3.14159265358979323846 // CF
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) cout << fixed << setprecision(10) << x << endl; // print Decimal number 10 Rank
#define endl "\n"
#define Case(x) printf("Case #%d: ", x); // gcj

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<char> vch;
typedef vector<vector<char>> vvch;

constexpr ll LINF = 1001002003004005006ll;
constexpr int INF = 1002003004;
constexpr int n_max = 2e5+10;

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

template<class T, class U>
T POW(T x, U n) {T ret=1; while (n>0) {if (n&1) {ret*=x;} x*=x; n>>=1;} return ret;};

// debug
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';};
string to_string(const char c) {return to_string((string) &c);};
string to_string(bool b) {return (b ? "true" : "false");};
template <size_t N>
string to_string(bitset<N> v){
  string res = "";
  for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
  return res;
};
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for(const auto &x : v) {
    if(!first) res += ", ";
    first = false; res += to_string(x);
  }
  res += "}";
  return res;
};
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

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

void LINE_OUT() {
  cout << "--------------" << endl;
};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define LINE LINE_OUT();
#else
#define debug(...) 71
#define LINE 71;
#endif

void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
};

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
};

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
};

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

  ll N; cin >> N;
  vl A(N); rep(i, 0, N) cin >> A[i];
  A.pb(0);
  vpl V;
  ll ans = 0;
  rep(i, 0, N+1) {
    if (V.empty()) {
      V.pb(make_pair(A[i], i));
      continue;
    }
    if (V.back().first < A[i]) {
      V.pb(make_pair(A[i], i));
      continue;
    } else if (V.back().first > A[i]) {
      int target = i;
      while (!V.empty() && V.back().first >= A[i]) {
        auto pre = V.back(); V.pop_back();
        ll area = pre.first * (i - pre.second);
        chmax(ans, area);
        target = pre.second;
      }
      V.pb(make_pair(A[i], target));
    }
  }

  cout << ans << endl;

  return 0;
};