#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
using ll = long long;

int x;

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

    cin >> x;
    cout << 100-x%100 << "\n";
}

#include <bits/stdc++.h>

using namespace std;

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define REP(i, a, b) for (ll i = a; i <= b; i++)
#define REP_REV(i, a, b) for (ll i = a; i >= b; i--)
#define debug(x) cerr << #x << " is " << x << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define endl "\n"

#define pb push_back
#define rsz resize
#define f first
#define s second
#define mp make_pair

using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vc = vector<char>;
using ull = unsigned int64_t;
using pi = pair<int, int>;
using vl = vector<int64_t>;
using pl = pair<int64_t, int64_t>;
using vpl = vector<pair<int64_t, int64_t>>;
using msl = map<string, int64_t>;
using vvl = vector<vector<int64_t>>;

#define DBG1(x) cerr << (#x) << ": " << (x) << endl;
#define DBG2(x, y) cerr << (#x) << " " << (#y) << ": " << (x) << " " << y << endl;
#define DBG3(x, y, z) cerr << (#x) << " " << (#y) << " " << (#z) << ": " << (x) << " " << y << " " << z << endl;
#define DBG4(a, b, c, d) cerr << (#a) << " " << (#b) << " " << (#c) << " " << (#d) << ": " << a << " " << b << " " << c << " " << d << endl;
template <class T>
void DBGvec(vector<T> a) {
    for (T i : a) cerr << i << " ";
    cerr << endl;
}
template <class T>
void DBGvec_pair(vector<T> a) {
    for (T i : a) cerr << "{" << i.f << " " << i.s << "} ";
    cerr << endl;
}
template <class K, class P>
void DBGmap(map<K, P> a) {
    for (auto i : a) cerr << "{" << i.f << " " << i.s << "} ";
    cerr << endl;
}

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

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

unsigned long long factorial(int n) {
    const unsigned int M = MOD;
    unsigned long long f = 1;
    for (int i = 1; i <= n; i++)
        f = (f * i) % M;
    return f;
}

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

void solve() {
    ll n;
    cin >> n;
    vl a(n);
    vector<bool> t(n);
    REP(i, 0, n - 1) {
        cin >> a[i];
        t[a[i] - 1] = true;
    }
    REP(i, 0, n - 1) {
        if (t[i] == false) {
            cout << "No";
            return;
        }
    }
    cout << "Yes";
}

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    int tt = clock();
#endif

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

    // ll t;
    // cin >> t;
    // while (t--)
    solve();

#ifdef _DEBUG
    cerr << "\nTIME = " << clock() - tt << endl;
    tt = clock();
#endif
    return 0;
}


//https://atcoder.jp/contests/abc183/tasks/abc183_d
//D - Water Heater
#include <bits/stdc++.h>

using namespace std;

const int MAXN=2e5+4;
long long nums[MAXN];

int main() {
#if 1
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif

    int n,w;
    cin>>n>>w;
    for (int i=1; i<=n; i++) {
        int s,t,p;
        cin>>s>>t>>p;

        nums[s] += p;
        nums[t] -= p;
    }

    for (int i=1; i<MAXN; i++) {
        nums[i] += nums[i-1];
    }

    for (int i=0; i<MAXN; i++) {
        if (nums[i]>w) {
            cout<<"No\n";
            return 0;
        }
    }

    cout<<"Yes\n";
    return 0;
}

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

# define fori(i,n)          for(int i=0;i<n;i++)
# define forl(i,n)          for (ll i=0;i<n;i++)
# define pb                 push_back
# define mp                 make_pair
# define X                  first
# define Y                  second
# define all(v)             v.begin(),v.end()
# define sz(a)              int((a).size())
# define in_ar_int(arr,n)   int arr[n]; fori(i,n) cin >> arr[i];
# define in_ar_ll(arr,n)    ll arr[n]; fori(i,n) cin >> arr[i];
# define endl               "\n"
# define R0                 return 0
# define mod                1000000007
# define pi                 3.1415926536
# define fill(a,x)          memset(a,x,sizeof(a))

typedef long long ll;
typedef string str;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<int> vi;
typedef map <int,int>  mii;

void solve(){
    int n; cin >> n;
    str s; cin >> s;
    int q; cin >> q;
    int flag=0;
    while (q--){
        int a,b,c; cin >> a >> b >> c;
        if (a==1){
            b=b-1;
            c=c-1;
            if (flag==1){
                b=(b+n)%(2*n);
                c=(c+n)%(2*n);
            }
            int tmp=s[b];
            s[b]=s[c];
            s[c]=tmp;
        }else{
           flag=1-flag;
        }
    }
    if (flag==0) cout << s;
    else{
        for (int i=n;i<2*n;i++){
            cout << s[i];
        }
        for (int i=0;i<n;i++){
            cout << s[i];
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int chill=1;
    // cin >> chill;
    while(chill--){
    solve();
    }
}


#include <bits/stdc++.h>
#define inc(l,i,r) for (int i=l;i<=r;i++)
#define dec(r,i,l) for (int i=r;i>=l;i--)
#define SIZE(V) ((int) V.size())
#define pb push_back
#define fi first
#define se second
// #define mp make_pair
#define ___ putchar(10);
#define cnt(x) __builtin_popcount(x)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int N = 100100, P = 998244353;

int n, tot, d[N], b[N], pri[N];

int main() {
    scanf("%d",&n);
    d[1] = 1;
    for (int i=2;i<=n;i++) {
        if (!b[i]) {
            pri[++tot] = i;
            d[i] = 2;
        }
        for (int j=1;j<=tot && i*pri[j] <= n;j++) {
            b[i*pri[j]] = 1;
            d[i*pri[j]] = d[i] + 1;
            if (i % pri[j] == 0) break;
        }
    }

    // inc(1,i,n) {
    //     printf("%d |\t%d\t%d\t%d\n",i,mp[i],cnt[i],d[i]);
    // }
    inc(1,i,n) printf("%d ",d[i]);
}

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n;
    cin>>n;
    ll s=3,t;
    repi(a,1,38){
        t=5;
        repi(b,1,26){
            if(s+t>n) break;
            if(s+t==n){
                cout<<a<<" "<<b;
                return 0;
            }
            t*=5;
        }
        s*=3;
    }
    cout<<-1;
}


#include<bits/stdc++.h>
#define int long long
#define uc getchar()
#define ph putchar
#define R register
#define CN const
#define rint R int
#define cint CN int
#define ps ph(' ')
#define pe ph('\n')
using namespace std;
cint inf=1e9+7;
cint mix=1e6+5;
inline int in();
inline void out(rint x);
int n=in(),ans;
struct nodgd{
	int x,id;
	inline bool operator<(CN nodgd&ep)CN{
		return ep.x<x;
	}
} a[mix];
set<int> b;
set<int>::iterator it;
#undef int
int main() {
#define int long long
	for(rint i=1;i<=n;++i)
	a[i]=(nodgd){in(),n+1-i},b.insert(i);
	for(rint i=1;i<=n;++i)
	a[n+i]=(nodgd){in(),i};
	sort(a+1,a+(n<<1)+1);
	for(rint i=1,j=1;i<=n;++i){
		while(j<=(n<<1)){
			it=b.upper_bound(a[j].id);
			if(it!=b.begin())break;
//cerr<<a[j].x<<'\n';
			++j;
		}	ans+=a[j++].x;
		b.erase(--it);
	}	out(ans),pe;
}
inline int in() {
	rint x=0;
	R bool f=0;
	R char s=uc;
	while((s<'0'||'9'<s)&&s!='-')s=uc;
	if(s=='-')f=1,s=uc;
	while('0'<=s&&s<='9')(x*=10)+=s^48,s=uc;
	return f?-x:x;
}
inline void out(rint x) {
	if(x<0)ph('-'),x=-x;
	rint y=x/10;
	if(y)out(y);
	ph((x-y*10)^48);
}

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

const int N = 200200;

int n, v[N*2], a[N], b[N];
priority_queue<int,vector<int>,greater<int> > Q;

int main() {
    scanf("%d",&n);
    for (int i=1;i<=n*2;i++) scanf("%d",v+i);
    for (int i=1;i<=n;i++) {
        a[i] = max(v[n+1-i],v[n+i]);
        b[i] = min(v[n+1-i],v[n+i]);
    }

    for (int i=1;i<=n;i++) {
        if (i != 1) {
            if (b[i] > Q.top()) {
                Q.pop();
                Q.push(b[i]);
            }
        }
        Q.push(a[i]);
    }

    long long sum = 0;
    for (int i=1;i<=n;i++) {
        sum += Q.top();
        Q.pop();
    }
    printf("%lld\n", sum);
}


#include <bits/stdc++.h>
#define endl '\n'

#define SZ(x) ((int)x.size())
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back

using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int n;
int a[MAXN];
string s;

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

int val[MAXN];
int rem[MAXN];

bool check(int k) {
	for(int i = 0; i <= n; i++) {
		val[i] = a[i] / k;
		rem[i] = a[i] % k;
		if(i == 0) continue;

		if(s[i - 1] == '<') {
			if(val[i - 1] >= val[i]) {
				return false;
			}

			if(val[i - 1] + 1 == val[i] && rem[i - 1] > rem[i]) {
				return false;
			}
		} else {
			if(val[i - 1] <= val[i]) {
				return false;
			}

			if(val[i - 1] - 1 == val[i] && rem[i - 1] < rem[i]) {
				return false;
			}
		}
	}

	return true;
}

void solve() {
	int low = 2, high = (int)1e4 + 1, mid, ret = 1;
	while(low <= high) {
		mid = (low + high) >> 1;
		if(check(mid)) {
			ret = mid;
			low = mid + 1;
		} else {
			high = mid - 1;
		}
	}

	check(ret);
	cout << ret << endl;
	for(int j = 0; j < ret; j++) {
		for(int i = 0; i <= n; i++) {
			int v = a[i] / ret;
			if(j < (a[i] % ret)) v++;
			cout << v << " ";
		}

		cout << endl;
	}

}

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

	read();
	solve();
	return 0;
}

#include<iostream>
#include<cstdio>
#define N 110
using namespace std;
int abs(int x)
{
	return x<0?-x:x;
}
char s[N];
int a[N],b[N],c[N];
int main()
{
	int n,k=999999999;
	scanf("%d",&n);
	scanf("%s",s+1);
	scanf("%d",&a[1]);
	for(int i=2;i<=n+1;++i)
	{
		scanf("%d",a+i);
		k=min(abs(a[i]-a[i-1]),k);
//		printf("%d\n",k);
	}
	printf("%d\n",k);
	for(int i=1;i<=k;++i)
	{
		for(int j=1;j<=n+1;++j)
		{
			printf("%d ",a[j]/k+ (i<=(a[j]%k)?1:0));
		}
		printf("\n");
	}
	return 0;
}


#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  rep(j, v.size()) i >> v[j];
  return i;
}

template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}

template <class T>
void chmin(T& a, const T& b) {
  if (b < a) a = b;
}

vvll to;
vp range;
vll dep;
vll points;
ll dfs(ll i, ll s, ll d) {
  ll count = 1;
  points.pb(i);
  for (ll t : to[i]) count += dfs(t, s + count, d + 1);
  dep[i] = d;
  range[i] = {s, s + count - 1};
  return count;
}

signed main() {
  init();
  ll N;
  cin >> N;
  vll A(N - 1);
  cin >> A;
  rep(i, N - 1) A[i]--;
  to.resize(N);
  range.resize(N);
  dep.resize(N);
  rep(i, N - 1) to[A[i]].pb(i + 1);

  dfs(0, 0, 0);
  vector<unordered_map<ll, ll>> x(N);
  unordered_map<ll, ll> m;

  ll M = 2130;
  rep(i, N) {
    ll p = points[i];
    m[dep[p]]++;
    if (i % M == 0) x[i] = m;
  }

  ll Q;
  cin >> Q;
  rep(i, Q) {
    ll u, d;
    cin >> u >> d;
    u--;
    ll l = range[u].first;
    ll r = range[u].second;
    ll ans = x[r - r % M][d];
    rep(k, r % M) if (dep[points[r - k]] == d) ans++;
    if (l != 0) {
      l--;
      rep(k, l % M) if (dep[points[l - k]] == d) ans--;
      ans -= x[l - l % M][d];
    }
    COUT(ans);
  }
  return 0;
}

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

#define long long
#define INF 1e18
// #define lc 2*node+1
// #define rc 2*node+2

const int mod = 1e9 + 7;
const int maxN = 2e5;

int n, q;

struct Query {
    int a, b, i;
};

bool cmp(Query a, Query b) {
    return a.a < b.a;
}

vector<int> adj[maxN];
Query queries[maxN];
map<int, int> depths[maxN];
int ans[maxN];

// returns the first index at which the value at this position is greater than or equal to val
int search(int val) {
    int l = 0, r = q - 1;
    while (r > l) {
        int mid = (l + r) / 2;
        if (queries[mid].a >= val) {
            r = mid;
        }
        else if (queries[mid].a < val) {
            l = mid + 1;
        }
    }
    return max(l, 0);
}

// read in all the
void dfs(int node, int depth) {
    depths[node][depth] = 1;
    for (int next : adj[node]) {
        dfs(next, depth + 1);

        // now merge the 2 data structures
        if (depths[next].size() > depths[node].size()) {
            swap(depths[node], depths[next]);
        }

        for (pair<int, int> it : depths[next]) {
            // cout << "here" << endl;
            int new_val = depths[node][it.first] + it.second;
            depths[node][it.first] = new_val;
        }

        depths[next].clear();
    }

    // now we can update all the queries for this node since it is updated
    int pos = search(node);
    while (pos < q && queries[pos].a == node) {
        auto it = depths[node].find(queries[pos].b);
        if (it == depths[node].end()) ans[queries[pos].i] = 0;
        else {
            ans[queries[pos].i] = it->second;
        }
        pos ++;
    }
}

int main() {

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

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

    cin >> n;

    // use a map and do small to large merging

    int a;
    for (int i = 1; i < n; i ++) {
        cin >> a; a --;
        adj[a].push_back(i);
    }

    // read in all queries and later when doing the merging we can use it to process
    cin >> q;

    int b;
    for (int i = 0; i < q; i ++) {
        cin >> a >> b; a --;
        queries[i] = {a, b, i};
    }

    // sort based on the nodes
    sort(queries, queries + q, cmp);

    // we don't need to worry about parents anymore

    // compute the depths and put it into the maps at each spot
    dfs(0, 0);

    /*for (pair<int, int> a : depths[0]) {
        cout << a.first << ' ' << a.second << endl;
    }*/

    for (int i = 0; i < q; i ++) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

using namespace std;

int main() {
    int n, q;
    int temp1,temp2,temp3;
    vector<int> t, a, b;
    string s, front, back;

    cin >> n;

    cin >> s;
    front = s.substr(0, n);
    back = s.substr(n, n);

    cin >> q;

    for (int i = 0; i < q; i++) {
        cin >> temp1 >> temp2 >> temp3;
        t.push_back(temp1);
        a.push_back(temp2);
        b.push_back(temp3);
    }

    for (int i = 0; i < q; i++) {

        if (t[i] == 1) {

            if (a[i] > n) {
                char temp = back[a[i] - n - 1];
                back[a[i] - n - 1] = back[b[i] - n - 1];
                back[b[i] - n - 1] = temp;
            }

            else {
                char temp = front[a[i] - 1];

                if (b[i] > n) {
                    front[a[i] - 1] = back[b[i] - n - 1];
                    back[b[i] - n - 1] = temp;
                }

                else {
                    front[a[i] - 1] = front[b[i] - 1];
                    front[b[i] - 1] = temp;
                }
            }
        }

        else
            front.swap(back);

    }

    cout << front << back << endl;
    return 0;

}

// Problem: D - Message from Aliens
// Contest: AtCoder - ZONe Energy Programming Contest
// URL: https://atcoder.jp/contests/zone2021/tasks/zone2021_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms

#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll  long long
#define int long long
#define ld  long double
#define endl "\n"
#define pb  push_back
#define fill(a,val) memset(a,val,sizeof(a))
#define ff  first
#define ss  second
#define test  ll t; cin>>t; while(t--)
#define loop(i,a,b)  for(ll i=a;i<b;i++)
#define loopr(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod     = 1000*1000*1000+7;
const ll inf     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll mod2    = 998244353;
const ll N       = 1000 * 1000 + 10;
const ld pi      = 3.141592653589793;
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll ncr(ll n,ll r,ll m){if(r>n)return 0;ll a=1,b=1,i;for(i=0;i<r;i++){a=(a*n)%m;--n;}while(r){b=(b*r)%m;--r;}return (a*power(b,m-2,m))%m;}

void solve(){
    string s;
    cin>>s;
    vector<char> ans;
    for(ll i=0;i<s.length();i++){
    	if(s[i]!='R'){
    		if(ans.size() > 0 && ans[ans.size() - 1]==s[i]){
    			ans.pop_back();
    		}
    		else{
    			ans.pb(s[i]);
    		}
    	}
    	else{
    		reverse(all(ans));
    	}
    }
    for(auto i:ans) cout<<i;
    cout<<endl;
}
signed main(){
    fastio();
    // test
    solve();
    return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>

#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define all(v) (v).begin(),(v).end()
#define all_rev(v) (v).rbegin(),(v).rend()
#define debug(x) cout << #x << ": " << x << '\n';
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using PL = pair<ll, ll>;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

  int n;
  string s;
  cin >> n >> s;

  int ans = n;
  stack<char> st;

  for (int i = 0; i < s.size(); i++) {
    st.push(s[i]);

    if (st.size() > 2) {
      string t = "";
      rep (j, 3) {
        t += st.top();
        st.pop();
      }

      if (t == "xof") ans -= 3;
      else rep (j, 3) st.push(t[2 - j]);
    }
  }

  cout << ans << endl;
  return 0;
}

#include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MOD 998244353
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    LL k;
    cin >> n >> k;
    vector<vector<LL>> t(n, vector<LL>(n));
    for(LL i=0; i<n; i++){
        for(LL j=0; j<n; j++){
            cin >> t[i][j];
        }
    }
    vector<LL> v(n-1);
    for(LL i=0; i<n-1; i++){
        v[i]=i+1;
    }

    LL sum_val;
    LL ans=0;
    do{
        sum_val=t[0][v[0]];
        for(LL i=0; i<n-2; i++){
            //cout << v[i] << endl;
            sum_val+=t[v[i]][v[i+1]];
        }
        sum_val+=t[v[n-2]][0];
        //cout << sum_val << endl;
        if(sum_val==k){
            ans++;
        }
    }while(next_permutation(v.begin(), v.end()));

    cout << ans << endl;

    return 0;
}


#include <iostream>

using namespace std;

size_t f(size_t L, size_t N)    // a + b = L and 1 <= a, b, <= L の組の数
{
    if (L <= N + 1)
    {
        return (L - 1);   // (1, L-1) .. (L-1, 1)
    }
    else if (2 * N < L)
    {
        return 0;
    }
    else
    {
        return (2 * N - L + 1);    // (L-N, N) .. (N, L-N)
    }
}

int main()
{
    int N, K;          // 1 <= a, b, c, d <= N and a + b - c - d = K
    cin >> N >> K;

    size_t ans = 0;
    for (int l = 2; l <= 2 * N; ++l)
    {
        int m = l - K;

        if (m >= 2)
        {
            ans += f(static_cast<size_t>(l), N) * f(static_cast<size_t>(m), N);
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main() {
  string S, T;
  cin >> S >> T;

  if (S == "Y") {
    for_each(T.begin(), T.end(), [](char& c) { c = toupper(c); });
    cout << T << endl;
  } else {
    cout << T << endl;
  }

  return 0;
}


#include <iostream>
#include <vector>
#include <unordered_set>
#include <utility>
using namespace std;
int main() {
  int h, w, n, m;
  cin >> h >> w >> n >> m;
  vector<bool> light(h * w, false), block(h * w, false);
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    light.at(a * w + b) = true;
  }
  for (int i = 0; i < m; ++i) {
    int c, d;
    cin >> c >> d;
    --c;
    --d;
    block.at(c * w + d) = true;
  }
  unordered_set<int> ans;
  bool is_shin_f = false, is_shin_r = false;
  for (int i = 0; i < h; ++i) {
    is_shin_f = false, is_shin_r = false;
    for (int j = 0; j < w; ++j) {
      int idx_f = i * w + j, idx_r = i * w + w - j - 1;
      if (light.at(idx_f)) is_shin_f = true;
      if (light.at(idx_r)) is_shin_r = true;
      if (block.at(idx_f)) is_shin_f = false;
      if (block.at(idx_r)) is_shin_r = false;
      if (is_shin_f) ans.insert(idx_f);
      if (is_shin_r) ans.insert(idx_r);
    }
  }
  for (int j = 0; j < w; ++j) {
    is_shin_f = false, is_shin_r = false;
    for (int i = 0; i < h; ++i) {
      int idx_f = i * w + j, idx_r = (h - i - 1) * w + j;
      if (light.at(idx_f)) is_shin_f = true;
      if (light.at(idx_r)) is_shin_r = true;
      if (block.at(idx_f)) is_shin_f = false;
      if (block.at(idx_r)) is_shin_r = false;
      if (is_shin_f) ans.insert(idx_f);
      if (is_shin_r) ans.insert(idx_r);
    }
  }

  cout << ans.size() << endl;
  return 0;
}

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12
//priority_queue<int,vector<int>, greater<int> > q2;

int H, W, N, M;
bool vis[1510][1510];
bool L[1510][1510];//光があるか
bool LL[1510][1510];//光があるか
bool B[1510][1510];//ブロックか

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

	cin >> H >> W >> N >> M;
	REP(i, N) {
		int x, y; cin >> x >> y;
		x--; y--;
		L[x][y] = 1;
		LL[x][y] = 1;
	}
	REP(i, M) {
		int x, y; cin >> x >> y;
		x--; y--;
		B[x][y] = 1;
	}
	int ans = 0;
	REP(i, H) {
		FOR(j, 1, W) {
			if (L[i][j - 1] && !B[i][j]) {
				L[i][j] |= (L[i][j - 1]);
			}
		}
	}
	REP(i, H) {
		for (int j = W - 2; j >= 0; j--) {
			if (L[i][j + 1] && !B[i][j]) {
				L[i][j] |= (L[i][j + 1]);
			}
		}
	}
	FOR(i, 1, H) {
		REP(j, W) {
			if (LL[i - 1][j] && !B[i][j]) {
				LL[i][j] |= (LL[i - 1][j]);
			}
		}
	}
	for (int i = H - 2; i >= 0; i--) {
		REP(j, W) {
			if (LL[i + 1][j] && !B[i][j]) {
				LL[i][j] |= (LL[i + 1][j]);
			}
		}
	}

	REP(i, H)REP(j, W) {
		if (L[i][j] || LL[i][j])ans++;
	}
	cout << ans << endl;

	return 0;
}


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

#define fi first
#define se second

int n;
int p[200005];
vector<int> adj[200005];

int q;
pair<pair<int,int>,int> qq[200005];

int dep[200005];
bool vis[200005];
map<int,int> cnt[200005];

int ans[200005];

int dfs(int u) {
    if (dep[u] != 0) return dep[u];
    else return dep[u] = dfs(p[u]) + 1;
}

void presolve() {
    fill(vis, vis + n + 1, 0);
    for (int u = 1; u <= n; u++) {
        if (adj[u].size() == 0) {
            vis[u] = 1;
            cnt[u][dep[u]] = 1;
        }
    }
}

void recur(int u) {
    if (vis[u]) return;
    vis[u] = 1;
    cnt[u][dep[u]] = 1;

    for (int v : adj[u]) {
        recur(v);

        if (cnt[u].size() < cnt[v].size()) {
            swap(cnt[u], cnt[v]);
        }

        for (auto it : cnt[v]) {
            cnt[u][it.fi] += it.se;
        }
        cnt[v].clear();
    }
}

int solve(int u, int d) {
    recur(u);
    if (cnt[u].count(d)) return cnt[u][d];
    else return 0;
}

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

    cin >> n;
    for (int i = 2; i <= n; i++) {
        cin >> p[i];
        adj[p[i]].push_back(i);
    }

    dep[1] = 1;
    for (int i = 2; i <= n; i++) {
        dfs(i);
    }

    cin >> q;
    for (int i = 0; i < q; i++) {
        auto& cur = qq[i];
        cin >> cur.fi.fi >> cur.fi.se;
        ++cur.fi.se;
        cur.se = i;
    }

    sort(qq, qq + q, [&] (auto x, auto y) {
        return dep[x.fi.fi] > dep[y.fi.fi];
    });

    presolve();
    for (int i = 0; i < q; i++) {
        ans[qq[i].se] = solve(qq[i].fi.fi, qq[i].fi.se);
    }

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

    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,a,b) for (int i = a - 1; i >= b; i--)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ll long long
#define dbwt(x) std::cout << fixed << setprecision(15) << x << '\n'
#define Wt(x) cout << x << '\n'
#define re0 return 0
#define Int(...) int __VA_ARGS__; in(__VA_ARGS__)
#define Ll(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define Str(...) string __VA_ARGS__; in(__VA_ARGS__)
#define Vec(t,a,s) vector<t>a(s); in(a)
#define Vec2(t,a,b,s) vector<t>a(s),b(s);rep(i,0,s)in(a[i],b[i])
#define Vec3(t,a,b,c,s) vector<t>a(s),b(s),c(s);rep(i,0,s)in(a[i],b[i],c[i])
#define Vec4(t,a,b,c,d,s) vector<t>a(s),b(s),c(s),d(s);rep(i,0,s) in(a[i],b[i],c[i],d[i])
#define mvec(t,a,i) vector<t>(a,i)
#define mvec2(t,a,b,i) vector<vector<t>>(a,vector<t>(b,i))
void scan(int& x) {std::cin >> x;}
void scan(ll& x) {std::cin >> x;}
void scan(double& x) {std::cin >> x;}
void scan(std::string& x) {std::cin >> x;}
void scan(std::vector<int>& x) {rep (i, 0, x.size()) std::cin >> x[i];}
void scan(std::vector<ll>& x) {rep (i, 0, x.size()) std::cin >> x[i];}
void in(){}
template<class Head, class... Tail>
void in(Head& head, Tail&... tail) {scan(head); in(tail...);}
template<class T, class U>
bool chmax(T& a, U b) {if(a < b){a=b; return true;} return false;}
template<class T, class U>
bool chmin(T& a, U b) {if(a > b){a=b; return true;} return false;}
using namespace std;
template<class T>
using vvec = vector<vector<T>>;
template<class T>
void emitvec(vector<T> a) {rep (i, 0, a.size()) cout << a[i] << " "; cout << endl;}
struct IoSetup {
   	IoSetup() {
     	cin.tie(nullptr);
     	ios::sync_with_stdio(false);
     	cout << fixed << setprecision(15);
   	}
} iosetup;

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

int N, M;
map<pair<int, int>, int> mp;
vector<vector<int>> g(100005);

vector<int> col(100005, -1);
vector<bool> visited(100005, false);

void dfs(int v) {
    visited[v] = true;
    for (int to: g[v]) {
        if (visited[to]) continue;
        if (col[v] == mp[{v, to}]) {
            col[to] = (col[v] == 1 ? N : 1);
        }
        else {
            col[to] = mp[{v, to}];
        }
        dfs(to);
    }
}

int main() {
    cin >> N >> M;
    Vec3(int, u, v, c, M);

    rep (i, 0, M) {
        mp[{u[i], v[i]}] = mp[{v[i], u[i]}] = c[i];
        g[u[i]].pb(v[i]);
        g[v[i]].pb(u[i]);
    }

    col[1] = 1;
    dfs(1);

    rep (i, 1, N + 1) cout << col[i] << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <numeric>
#define REP(i, n, s) for (int i = (s); i < (int)(n); i++)
#define REP0(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
using namespace std;

ll i, j;
const int MOD = 1000000000 + 7;
const int MOD2 = 998244353;

// modint: mod 計算を int を扱うように扱える構造体
template <int MOD>
struct Fp
{
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp &operator+=(const Fp &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp &operator-=(const Fp &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator*=(const Fp &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp &operator/=(const Fp &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr bool operator==(const Fp &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
    {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept
    {
        if (n == 0)
            return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1)
            t = t * a;
        return t;
    }
};

using mint = Fp<MOD2>;

struct UnionFind
{
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;

    UnionFind(int N)
    {
        r = vector<int>(N, -1);
    }

    int root(int x)
    {
        if (r[x] < 0)
            return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y)
    {
        x--;
        y--;
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (r[x] > r[y])
            swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x)
    {
        return -r[root(x)];
    }

    void show()
    {
        REP0(i, r.size())
        {
            cout<<r[i]<<" ";
        }
        cout<<"\n";
    }
};

int main()
{
    ll x, y, a, b;
    ll ans = 0;

    cin >> x >> y >> a >> b;

    ll kako = x;

    while((double)kako * a <= 2e18 && kako * a <= kako + b && kako * a < y){
        kako *= a;
        ans++;
    }
    ans += max(0LL,(y-kako-1)/b);

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

}

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

ll x, y, a, b;

int main()
{
	ll ans = 0;
   	cin>>x>>y>>a>>b;
	while (1) {
		if ((1.0 * a - 1) >= (1.0 * b / x))break;
		x = a * x;
		if (x >= y)break;
		ans ++;
	}
	ll cnt = max((ll)0, (y - x - 1)) / b;

	printf("%lld\n", ans + cnt);
   	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

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

using mat = vector<vector<ll>>;

ll N, M, K;
bool G[110][110];
mat A, E;

ll powmodp(ll x, ll n) {
    if (n==0) return 1;
    if (n%2) return x * powmodp(x,n-1) % mod;
    ll res = powmodp(x,n/2);
    return res * res % mod;
}

ll inv(ll x) {return powmodp(x,mod-2);}

mat prod(mat x, mat y) {
    ll n = x.size();
    mat res(n,vector<ll>(N));
    rep(i,n) rep(j,N) rep(k,N) {
        res[i][j] += x[i][k]*y[k][j]%mod;
        res[i][j] %= mod;
    }
    return res;
}

mat powmat(mat x, ll n) {
    if (n==0) return E;
    if (n%2) return prod(x,powmat(x,n-1));
    mat res = powmat(x,n/2);
    return prod(res,res);
}

int main() {
    cin >> N >> M >> K;
    A.resize(1,vector<ll>(N));
    rep(i,N) cin >> A[0][i];
    rep(i,M) {
        ll x, y; cin >> x >> y;
        x--; y--;
        G[x][y] = G[y][x] = true;
    }
    E.resize(N,vector<ll>(N));
    rep(i,N) E[i][i] = 1LL;

    ll p = inv(M);
    ll half = inv(2);

    mat f(N,vector<ll>(N));
    rep(j,N) {
        ll cnt = 0;
        rep(i,N) if (G[i][j]) cnt++;
        rep(i,N) {
            if (i==j) {
                ll q = cnt * p % mod;
                ll sub = q * half % mod;
                f[i][j] = (1 + mod - sub) % mod;
            } else if (G[i][j]) {
                f[i][j] = p * half % mod;
            }
        }
    }

    mat F = powmat(f,K);
    mat vec = prod(A,F);

    vector<ll> res = vec[0];
    for (ll ans : res) cout << ans << endl;
}

#define _USE_MA_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
#include <cassert>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; exit(0); }
void Yes() { cout << "Yes" << endl; exit(0); }
void No() { cout << "No" << endl; exit(0); }

//----------BIT木 0-index----------
const int BIT_N = 1000010;
int bit_tree[BIT_N];
//[index]にnを追加
void bit_add(int index, int n)
{
	for (int x = index; x < BIT_N; x |= x + 1)
	{
		bit_tree[x] += n;
	}
}
//[0, index)の合計
int bit_sum(int index)
{
	int ret = 0;
	for (int x = index - 1; x >= 0; x = (x & (x + 1)) - 1)
	{
		ret += bit_tree[x];
	}
	return ret;
}

int H, W, M;
int X[200001];
int Y[200001];
vector<int> l_list[200001];
vector<int> __list[200001];

vector<int> m;
bool bit_flg[200001];

signed main()
{
	cin >> H >> W >> M;
	REP(i, M)
	{
		cin >> Y[i] >> X[i];
		X[i]--;
		Y[i]--;

	}

	REP(i, W) l_list[i].push_back(H);
	REP(i, H) __list[i].push_back(W);

	REP(i, M)
	{
		l_list[X[i]].push_back(Y[i]);
		__list[Y[i]].push_back(X[i]);
	}

	REP(i, W)
	{
		SORT(l_list[i]);
	}
	REP(i, H)
	{
		SORT(__list[i]);
	}

	int l_sum = 0;
	int __sum = 0;

	REP(i, W)
	{
		if (l_list[i][0] == 0)
		{
			break;
		}
		l_sum += l_list[i][0];
	}
	REP(i, H)
	{
		if (__list[i][0] == 0)
		{
			break;
		}
		__sum += __list[i][0];
	}

	for (int i = 0; i < W; i++)
	{
		bit_flg[i] = true;
		bit_add(i, 1);
	}

	int x_sum = 0;
	for (int y = 0; y < l_list[0][0]; y++)
	{
		for (auto p : __list[y])
		{
			if (bit_flg[p])
			{
				bit_add(p, -1);
				bit_flg[p] = false;
			}
		}

		x_sum += bit_sum(min(__list[y][0], __list[0][0]));
	}

	cout << l_sum + __sum - x_sum;

}


//#pragma GCC target("avx2")
//#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>

#define IOS ios::sync_with_stdio(false);cin.tie(nullptr)
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define lc(x) ((x)<<1)
#define rc(x) (((x)<<1)|1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;

const ll MOD=1e9+7;
const ll LINF=1e18;
const int INF=0x3f3f3f3f;
const int MAXE=5000050;
const int MAXN=200050;
const int bk_sz=3420;
mt19937 rnd(114514);

map<int,int> visp;
pair<int,int> a[MAXN];
bool vis[MAXN];
void mainwork(int T){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d%d",&a[i].first,&a[i].second);
    }
    sort(a+1,a+m+1);
    visp[n]=1;
    for(int i=1,j=1;i<=m;i=j){
        while(a[i].first==a[j].first)j++;
        for(int k=i;k<j;k++){
            vis[k]=visp[a[k].second-1]||visp[a[k].second+1];
        }
        for(int k=i;k<j;k++){
            visp[a[k].second]=vis[k];
        }
    }
    int ans=0;
    for(auto i:visp){
        ans+=i.second;
    }
    printf("%d\n",ans);
}
signed main(){
    //IOS;
#ifndef ONLINE_JUDGE
    freopen("Ranulx.in","r",stdin);
    freopen("Ranulx.out","w",stdout);
#endif
    int t=1;
    //scanf("%d",&t);
    for(int i=1;i<=t;i++){
        mainwork(i);
    }
}

#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
ll mod=1000000007;
ll INF = 100000000000000000;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}

ll fastExp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x);
        x=((x)*(x));
        n=n/2;
    }
    return (result);
}

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

ll n,k;
map<ll,set<ll> > rows;
map<ll,set<ll> > cols;
vector<pll> v(200005);
map<pll,ll> dp;
set<ll> res;

void recur(ll sx,ll sy)
{
     if(dp.find({sx,sy})!=dp.end())
          return ;

     dp[{sx,sy}]=1;
     ll block=INF;
     if(cols[sy].upper_bound(sx)==cols[sy].end())
          res.insert(sy);
     else
     {
          block=*cols[sy].upper_bound(sx);
     }
     // cout<<sx<<" "<<sy<<" "<<block<<"\n";
     auto it=cols[sy-1].upper_bound(sx);
     for( ; it!=cols[sy-1].end();it++)
     {
          if(*it<=block)
               recur(*it,sy-1);
          else
               break;
     }
     it = cols[sy+1].upper_bound(sx);
     for( ; it!=cols[sy+1].end();it++)
     {
          if(*it<=block)
               recur(*it,sy+1);
          else
               break;
     }

}

void solve()
{
     cin>>n>>k;
     ll i,j;
     for(i=0;i<k;i++)
          cin>>v[i].F>>v[i].S;

     for(i=0;i<k;i++)
     {
          rows[v[i].F].insert(v[i].S);
          cols[v[i].S].insert(v[i].F);
     }
     recur(0,n);
     cout<<res.size();
}

int main()
{

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

}


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

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

  string s[n];
  int arr[n];

  int j = 0;
  for(int i=0; i<2*n; i++)
  {
    cin >> s[j] >> arr[j];
    j++;
  }

  int maxi = arr[0];
  int m;
  for(int i=0; i<n; i++)
  {
    if(arr[i] >= maxi)
    {
      m = i;
      maxi = arr[i];
    }
  }

  arr[m] = -1;

  int maxo = 0;
  int maxoi;
  for(int i=0; i<n; i++)
  {
    if(arr[i] >= maxo)
    {
      maxoi = i;
      maxo = arr[i];
    }
  }

  cout << s[maxoi];
}

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <functional>
#include <set>
#include <math.h>
#include <iomanip>

// int max: 2 x 10^9, long long max: 9 x 10^18
using namespace std;

const int MOD = 1000000007;

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

  long long sum = 0;

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

    sum += (a[i] + b[i])*(b[i] - a[i] + 1)/2;
  }

  cout << sum;

  return 0;
}


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

void Main(){
  ll n;
  cin >> n;

  set<ll> ve;

  for(ll i = 1; i * i <= n; ++i){
  	if(n % i == 0){
  	  ve.insert(i);
  	  ve.insert(n / i);
  	}
  }

  for(auto e : ve){
    cout << e << endl;
  }

}

int main(){
	Main();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*b);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}

vector<ll> enum_div(ll n){//yakusu
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i){
			if(n%i == 0){
				ret.push_back(i);
				if(i*i!=n)ret.push_back(n/i);
			}
	}
	return ret;
}

int main(){

	ll N;
	cin >> N;
	auto ans = enum_div(N);
	SORT(ans);
	for(auto x:ans){
		cout << x << endl;
	}

}


#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
using namespace std;
using graph=vector<vector<int>>;
using field=vector<string>;
using p =pair<int,int>;

int main(){
    ll n;
    cin>>n;
    set<ll> s;
    for(ll i=1;i*i<=n;++i){
        if(n%i==0){
            s.insert(i);
            s.insert(n/i);
        }
    }
    for(auto &e:s){
        cout<<e<<endl;
    }
}

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

#define mod 1000000007
#define INF 1e18
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>

// pb,mp,F,S,MOD,INF should not be used as variable names for any instances...

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void google(int t) {cout << "Case #" << t << ": ";}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

// const int Max=2005;
// vector<ll>edges[Max];
// vector<ll>adj(Max,0);
// check for cases like n=0,n=1 corners which may lead to WA,Costs a lot be careful....

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

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("Error.txt", "w", stderr);
    #endif
   ll i,j,t,n,m,k;
   cin>>n;
   ll ans=INF;
   for(i=0;i<=60;i++)
   {
      ll temp=1ll<<i;
      ans=min(ans,i+n/temp+n%temp);
   }
   cout<<ans<<endl;
    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define out(x) cout << x << '\n'
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
//---------------------------------------------------------------------------------------------------
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
void solve()
{
}
/*  divisor(n)
    入力：整数 n
    出力：nのすべての約数
    計算量：O(√n)
*/
vlli divisor(lli n)
{
  vlli ret;
  for (lli i = 1; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end()); // 昇順に並べる
  return ret;
}
//---------------------------------------------------------------------------------------------------
signed main()
{
  lli a = 0, b = 0, c = 0, h = 0, n = 0, w = 0, ans = 0, count = 0;

  vector<pair<lli, lli>> pr;
  map<lli, lli> ma;
  set<lli> st;

  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  lli m, s, p;
  cin >> s >> p;
  vlli d;
  d = divisor(p);
  rep(i, 0, d.size())
  {
    rep(j, 0, d.size())
    {
      if (d[i] + d[j] == s)
      {
        out("Yes");
        return 0;
      }
    }
  }
  out("No");
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;i++)
#define req(i,a,b) for(register int i=a;i>=b;i--)
using namespace std;
int n,m,l[200010],r[200010];
int main()
{
	cin>>n>>m;
	if (m==0)
	{
		rep(i,1,n) printf("%d %d\n",i*3-2,i*3-1);
		return 0;
	}
	if (n-abs(m)<2||m<0) return printf("-1\n"),0;
	if (m>0) l[1]=0,r[1]=(abs(m)+1)*4;
	rep(i,1,n-1) l[i+1]=i*4-3,r[i+1]=i*4-1;
	rep(i,1,n) printf("%d %d\n",l[i]+1,r[i]+1);
	return 0;
}


#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll n;
ll solve(ll m){
    if(m >= n) m -= n;
    else m += n;
    return m;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll q;
    string s;
    cin >> n >> s >> q;
    bool maki = 0;
    ll t, a, b;

    rep(i, q){
        cin >> t >> a >> b;
        a--; b--;

        if(t == 1){
            if(maki) {
                a = solve(a);
                b = solve(b);
            }
            swap(s[a], s[b]);
        }else{
            maki ^= 1;
        }
    }
    if(maki){
        cout << s.substr(n, n);
        cout << s.substr(0, n) << endl;
    }else{
        cout << s << endl;
    }

    return 0;
}

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD_17 = 1e9 + 7;
const int INF = 1e9 + 1001010;
const double PI = 3.14159265358979;
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

int main(){
    int n; string s; cin >> n >> s;
    int q; cin >> q;
    int t_2 = 0;
    for(int i = 0; i < q; i++){
        int t, a, b; cin >> t >> a >> b;
        if(t == 2){
            t_2++;
            continue;
        }

        a--; b--;
        if(t_2 %2 == 1){
            a = (a+n) % (2*n);
            b = (b+n) % (2*n);
        }
        swap(s[a], s[b]);
    }

    if(t_2%2 == 1) s = s.substr(n) + s.substr(0,n);

    cout << s << endl;
}


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdexcept>
#include<math.h>
#include<iomanip>
using namespace std;

using ll=long long ;

#define rep(i,n)  for(int i=0;i<(n);i++)
#define f first
#define sc second
const int mod=1'000'000'007;

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int fact(int n){
if(n==0){
     return 1;
 }else{
     return n*fact(n-1);
 }
}

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

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

template<class T>void chmax(T& a,T b){
    if(a<b){
        a=b;
    }
}
int gcd(int x, int y) {
     if(x % y == 0) {
        return y;
     } else {
        return gcd(y, x % y);
     }
}

ll f(ll x,ll c,ll d){
    return x-x/c-x/d+x/(c/(gcd(c,d))*d);
}

string to_oct(int n){
    string s;
    while(n){
     s = std::to_string(n%8) + s;
     n /= 8;
    }
return s;
}

using Graph=vector<vector<int > >;

using namespace std;
vector<int> c;
vector<bool> seen;
vector<int>  num;
vector<int> ans;

void dfs(const Graph &G, int v,int p=-1) {
    //seen[v] = true; // v を訪問済にする
    num[c[v]]++;
    if(num[c[v]]==1)ans.push_back(v);
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) {
        if(p==next_v)continue;
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v,v); // 再帰的に探索
    }
    num[c[v]]--;
}

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

   c=vector<int>(n+1);

   rep(i,n){
       cin>>c[i+1];
   }
   Graph g(n+1);
   rep(i,n-1){
       int a,b;
       cin>>a>>b;
       g[b].push_back(a);
       g[a].push_back(b);
   }
   seen.assign(n+1,false);
   num.assign(1000001,0);
   dfs(g,1);

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

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

}

#include <bits/stdc++.h>
using namespace std;
const int kN = 1e5 + 10;

int n;
vector<int> g[kN];
int a[kN], cnt[kN];
vector<int> ans;

void Dfs(int u, int fa = 0) {
  if(!cnt[a[u]]) ans.push_back(u);
  cnt[a[u]]++;
  for(int v : g[u]) if(v != fa) Dfs(v, u);
  cnt[a[u]]--;
}
int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for(int i = 1; i < n; i++) {
    int x, y; scanf("%d%d", &x, &y);
    g[x].push_back(y), g[y].push_back(x);
  }
  Dfs(1);
  sort(ans.begin(), ans.end());
  for(int x : ans) printf("%d\n", x);
  return 0;
}


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

#ifndef ONLINE_JUDGE
#define imie(x) cerr << #x << " = " << x << '\n';
#else
#define imie(x)
#endif

void debug(vector<int> v) {
    cerr << "[";
    int n = (int)v.size();
    for(int i = 0; i < n; i++) {
        cerr << v[i] << (i == n-1 ? "" : ", ");
    }
    cerr << "]" << '\n';
}

void setIO() {
#ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);freopen("Error.txt", "w", stderr);
 freopen("output.txt", "w", stdout);
#endif
 std::ios_base::sync_with_stdio(false);
 std::cin.tie(NULL);
}

void test_case() {
	int n; cin >> n;
	vector< pair<int, int> > p(n), x(n), y(n);
	for(int i = 0; i < n; i++) {
		cin >> x[i].first >> y[i].first;
		x[i].second = i;
		y[i].second = i;
		p[i] = make_pair(x[i].first, y[i].first);
	}
	set<int> use;
	sort(x.begin(), x.end());
	use.insert(x[0].second);
    use.insert(x[1].second);
    use.insert(x[n-2].second);
    use.insert(x[n-1].second);
    sort(y.begin(), y.end());
    use.insert(y[0].second);
    use.insert(y[1].second);
    use.insert(y[n-2].second);
    use.insert(y[n-1].second);
    vector<int> dist;
    for(int a : use) {
    	for(int b : use) {
    		if(a >= b) continue;
    		dist.push_back(max(abs(p[a].first - p[b].first), abs(p[a].second - p[b].second)));
    	}
    }
    sort(dist.begin(), dist.end(), greater<>());
    cout << dist[1] << '\n';

}

int main() {
	setIO();
	int T;
	T = 1;
	while(T-- >0) {
		test_case();
	}
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define pb emplace_back
#define lb(v,k) (lower_bound(all(v),(k))-v.begin())
#define ub(v,k) (upper_bound(all(v),(k))-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define all(a) a.begin(),a.end()
#define rsort(a) {sort(all(a));reverse(all(a));}
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void outset(T s){auto itr=s.begin();while(itr!=s.end()){if(itr!=s.begin())cout<<' ';cout<<*itr;itr++;}cout<<'\n';}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

int main(){
    ll n;cin>>n;
    vector<PP> x(n),y(n);
    vp v(n);
    rep(i,n){
        ll a,b;cin>>a>>b;
        x[i]=PP(a,b,i);
        y[i]=PP(b,a,i);
        v[i]=P(a,b);
    }
    auto dis=[&](ll i,ll j){
        return PP(max(abs(v[i].fi-v[j].fi),abs(v[i].se-v[j].se)),min(i,j),max(i,j));
    };
    sort(all(x));sort(all(y));
    vector<PP> al;
    al.pb(dis(get<2>(x[0]),get<2>(x[n-1])));
    al.pb(dis(get<2>(x[0]),get<2>(x[n-2])));
    al.pb(dis(get<2>(x[1]),get<2>(x[n-1])));
    al.pb(dis(get<2>(y[0]),get<2>(y[n-1])));
    al.pb(dis(get<2>(y[0]),get<2>(y[n-2])));
    al.pb(dis(get<2>(y[1]),get<2>(y[n-1])));
    dupli(al);
    reverse(all(al));
    out(get<0>(al[1]));
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll X,Y,ans,LCM;
ll x,y,p,q,i,j;
void Gcd(ll A,ll B,ll &gcd)
{
	if(B){Gcd(B,A%B,gcd);ll t=X;X=Y;Y=t-(A/B)*Y;}
	else {gcd=A;X=1,Y=0;}
}

ll f(ll a,ll b,ll mod)
{
    ll k=0;
    while(b)
    {
        if(b&1) k=(k+a)%mod;
        a=(a+a)%mod;
        b>>=1;
    }
    return k;
}

void exgcd(ll A,ll B,ll C){
    ll gcd;
    Gcd(A,B,gcd);
    if(C%gcd) return;
    else{
        //if(C/gcd<0)
        //X=f(X,((C/gcd)%LCM+LCM)%LCM,LCM);
        X=X*(C/gcd);
        if(X<0) X=(LCM-(-X)%LCM)%LCM;
        //ll res=((f(X,2*x+2*y,LCM)+i)%LCM+LCM)%LCM;
        ans=min(ans,(f(2*x+2*y,X,LCM)+i)%LCM);
    }
}

int main() {
    int t;
    cin>>t;
    while(t--){
        ans=INT64_MAX;
        cin>>x>>y>>p>>q;
        LCM=(2*x+2*y)/__gcd(2*x+2*y,p+q)*(p+q);
        for(i=x;i<x+y;i++){
            for(j=p;j<p+q;j++){
                exgcd(2*x+2*y,-p-q,j-i);
            }
        }
        if(ans==INT64_MAX) printf("infinity\n");
        else cout<<ans<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')';}
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) {os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define int long long
template<typename T>
void dbg_a(T *a,int l,int r){cout<<" {";for(int i = l;i<r;i++) cout<<a[i]<<", ";cout<<a[r]<<"}"<<endl;}
typedef long long ll;
template<typename T = int>
inline T read(){
    T f = 1,r = 0;
    char c = getchar();
    while(c<'0'||c>'9'){if(c == '-') f = -1; c = getchar();}
    while(c>='0'&&c<='9'){ r = (r<<1) + (r<<3) + c - '0';c = getchar();}
    return f*r;
}
typedef pair<int,int> PII;
#define fi first
#define se second
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i,a,b) for(int i = a;i<=b;i++)
#define For_(i,a,b) for(int i = a;i>=b;i--)
#define _for(i,a) for(int i = 0;i<a;i++)
#define All(x) x.begin(),x.end()

//    For(i,1,n) For(j,1,m) printf("f[%lld][%lld] = %lld\n",i,j,f[i][j]);

const int N = 2e5 + 10,M = 2*N + 10,INF = 0x3f3f3f3f;
const int mod = 998244353;
int h[N],ne[M],e[M],idx;
void add(int a,int b){
    e[++idx] = b;ne[idx] = h[a];h[a] = idx;
}
int exgcd(int a,int b,int &x,int &y){
    int d = a;
    if(b){ d = exgcd(b, a%b, y, x);y -= (a/b)*x;}
    else{x = 1;y = 0;}
    return d;
}
int inv(int a,int mo){
    int x,y;
    int d = exgcd(a,mo,x,y);
    return d == 1 ? (x + mo)%mo : -1;//-1表示不存在，并对逆元调整
}
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
bool merge(int a1,int m1,int a2,int m2,int &A,int &mo){
    int c = (a2 - a1),d = gcd(m1,m2);
    if(c % d) return 0;//gcd(m1,m2)|(a2 - a1)时才有解
    c = (c%m2 + m2)%m2;//将c变为[0,m2)之间的数
    c /= d;m1 /= d;m2 /= d;//两边除以d
    c = c*inv(m1,m2) % m2;//将m1/d 移到右边
    mo = m1*m2*d;// mo = m1 * m2 /d
    A = (c*m1%mo*d%mo + a1)%mo;
    return 1;
}
int EXCRT(int n,int a[],int mo[]){
    int a1 = a[1],m1 = mo[1],A,Mo;
    for(int i = 2;i<=n;i++){
        if(!merge(a1,m1,a[i],mo[i],A,Mo)) return -1;//不合法
        a1 = A;m1 = Mo;
    }
    return (a1 + m1)%m1;
}
int n;
void solve(){
    int x,y,p,q;
    cin>>x>>y>>p>>q;
    int a[3] = {},mo[3] = {};
    int ans = 3e18;
    For(i,x,x+y-1){
        For(j,p,p+q-1){
            a[1] = i,mo[1] = 2*(x+y);
            a[2] = j,mo[2] = p + q;
            int res = EXCRT(2,a,mo);
            if(res == -1) continue;
            ans = min(res,ans);
        }
    }
    if(ans == 3e18)cout<<"infinity"<<"\n";
    else cout<<ans<<"\n";
}
signed main(){
    int T = 1;
    T = read();
    while(T--) solve();
    system("pause");
    return 0;
}


#include <bits/stdc++.h>

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

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

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

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

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

struct State {
  int last = 0;
  ll sum_time = 0;
  set<int> unseen;
};

int solve(int N, ll K, std::vector<std::vector<ll>>&T) {
  int retv = 0;

  stack<State> dfs;
  State init_state;
  for (size_t i = 1; i < N; i++) {
    init_state.unseen.insert(i);
  }

  dfs.push(init_state);

  while (!dfs.empty()) {
    State search = dfs.top();
    dfs.pop();
    if (search.unseen.empty()) {
      int sum_time = search.sum_time + T[search.last][0];
      if (sum_time == K) {
        retv++;
      }
    } else {
      for (auto &&i : search.unseen) {
        State new_state;
        new_state.last = i;
        new_state.sum_time = search.sum_time + T[search.last][new_state.last];
        new_state.unseen = search.unseen;
        new_state.unseen.erase(i);

        dfs.push(new_state);
      }
    }
  }

  return retv;
}

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

  int N;
  ll K;
  cin >> N >> K;

  std::vector<std::vector<ll>> T(N, std::vector<ll>(N, 0));
  for (size_t i = 0; i < N; i++) {
    for (size_t j = 0; j < N; j++) {
      cin >> T[i][j];
    }
  }

  // main procedure
  int ans = solve(N, K, T);

  // output
  cout << ans << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
inline int add(int x,int y) {return x+y>=mod?x+y-mod:x+y;}
inline int add(int x,int y,int z) {return add(add(x,y),z);}
inline int sub(int x,int y) {return x-y<0?x-y+mod:x-y;}
inline int mul(int x,int y) {return 1LL*x*y%mod;}
inline int mul(int x,int y,int z) {return mul(mul(x,y),z);}
#define N 200005
int a[N],pw[N],val[305],n,k;
int fac[N],inv[N],ifac[N];
const int i2=(mod+1)/2;
void init()
{
	fac[0]=1; for(int i=1;i<N;i++) fac[i]=mul(fac[i-1],i);
	inv[0]=inv[1]=1; for(int i=2;i<N;i++) inv[i]=mul(mod-mod/i,inv[mod%i]);
	ifac[0]=1; for(int i=1;i<N;i++) ifac[i]=mul(ifac[i-1],inv[i]);
}
int C(int x,int y){return x>=y?mul(fac[x],ifac[x-y],ifac[y]):0;}
signed main()
{
	// cout<<sizeof(pw)/1024.0/1024.0<<endl;
	cin>>n>>k; init();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) pw[i]=1;
	val[0]=n;
	for(int j=1;j<=k;j++)
	{
		for(int i=1;i<=n;i++) pw[i]=mul(pw[i],a[i]);
		for(int i=1;i<=n;i++) val[j]=add(val[j],pw[i]);
	}
	for(int i=1;i<=n;i++) pw[i]=1;
	for(int i=1;i<=k;i++)
	{
		int ans=0;
		for(int j=0;j<=i;j++)
		{
			int tmp=mul(val[j],val[i-j]);
			ans=add(ans,mul(tmp,C(i,j)));
		}
		for(int j=1;j<=n;j++) pw[j]=mul(pw[j],a[j]+a[j]);
		for(int j=1;j<=n;j++) ans=sub(ans,pw[j]);
		ans=mul(ans,i2);
		printf("%d\n",ans);
	}
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int x, y;
    bool m[3] = { 0, 0, 0 };

    cin >> x >> y;
    m[x] = m[y] = true;

    if(x == y) cout << x << '\n';
    else {
        for(int i = 0; i < 3; ++i) {
            if(!m[i]) {
                cout << i << '\n';
                break;
            }
        }
    }

    return 0;
}

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

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

int main(){
  int T;
  cin >> T;
  rep(i, T){
    long long N;
    cin >> N;
    if (N%2 == 0){
      if (N%4 == 0) cout << "Even" << endl;
      else cout << "Same" << endl;
    }
    else cout << "Odd" << endl;
  }
}


#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;
int x, y, a, b;
signed main() {
	cin >> x >> y >> a >> b;
	int cnt = 0;
	while(x < y) {
		if(x*a - x < b) x = x*a, cnt++;
		else {
			int k = (y-x)/b;
		 	cnt += k;
		 	x += k*b;
		 	if(x < y) { x += b; cnt++; }
		 	break;
		}
	}
	cout << cnt-1 << '\n';
	return 0;
}

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

/***typededfs***/
typedef long long ll;
typedef long double ldb;

/***defines***/
#define M1 1000000007
#define M2 998244353
#define F first
#define S second
#define pb push_back
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forz(i,n) for(int i=0;i<(n);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define rforz(i,n) for(int i=(n-1);i>=0;i--)
#define rfore(i,a,b) for(int i=(a);i>=(b);i--)
#define test int T; cin>>T; while(T--)
#define all(v) v.begin(),v.end()
#define mm(a,b) ((a%M1)*(b%M1))%M1
#define ma(a,b) ((a%M1)+(b%M1))%M1

void io(){
    FASTIO;
    #ifndef ONLINE_JUDGE
  	freopen("input.txt","r",stdin);
  	freopen("output.txt","w",stdout);
    #endif
}

int main(){
    io();
    ll x,y,a,b;
    cin>>x>>y>>a>>b;
    ll cnt{};
    while(x<=(b-1)/a&&x*a<y){
        x*=a;
        cnt++;
    }
    if(y-x-1>=0)
    cnt+=(y-x-1)/b;
    cout<<cnt<<'\n';
}


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

int main(){
    int H,W,counter=0;
    cin >> H >> W;

    vector<string> S(H);

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

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j != W-1){
                if(S[i].at(j) == '.' && S[i].at(j+1) == '.' ){
                    counter++;
                }
            }
           if(i != H-1){
               if(S[i].at(j) == '.' && S[i+1].at(j) == '.'){
                   counter++;
               }
           }
        }
    }
    cout << counter << endl;
}

#include <bits/stdc++.h>

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rag(con) std::begin(con), std::end(con)

constexpr int MAX = 1510;

int board[MAX][MAX]; //+1:light bulb, 0:normal cell -1:block
bool rl[MAX][MAX], rr[MAX][MAX], cl[MAX][MAX], cr[MAX][MAX];

int main()
{
    int h, w, n, m;
    std::cin >> h >> w >> n >> m;

    rep(i, n)
    {
        int x, y;
        std::cin >> x >> y;
        board[x][y] = 1;
    }

    rep(i, m)
    {
        int x, y;
        std::cin >> x >> y;
        board[x][y] = -1;
    }

    for (int i = 1; i <= h; ++i)
    {
        for (int j = 1; j <= w; ++j)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                rl[i][j] = 1;
            }
            else
                rl[i][j] = rl[i][j - 1];
        }
        for (int j = w; j >= 1; --j)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                rr[i][j] = 1;
            }
            else
                rr[i][j] = rr[i][j + 1];
        }
    }

    for (int j = 1; j <= w; ++j)
    {
        for (int i = 1; i <= h; ++i)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                cl[i][j] = 1;
            }
            else
                cl[i][j] = cl[i - 1][j];
        }
        for (int i = h; i >= 1; --i)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                cr[i][j] = 1;
            }
            else
                cr[i][j] = cr[i + 1][j];
        }
    }

    int ans = 0;

    for (int i = 1; i <= h; ++i)
    {
        for (int j = 1; j <= w; ++j)
        {
            if (rl[i][j] || rr[i][j] || cl[i][j] || cr[i][j])
                ++ans;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
template<typename T>void ckmn(T&a,T b){a=min(a,b);}
template<typename T>void ckmx(T&a,T b){a=max(a,b);}
void rd(int&x){scanf("%i",&x);}
void rd(ll&x){scanf("%lld",&x);}
void rd(char*x){scanf("%s",x);}
void rd(ldb&x){scanf("%lf",&x);}
void rd(string&x){scanf("%s",&x);}
template<typename T1,typename T2>void rd(pair<T1,T2>&x){rd(x.first);rd(x.second);}
template<typename T>void rd(vector<T>&x){for(T&i:x)rd(i);}
template<typename T,typename...A>void rd(T&x,A&...args){rd(x);rd(args...);}
template<typename T>void rd(){T x;rd(x);return x;}
int ri(){int x;rd(x);return x;}
template<typename T>vector<T> rv(int n){vector<T> x(n);rd(x);return x;}
template<typename T>void ra(T a[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]);}
template<typename T1,typename T2>void ra(T1 a[],T2 b[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]);}
template<typename T1,typename T2,typename T3>void ra(T1 a[],T2 b[],T3 c[],int n,int st=1){for(int i=0;i<n;++i)rd(a[st+i]),rd(b[st+i]),rd(c[st+i]);}
void re(vector<int> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){rd(u,v);E[u].pb(v);if(!dir)E[v].pb(u);}}
template<typename T>void re(vector<pair<int,T>> E[],int m,bool dir=0){for(int i=0,u,v;i<m;++i){T w;rd(u,v,w);E[u].pb({v,w});if(!dir)E[v].pb({u,w});}}

const int N=200050;
const int inf=1e9+7;

int lim;
vector<int> E[N];

int now;
pii DFS(int u,int p){
	//int fir=-inf,sec=-inf;
	int mn=inf,fir=-inf;
	int mx1=0,mx2=0;
	for(int v:E[u]){
		if(v!=p){
			pii d=DFS(v,u);
			d.first+=1;
			d.second+=1;
			ckmn(mn,d.first);
			//if(d.first>fir)sec=fir,fir=d.first;
			//else ckmx(sec,d.first);
			ckmx(mx1,d.second);
		}
	}
	//if(fir+sec>lim*2+1||max(fir,1)+mx1>lim){
	if((mx1>=lim)){
		//printf("%i ",u);
		now++;
		return {0,-inf};
	}else{
		//if(fir>0)return {fir,-inf};
		//return {inf,mx1};
		if(mn<inf&&mn+mx1<=lim)return {mn,-inf};
		if(p==0)now++;
		return {mn,mx1};
	}
}
int Solve(){
	now=0;
	//printf("%i: ",lim);
	DFS(1,0);
	//printf("\n");
	return max(now,1);
}
int main(){
	int n,k;rd(n,k);
	re(E,n-1);
	int top=n,bot=0,ans=n;
	while(top>=bot){
		int mid=top+bot>>1;
		lim=mid;
		if(Solve()<=k)top=mid-1,ans=mid;
		else bot=mid+1;
	}
	printf("%i\n",ans);
	return 0;
}

#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
const int maxn=2e5+10;
struct Node{
	int x;
	int y;
	friend bool operator < (const Node &a,const Node &b){
		return a.x<b.x;
	}
}a[maxn];
vector<int> ve[maxn];
vector<int> bj[maxn];
map<int,int> mp;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+1+k);
	int cnt=0;
	for(int i=1;i<=k;i++){
		if(a[i].x!=a[i-1].x)
			cnt++;
		ve[cnt].push_back(a[i].y);
	}
	mp[n]=1;
	for(int i=1;i<=cnt;i++){
		for(int j=0;j<ve[i].size();j++){
			if(mp[ve[i][j]-1]||mp[ve[i][j]+1])
				bj[i].push_back(1);
			else
				bj[i].push_back(0);
		}
		for(int j=0;j<ve[i].size();j++){
			if(bj[i][j])
				mp[ve[i][j]]=1;
			else
				mp[ve[i][j]]=0;
		}
	}
	int ans=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
		if(it->second)
			ans++;
	printf("%d",ans);
	return 0;
}


#include<bits/stdc++.h>

#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)

#define sc(a) scanf("%lld",&a)
#define pr(a) printf("%lld\n",a)

#define ll long long
#define vll vector<ll>
#define pb push_back

#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())

#define inf 0x3f3f3f3f3f3f3f3fLL
#define mxn 1000005
#define mod 1000000007
#define pi acos(-1)

#define yes printf("YES\n")
#define no printf("NO\n")

#define r0 return 0

using namespace std;

string mirror="AHIMOTUVWXY";
string letter= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
    ll n,m,i,j,k,x,y,t;

    string s;

    cin>>s;

    ll f=0;

    n=s.size();

    for(i=0;i<n;i+=2){

        if(s[i]>='a' && s[i]<='z')continue;

        f=1;
    }

    for(i=1;i<n;i+=2){

        if(s[i]>='A' && s[i]<='Z')continue;

        f=1;
    }

    if(f)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

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

int main()
{
  string s, ans = "Yes";
  cin >> s;
  for (int i = 0; i < s.size(); i++)
  {
    if (i % 2 == 0)
    {
      if (s.at(i) <= 'Z')
        ans = "No";
    }
    else
    {
      if (s.at(i) > 'Z')
        ans = "No";
    }
  }
  cout << ans << endl;
}


//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
// #define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}

signed main()
{
	fio
	inp(n) inp(k) inp(mod)
	vector<int> posl={1}, posr={1};

	// TODO
	for(int i=1;i<=n;i++)
	{
		vector<int> tposr(posr.size()+i*k), rem(i);
		fo(j,posr.size()+i*k)
		{
			if(j<posr.size())
			{
				rem[j%i]+=posr[j];
				rem[j%i]%=mod;
			}
			tposr[j]=rem[j%i];
			if(j-i*k>=0)
			{
				rem[j%i]-=posr[j-i*k];
				rem[j%i]%=mod;
			}

		}
		swap(posr,tposr);
		// cout<<posr<<endl;
	}

	vector<int> fans(n/2+n%2);
	for(int i=1;i<=n/2+n%2;i++)
	{
		int x=n-i+1;
		vector<int> rem(x);
		fo(j,posr.size())
		{
			posr[j]=posr[j]-rem[j%x];
			posr[j]%=mod;
			rem[j%x]+=posr[j];
			rem[j%x]%=mod;
			if(j-x*k>=0)
				rem[j%x]-=posr[j-x*k];
			rem[j%x]%=mod;
		}

		// cerr<<posl<<'\n';
		// cout<<posr<<"\n\n";

		int ans=0;
		fo(j,min(posr.size(),posl.size()))
			ans=(ans+((int)posl[j]*posr[j])%mod)%mod;

		vector<int> tposl(posl.size()+i*k);
		rem.clear();
		rem.resize(i);
		fo(j,posl.size()+i*k)
		{
			if(j<posl.size())
			{
				rem[j%i]+=posl[j];
				rem[j%i]%=mod;
			}
			tposl[j]=rem[j%i];
			if(j-i*k>=0)
			{
				rem[j%i]-=posl[j-i*k];
				rem[j%i]%=mod;
			}
		}
		swap(posl,tposl);

		int ftans=((ans*(k+1))%mod-1)%mod;
		if(ftans<0)
			ftans+=mod;
		fans[i-1]=ftans;
	}
	int ind=n/2-1;
	while(ind>=0)
	{
		fans.push_back(fans[ind]);
		ind--;
	}
	// cout<<fans.size()<<endl;
	assert(fans.size()==n);
	for(int i:fans)
		cout<<i<<'\n';
	printclock;
}

// author : lynmisakura
// Last Modified: 2020-10-04T12:59:37

#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define dup(x,y) (x + y - 1) / (y)
#define all(x) (x).begin(),(x).end()

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
  cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
  return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
  cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
  return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
  for (auto& i : arr)cin >> i; return in;
}
template<class T> T read(){
  T val;cin >> val; return val;
}
/////////////////////////////////////////////////////////////////////////

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

const int maxn = 100;
mint dp[maxn+10][maxn*(maxn+1)*maxn/2+10];
int N,K;
int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);

  cin >> N >> K >> mod;
  int MAX = N*(N+1)*K/2;
  // 前計算
  dp[0][0] = 1;
  for(int i = 1;i <= N;i++){
    // dp[i-1][] について、mod iでの和を管理する
    vector<mint> R(i+1,0);
    for(int j = 0;j <= MAX;j++){
      R[j % i] += dp[i-1][j];
      if(j - (K+1)*i >= 0) R[j % i] -= dp[i-1][j - (K+1)*i];
      dp[i][j] += R[j % i];
    }
  }
  for(int i = 1;i <= N;i++){
    int l = i - 1;
    int r = N - i;
    mint res = 0;
    for(int j = 0;j <= MAX;j++){
      res += (j == 0 ? (mint)K : (mint)(K+1))*dp[l][j] * dp[r][j];
    }
    cout << res.x << '\n';
  }
  return 0;
}


#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;
#define PI  3.14159265358979323846

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
string S;
ll N, M;
vector<string>A;
int Bingo[3][3] = {};

int main() {
    cin >> N>>M;
    ll maxNM = max(N,M);
    ll minNM = min(N,M);
    minNM += 3;
    if (maxNM<minNM) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
const int mo=1e9+7;
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=getchar();
	while('0'>s||s>'9'){if(s=='-')f=-1;s=getchar();}
	while('0'<=s&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=getchar();}
	x*=f;
}
int n,v1,v2,v3,v4;
int add(int x,int y){return x+y>mo?x+y-mo:x+y;}
int solve1(int x){
	int res=1;
	for(int i=1;i<x-2;i++)res=add(res,res);
	return res;
}
int solve2(int x){
	int f1=1,f2=1;
	for(int i=1;i<x-2;i++)f1=add(f1,f2),f2=add(f1,mo-f2);
	return f1;
}
int main(){
	read(n);char ch;
	scanf("\n%c",&ch);v1=(ch=='A');
	scanf("\n%c",&ch);v2=(ch=='A');
	scanf("\n%c",&ch);v3=(ch=='A');
	scanf("\n%c",&ch);v4=(ch=='A');
	if(v1&&v2&&v3&&v4)puts("1");
	if(v1&&v2&&v3&&!v4)puts("1");
	if(v1&&v2&&!v3&&v4)puts("1");
	if(v1&&v2&&!v3&&!v4)puts("1");
	if(v1&&!v2&&v3&&!v4)puts("1");
	if(!v1&&!v2&v3&&!v4)puts("1");
	if(v1&&!v2&&!v3&&!v4)puts("1");
	if(!v1&&!v2&&!v3&&!v4)puts("1");
	if(v1&&!v2&&v3&&v4)printf("%d\n",solve1(n));
	if(!v1&&v2&&v3&&v4)printf("%d\n",solve2(n));
	if(!v1&&v2&&!v3&&v4)printf("%d\n",solve1(n));
	if(!v1&&v2&&!v3&&!v4)printf("%d\n",solve1(n));
	if(!v1&&!v2&&v3&&v4)printf("%d\n",solve1(n));
	if(v1&&!v2&&!v3&&v4)printf("%d\n",solve2(n));
	if(!v1&&v2&&v3&&!v4)printf("%d\n",solve2(n));
	if(!v1&&!v2&&!v3&&v4)printf("%d\n",solve2(n));
	return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

template <typename F>
class
#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
  [[nodiscard]]
#endif  // defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard)
FixPoint final : private F
{
public:
  template <typename G>
  explicit constexpr FixPoint(G&& g) noexcept
    : F{std::forward<G>(g)}
  {}

  template <typename... Args>
  constexpr decltype(auto)
  operator()(Args&&... args) const
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  noexcept(noexcept(F::operator()(std::declval<FixPoint>(), std::declval<Args>()...)))
#endif  // !defined(__GNUC__) || defined(__clang__) || __GNUC__ >= 9
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};  // class FixPoint

#if defined(__cpp_deduction_guides)
template <typename F>
FixPoint(F&&)
  -> FixPoint<std::decay_t<F>>;
#endif  // defined(__cpp_deduction_guides)

namespace
{
  template <typename F>
#if !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
  #  if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
__attribute__((warn_unused_result))
#  elif defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_Check_return_)
_Check_return_
#  endif  // defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#endif  // !defined(__has_cpp_attribute) || !__has_cpp_attribute(nodiscard)
  inline constexpr decltype(auto)
  makeFixPoint(F&& f) noexcept
  {
    return FixPoint<std::decay_t<F>>{std::forward<std::decay_t<F>>(f)};
  }
}  // namespace
template <typename T>
void fwt(vector<T>& f) {
  int n = f.size();
  for (int i = 1; i < n; i <<= 1) {
    for (int j = 0; j < n; j++) {
      if ((j & i) == 0) {
        T x = f[j], y = f[j | i];
        f[j] = x + y, f[j | i] = x - y;
      }
    }
  }
}
template <typename T>
void ifwt(vector<T>& f) {
  int n = f.size();
  for (int i = 1; i < n; i <<= 1) {
    for (int j = 0; j < n; j++) {
      if ((j & i) == 0) {
        T x = f[j], y = f[j | i];
        f[j] = (x + y) / 2, f[j | i] = (x - y) / 2;
      }
    }
  }
}

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

  int64 N;
  cin >> N;
  int64 a = ((1 << N) - 1), b = ((1 << (N-1)) - 1);

  if (N == 1) {
    cout << 1 << endl << "AB" << endl;
    return 0;
  }

  int64 n = b / __gcd(a, b);
  int64 x = n * a / b, m = x;

  cout << x << endl;
  FOR(i, 1, x+1) {
    REP(j, 1 << N) {
      if (__builtin_popcount(i & j) % 2) cout << "A";
      else cout << "B";
    }
    cout << endl;
  }
}

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

vector<string> f(int n){
    if(n == 1)  return vector<string>{"AB"};
    vector<string> ans = f(n - 1);
    int sz = ans.size();
	for(int t = 0; t < sz; ++t){
        ans[t] = ans[t] + ans[t];
        string s = ans[t];
        int siz = s.size();
        for(int i = siz / 2; i < siz; ++i)  s[i] = "AB"[s[i] == 'A'];
        ans.emplace_back(s);
    }
    string s(1 << (n - 1), 'A'),  ss(1 << (n - 1), 'B');
    ans.emplace_back(s + ss);
    return ans;
}

int n;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);
    cin >> n;
    vector<string> s = f(n);
    cout << s.size() << "\n";
    for(auto &v : s)  cout << v << "\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T,class U>
inline bool chmax(T &a,U b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}
template<class T,class U>
inline bool chmin(T &a,U b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}
constexpr int INF=1000000000;
constexpr ll llINF=1000000000000000000;
constexpr int mod=998244353;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
/*
vector<vector<ll>>C,sC;
void init_comb(int n,int m){
    C.resize(n+1,vector<ll>(m+1,0));
    sC.resize(n+1,vector<ll>(m+1,0));
    C[0][0]=1;
    for(int i=1;i<=n;i++){
        C[i][0]=1;
        for(int j=1;j<=m;j++){
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    rep(i,n+1){
        rep(j,m){
            sC[i][j+1]=(sC[i][j]+C[i][j])%mod;
        }
    }
}*/
ll gcd(ll a,ll b){
    while(a%b){
        a%=b;
        swap(a,b);
    }
    return b;
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
bool isprime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
set<int>primes;
void init_prime(int n){
    for(int i=2;i<=n;i++){
        bool f=true;
        for(int j:primes){
            if(j*j>i)break;
            if(i%j==0){
                f=false;
                break;
            }
        }
        if(f)primes.insert(i);
    }
}
ll modpow(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1){
            res*=a;
            res%=mod;
        }
        a*=a;
        a%=mod;
        b>>=1;
    }
    return res;
}
vector<ll>inv,fact,factinv;
void init_fact(int n){
    inv.resize(n+1);
    fact.resize(n+1);
    factinv.resize(n+1);
    inv[0]=0;
    inv[1]=1;
    fact[0]=1;
    factinv[0]=1;
    for(ll i=1;i<=n;i++){
        if(i>=2)inv[i]=mod-((mod/i)*inv[mod%i]%mod);
        fact[i]=(fact[i-1]*i)%mod;
        factinv[i]=factinv[i-1]*inv[i]%mod;
    }
}
ll _inv(ll a,ll m=mod){
    //gcd(a,m) must be 1
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b;swap(a,b);
        u-=t*v;swap(u,v);
    }
    u%=m;
    if(u<0)u+=m;
    return u;
}
ll comb(int a,int b){
    if(a<b)return 0;
    if(a<0)return 0;
    return fact[a]*factinv[a-b]%mod*factinv[b]%mod;
}
ll multicomb(int a,int b){
    return comb(a+b-1,b);
}

int h,w,k;
constexpr ll p=665496236;
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>h>>w>>k;
    vector<vector<ll>>dp(h+1,vector<ll>(w+1,0));
    vector<vector<char>>c(h+1,vector<char>(w+1,'.'));
    rep(i,k){
        int x,y;
        cin>>x>>y;
        x--,y--;
        cin>>c[x][y];
    }
    dp[0][0]=1;
    rep(i,h){
        rep(j,w){
            if(i<h){
                if(c[i][j]=='D'||c[i][j]=='X'){
                    dp[i+1][j]+=dp[i][j];
                    dp[i+1][j]%=mod;
                }
                if(c[i][j]=='.'){
                    dp[i+1][j]+=dp[i][j]*p%mod;
                    dp[i+1][j]%=mod;
                }
            }
            if(j<w){
                if(c[i][j]=='R'||c[i][j]=='X'){
                    dp[i][j+1]+=dp[i][j];
                    dp[i][j+1]%=mod;
                }
                if(c[i][j]=='.'){
                    dp[i][j+1]+=dp[i][j]*p%mod;
                    dp[i][j+1]%=mod;
                }
            }
        }
    }
    cout<<dp[h-1][w-1]*modpow(3,h*w-k)%mod<<endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cin(string, s);
    Cins(int, n+1, a);

    /*srand(time(nullptr));
    int n = 10;
    vc<int> a(n+1);
    a[0] = rand() % 100;
    For(i, n) a[i+1] = (a[i] + 30 + rand() % 40) % 100;
    string s;
    For(i, n) s += (a[i] < a[i+1] ? '<' : '>');
    Couts(a);
    Cout(s);*/

    int k = 1e4;
    For(i, n) Mini(k, abs(a[i]-a[i+1]));
    Cout(k);

    vc<vc<int>> b(k, vc<int>(n+1, 0));
    For(i, n+1) For(j, a[i]) b[j % k][i] ++;
    For(i, k) Couts(b[i]);
}


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

#define f(i, a, b) for (int i = a; i < b; i++)
#define rf(i, a, b) for (int i = a; i > b; i--)
#define lf(i, a, b) for (long long i = a; i < b; i++)
#define sq(a) (a)*(a)
#define cube(a) (a)*(a)*(a)
#define pb push_back
#define ppb pop_back
#define LB lower_bound
#define UB upper_bound
#define sarr(arr, n) sort(arr, arr + n);
#define svec(v) sort(v.begin(), v.end());
#define svecr(v) sort(v.rbegin(), v.rend());
#define intinp(var) int var; \
        cin >> var;
#define adjc(adj, n) int adj[n];
#define adjcw(adj, n) vector<pair<int, int>> adj[n];
#define PYES cout << "YES\n"
#define PNO cout << "NO\n"
#define PYes cout << "Yes\n"
#define PNo cout << "No\n"
#define endl "\n"

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unordered_map<int, int> um;

int main(){
    ll n, k; cin >> n >> k;
    f(i, 0, k){
        if (n%200 == 0) n /= 200;
        else{
            n *= 1000;
            n += 200;
        }
    }
    cout << n << "\n";
    return 0;
}