#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define db double
#define pb push_back
#define all(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define cps(x) sort(all(x)), (x).erase(unique(all(x)), end(x))
#define cps2(x, y) sort(all(x), y), (x).erase(unique(all(x)), end(x))
#define mem(x, y) memset(& x, y, sizeof(x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int n0 = 2e5 + 123;
ll a[n0], b[n0];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n; cin >> n; for (int i = 1; i <= n; i++) {
		cin >> a[i];
		a[i] += a[i - 1];
		//cerr << a[i] << ' ';
	}
	ll res = 0, mx = 0;
	for (int i = 1; i <= n; i++) {
		mx = max(mx, a[i]);
		ll tmp = b[i - 1] + mx;
		b[i] = b[i - 1] + a[i];
		res = max(res, max(b[i], tmp));
	}
	cout << res;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <queue>
#include<deque>

using namespace std;
const int mod = 1e9 + 7;
typedef long long LL;
int ans[110] = {1,2,3,3,1,3,2,2,1,2,1,1,1,3,1,1};
int f[1010];
int b[1010];
int n;

void solve()
{
    scanf("%d",&n);
    int state = 0;
    for(int i = 0;i < 4;i ++)
    {
        int a;
        scanf("%s",&a);
        state |= (a - 'A') << i;
    }
    f[2] = 1;
    b[0] = 1;
    for(int i = 3;i <= n;i ++) f[i] = ((LL)f[i] + f[i - 1] + f[i - 2]) % mod;
    for(int i = 1;i <= n - 3;i ++) b[i] = (LL)b[i - 1] * 2 % mod;

    if(n < 3) printf("1\n");
    else if(ans[state] == 1) printf("1\n");
    else if(ans[state] == 2) printf("%d\n",f[n]);
    else if(ans[state] == 3) printf("%d\n",b[n - 3]);
}

int main()
{
    int T = 1;
    //scanf("%d",&T);
    while(T --)
    {
        solve();
    }
    return 0;
}


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

int p[20]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47},cnt=15;
int n,pos[50],a;
long long ans=2e18;

int main()
{
    scanf("%d",&n);
    for(int t=1;t<=n;++t) {
        scanf("%d",&a);
        for(int i=0;i<cnt;++i) if(a%p[i]==0) pos[t]|=(1<<i);
    }
    for(int i=0;i<(1<<cnt);++i) {
        int flag=1;
        for(int j=1;j<=n;++j) {
            if((i&pos[j])==0) {flag=0;break;}
        }
        if(flag) {
            long long tmp=1;
            for(int j=0;j<cnt;++j) if((i>>j)&1) tmp*=p[j];
            ans=min(ans,tmp);
        }
    }
    cout<<ans;
}

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

vector<ll> sieve(ll n) {
  vector<ll> p(n);p[2]=2;
  for(ll i=3;i<n;i+=2)p[i]=i;
  for(ll i=3;i*i<n;i+=2)if(p[i])for(ll j=i*i;j<n;j+=i)p[j]=0;
  p.erase(remove(p.begin(), p.end(), 0), p.end());
  return p;
}

void Main() {
  vector<ll> p=sieve(50);
  ll n;
  cin >> n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=MAXL;
  rep(t,1<<p.size()) {
    ll x=1;
    rep(i,p.size()) {
      if(t&(1<<i)) x*=p[i];
    }
    rep(i,n) {
      ll d=__gcd(x,a[i]);
      if(d==1) goto next;
    }
    ans=min(ans,x);
  next:;
  }
  pr(ans);
}

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


#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
//#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair

#define mod 1000000007
//#define mod 998244353
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
void __print(int x)
{
    cerr << x;
}
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

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

int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int mI(int a, int m)
{
    return power(a, m - 2, m);
}
//__builtin_popcount
vector<vector<int>>
    dir = {{0, 1}, {1, 0}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

#define double long double

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<string> v(n);
    int ans = 0;
    fo(i,n){
        cin >> v[i];
    }
    fo(i,n){
        fo(j,m){
            fo(k,2){
                int i1 = i + dir[k][0];
                int j1 = j + dir[k][1];
                if(i1>=0&&i1<n&&j1>=0&&j1<m&&v[i][j]=='.'&&v[i1][j1]=='.'){
                    ans++;
                }
            }
        }
    }
    cout << ans << "\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);

    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;

        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
ll I=1167167167167167167;
ll Q=1e9+7;
#define rep(i,a) for (ll i=0;i<a;i++)
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end());reverse(v.begin(),v.end());}
template<class T> void print(vector<T> v) {rep(i,v.size()) cout<<v[i]<<endl;}

using F=long long;
F e=0;
int MAX_N=131072*4;
std::vector<F> segment(MAX_N*2-1,e);

F segment_function(F a,F b){
    return a^b;
}
void pu_fanction(F &a,F b){
    a^=b;
}

namespace po167{
F get(int k){return segment[k+MAX_N-1];}
F qu_sub(int a,int b,int l,int r,int k){
    if(b<=l||r<=a) return e;
    if(a<=l&&r<=b) return segment[k];
    else{
        F X=qu_sub(a,b,l,(r+l)/2,k*2+1);
        F Y=qu_sub(a,b,(l+r)/2,r,k*2+2);
        return segment_function(X,Y);
    }
}
F qu(int a,int b){return qu_sub(a,b,0,MAX_N,0);}
// get(k)=a
void replace(int k,F a){
    k+=(MAX_N-1);
    segment[k]=a;
    while(k>0){
        k--;
        k/=2;
        segment[k]=segment_function(segment[k*2+1],segment[k*2+2]);
    }
}
//get(k) ◯ a
void pu(int k,F a){
    k+=(MAX_N-1);
    pu_fanction(segment[k],a);
    while(k>0){
        k--;
        k/=2;
        segment[k]=segment_function(segment[k*2+1],segment[k*2+2]);
    }
}
};
using namespace po167;

//main関数だよーーー
int main(){
    ll N,q;
    cin>>N>>q;
    rep(i,N){
        ll a;
        cin>>a;
        replace(i,a);
    }
    vector<F> ans;
    rep(i,q){
        ll t,x,y;
        cin>>t>>x>>y;
        x--;
        if(t==1) pu(x,y);
        else ans.push_back(qu(x,y));
    }
    print(ans);
}

#include <bits/stdc++.h>

using namespace std;

typedef signed char i8;
typedef signed short i16;
typedef signed int i32;
typedef signed long long i64;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef float f32;
typedef double f64;

u32 XOR(u32 a,u32 b) {
    return a ^ b;
}

template <typename T>
struct seg {
    vector<T> tree;
    u64 B;
	T (*fn)(T,T);
    seg(u64 n,T (*func)(T,T)) {
        fn = func;
        B = 1;
        while (B < n)
            B *= 2;
        tree.resize(2 * B, (T)0);
    }

    void add(u64 k, T x) {
        u64 p = B + k;
        tree[p] = fn(tree[p], x);
        while (p > 1) {
            p = p / 2, tree[p] = fn(tree[2 * p], tree[2 * p + 1]);
        }
    }

    T query(u64 l, u64 r) {
        l += B, r += B;
        T res = (T)0;
        while (l <= r) {
            if (l % 2 == 1)
                res = fn(res, tree[l++]);
            if (r % 2 == 0)
                res = fn(res, tree[r--]);
            l /= 2, r /= 2;
        }
        return res;
    }
};

i32 main() {
#ifdef LOCAL
    freopen("output.txt", "w", stdout);
    freopen("input.txt", "r", stdin);
#endif

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

	u32 n, q;
	cin >> n >> q;
    seg<u32> a(n, &XOR);

    for (u32 i = 0; i < n; i++) {
		u32 e;
		cin >> e;
		a.add(i, e);
	}

	for (u32 i = 0; i < q; i++) {
		u32 ty, x, y;
		cin >> ty >> x >> y;

		if(ty == 1) {
			a.add(x -1, y);
		}

		else
			cout << a.query(x - 1, y - 1) << "\n";
	}

	return 0;
}


#include<cstdio>
#include<cstring>
#define N 300001
#define mod 1000000007
using namespace std;
char ch1[N],ch[N];
int k,cnt[N],lim[N];
long long pre[N],answer[N],qz[17][N],c[17][17];
bool bo[N];
long long C(int n,int m)
{
	return c[n][m];
}
int main()
{
	scanf("%s",ch1+1);
	scanf("%d",&k);
	int p=strlen(ch1+1);
	c[0][0]=1;
	for (int i=1;i<=16;i++)
	{
		c[i][0]=1;
		for (int j=1;j<=i;j++) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	for (int i=1;i<=p;i++)
	{
		lim[i]=ch1[i]-'0';
		if (!(0<=lim[i]&&lim[i]<=9)) lim[i]=ch1[i]-'A'+10;
	}
	for (int i=1;i<=16;i++)
	{
		qz[i][0]=1;
		for (int j=1;j<=p;j++)
			qz[i][j]=qz[i][j-1]*i%mod;
	}
	memset(bo,false,sizeof(bo));
	long long ans=0;
	int cnt=0;
	for (int i=1;i<p;i++)
	{
		for (int j=1;j<=15;j++)
		{
			for (int s=1;s<=k;s++)
				pre[s]=qz[s][i-1];
 			for (int s=1;s<=k;s++)
			{
				answer[s]=pre[s];
				for (int s1=1;s1<s;s1++)
					answer[s]=(answer[s]-answer[s1]*C(s-1,s1-1)%mod)%mod;
			}
			ans=(ans+answer[k]*C(15,k-1)%mod)%mod;
		}
	}
	for (int i=1;i<=p;i++)
	{
		if (cnt>k) break;
		for (int j=0;j<lim[i];j++)
		{
			if (i==1&&j==0) continue;
			int newcnt=cnt;
			if (!bo[j]) newcnt++;
		//	if (i==1&&j==0&&bo[j]) newcnt--;
			for (int s=k;s>=newcnt;s--)
				pre[s]=qz[s][p-i];
			for (int s=newcnt;s<=k;s++)
			{
				answer[s]=pre[s];
				for (int s1=newcnt;s1<s;s1++)
					answer[s]=(answer[s]-answer[s1]*C(s-newcnt,s1-newcnt)%mod)%mod;
			}
			ans=(ans+answer[k]*C(16-newcnt,k-newcnt)%mod)%mod;
		}
		if (!bo[lim[i]])
			bo[lim[i]]=true,cnt++;
	}
	if (cnt==k) ans++;
	printf("%lld\n",ans);
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Pint pair<int,int>
#define Pll pair<ll,ll>
#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
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000;
constexpr ll llINF=1000000000000000000;
constexpr int mod=1000000007;
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);
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
ll modpow(ll a,ll b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    ll memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<ll>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(ll i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
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 comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
ll inv(ll x){
    x=modpow(x,mod-2);
    return x;
}
double dp[111][111][111];
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    dp[a][b][c]=1;
    for(int i=a;i<100;i++){
        for(int j=b;j<100;j++){
            for(int k=c;k<100;k++){
                dp[i+1][j][k]+=dp[i][j][k]*i/(i+j+k);
                dp[i][j+1][k]+=dp[i][j][k]*j/(i+j+k);
                dp[i][j][k+1]+=dp[i][j][k]*k/(i+j+k);
            }
        }
    }
    double ans=0;
    rep(i,101){
        rep(j,101){
            rep(k,101){
                if(i==100||j==100||k==100){
                    ans+=dp[i][j][k]*(i+j+k-a-b-c);
                }
            }
        }
    }
    printf("%.12lf\n",ans);
    return 0;
}


#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

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

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

    #ifdef Local
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
    #endif

    ll b, c;

    cin>>b>>c;

    pll ara[4];

    if(b > 0){
        ara[0] = {-b - (c - 1) / 2,  -b};
        ara[1] = {b,  max(b, - (- b - c / 2)  - 1)};
        ara[2] = {b - c / 2, b};
        ara[3] = {-b, -(b - (c - 1) / 2)};
    }else if(b < 0){
        ara[0] = {b - c / 2, b};
        ara[1] = {-b, -b + (c - 1) / 2};
        ara[2] = {-b - (c - 1) / 2, -b};
        ara[3] = {b, - (-b - c / 2 + 1)};
    }else if(b == 0){
        ara[0] = {-c / 2, 0};
        ara[1] = {0, (c - 1) / 2};
        ara[2] = {0, 0};
        ara[3] = {0, 0};
    }
    sort(ara, ara + 4);

    ll cur = -3e18;

    ll ans = 0;

    for(pll u: ara){
        //cerr<<u.ff<<" "<<u.ss<<endl;
        if(u.ff > cur){
            ans += u.ss - u.ff + 1;
            cur = u.ss;
        }else{
            ans += max(0LL, u.ss - cur);
            cur = max(cur, u.ss);
        }
    }

    cout<<ans<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}


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

using ll = long long;
using ld = long double;
using lp = pair<ll, ll>;
using lmap = map<int, int>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (ll i = (ll)(n); i < (ll)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define eb emplace_back

constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1 << 30;
constexpr ll LINF = 1LL << 62;
inline int mod(ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit(ll b, ll i) { return b & (1 << i); }
inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
inline void ans_exit(string msg) { cout << msg << endl; exit(0); }
template<class T> bool chmin(T &a, T b) {if(a > b){a = b; return 1;} return 0;}
template<class T> bool chmax(T &a, T b) {if(a < b){a = b; return 1;} return 0;}

int main() {
    ll n; cin >> n;
    vector<ll> p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }

    vl pos(n);
    rep(i, n) pos[p[i]] = i;

    set<ll> swapped; vl ans;
    rep(i, n) {
        while(pos[i] != i) {
            pos[p[pos[i] - 1]]++;
            swap(p[pos[i]], p[pos[i] - 1]);
            pos[i]--;
            if(swapped.count(pos[i])) ans_exit("-1");
            swapped.insert(pos[i]);
            ans.pb(pos[i]);
        }
    }

    if((int)ans.size() != n - 1) ans_exit("-1");
    rep(i, n - 1) cout << ans[i] + 1 << endl;
}

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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define         PI         acos(-1)
#define        lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize    ios_base::sync_with_stdio(false);cin.tie(NULL);
#define        sqr(a)       ((a)*(a))
#define         max5        100000
#define         max6        1000000
#define         mod       1000000

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

    int n,k,i,a,j;

    cin >> n;

    int ar[n+10];
    int po[n+10];
    int vis[n+10]={0};

    int ok  = 1;
    for(i=1; i<=n; i++)
    {
        cin >> ar[i];
        po[ar[i]] = i;
    }

    for(i=1;i<=n;i++)
    {
        if(vis[i])
        {
            if(i!=ar[i])return cout<<-1<<endl,0;
            continue;
        }
        int st = po[i];

        for(j=st-1;j>=i;j--)
        {
            swap(ar[j],ar[j+1]);
            pt.pb(j);
            vis[j]=1;
        }
    }

    if(pt.size()!=n-1)return cout << -1 << endl,0;
    for(auto x : pt)cout << x << endl;
}


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

#define M1 1000000007
#define M2 998244353
#define INF 1e18
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<int>
#define vlli vector <long long>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)

/********************************************************************/
const double pi = 3.1415926535;
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

/********************************************************************/
int main()
{
    FAST();

        ll int s,p; cin>>s>>p;
        int flag=0;
        for (ll int i=1; i*i<=p; i++)
        {
            if (p%i==0)
            {
                if (i+p/i == s){flag=1; }
            }
        }
     if (flag==1){cout<<"Yes"<<endl; }
     else {cout<<"No"<<endl; }
}

#include"bits/stdc++.h"

using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define i64 int64_t
#define deb(x) cout<<"["<<#x<<"="<<x<<"]"<<"\n"
#define pb push_back

int main()
{
	fast;
	i64 a,b;
	cin>>a>>b;
	for(i64 i = 1;i<=(sqrt(b));++i)
	{
		// deb(i)// deb(j);
			i64 j = (b/i);
			if((i*j)==b&&(i+j)==a)
			{
				cout<<"Yes";
				goto next;
			}
	}
	cout<<"No";
	next:cout<<"\n";
	return 0;
}


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

const int inf=0x3f3f3f3f;
const int maxn=1e5;
typedef long long ll;
int main(){
           ll a,b,c,d;
           cin>>a>>b>>c>>d;
          ll x=max(a,b);
          ll y=min(c,d);
          ll ans=x-y;
          cout<<ans<<endl;

}

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

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

  return 0;
}


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

#define fastio			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int             long long
#define double 			long double
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define gcd(x,y)		__gcd(x,y)
#define MOD             (int)(1e9 + 7)
#define INF             (int)9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
int fastpow				(int a, int b, int m = MOD) { int res = 1; a %= m;
						while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) 			fastpow(a, MOD - 2)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree            <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
    fastio;
    int N;
    cin>>N;
    vector<string>v;
    for(int i=0;i<N;i++)
    {
      string str;
      cin>>str;
      v.push_back(str);
    }

    unordered_map<string,int>um;
    for(int i=0;i<N;i++)
    {
    	string s=v[i];
    	um[s]++;
    }
    for(int i=0;i<N;i++)
    {
    	string s=v[i];
    	if(s[0]=='!')
    	{
    		string s2=s.substr(1,s.size()-1);
    		if(um[s2]>0)
    		{
    			cout<<s2<<"\n";
    			return 0;
    		}
    	}
    }
    cout<<"satisfiable\n";
    return 0;
}

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

#define FORI(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define FORD(i, a, b) for (int i = (int)a; i >= (int)b; i--)
#define PB push_back
#define ALL(v) v.begin(),v.end()
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;

int main() {
    int n; cin >> n;
    set<string> st;
    bool has = false;
    string ans = "";
    FORI(i, 0, n - 1) {
        string str; cin >> str;
        if (str[0] == '!') {
            if (st.count(str.substr(1))) {
                has = true;
                ans = str.substr(1);
                break;
            }
        } else {
            if (st.count("!" + str)) {
                has = true;
                ans = str;
                break;
            }
        }
        st.insert(str);
    }
    if (has) cout << ans << endl;
    else cout << "satisfiable" << endl;
    return 0;
}


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

using namespace std;

int main(){
  int N,M,i,j,n=0;
  cin >> N >> M;

  int hurui[1001];
  hurui[0]=0;
  for(i=1;i<=1000;i++){
   hurui[i]=0;
  }

  int A[N],B[M];
  for(i=0;i<N;i++){
    cin >> A[i];
    hurui[A[i]]++;
  }
  for(i=0;i<M;i++){
    cin >> B[i];
    hurui[B[i]]++;
  }
  for(i=1;i<=1000;i++){
    if(hurui[i]==1){
      cout << i << " ";
    }
  }

}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(N),B(M);
    for(int n=0;n<N;n++) cin >> A[n];
    for(int m=0;m<M;m++) cin >> B[m];

    vector<int> ans(0);
    int cnt = 0;
    for(int n=0;n<N;n++){
        bool found1 = false;
        for(int m=0;m<M&!found1;m++){
            if(A[n]==B[m]){
                found1=true;
            }
        }
        if(!found1){
            ans.push_back(A[n]);
            cnt++;
        }
    }
    for(int m=0;m<M;m++){
        bool found2 = false;
        for(int n=0;n<N&!found2;n++){
            if(A[n]==B[m]){
                found2=true;
            }
        }
        if(!found2){
            ans.push_back(B[m]);
            cnt++;
        }
    }
    sort(ans.begin(),ans.end());
    for(int n=0;n<cnt;n++) cout << ans[n] << " ";
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

int mas[200005];

int main()
{
 	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
 	ios_base::sync_with_stdio(0); cin.tie(0);
 	int n;
 	cin >> n;
 	for (int i = 1; i <= n; i++) cin >> mas[i];

 	int mx = 0;
 	ll pref = 0, ans = 0;
 	for (int i = 1; i <= n; i++)
 	{
 		pref += (ll) mas[i];
 		ans += pref;
 		mx = max(mx, mas[i]);
 		cout << ans + (ll) i * (ll) mx << '\n';
 	}
 	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(lint i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
///#pragma GCC optimize ("-O3")
ll input(){
    ll  n;
    cin >> n;
    return n;
}///input関数
ll combination(ll n,ll r){
    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (combination(n-1,r-1) + combination(n-1,r));

}///nCr
ll facctorialMethod(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}///階乗

int main(){
    ll n = input();
    vector<ll>a;
    ll a_max = 0;
    ll ans = 0;
    ll total = 0;
    ll pir = 0;
    rep(i,0,n){
        a.push_back(input());
        pir += total;
        total += a.at(i);
        a_max = max(a_max,a.at(i));
        ans = pir + total + a_max*(i+1);
        cout << ans << endl;
    }
}


/*
	Author : $%U%$
	Time : $%h%$:$%m%$:$%s%$, $%D%$/$%M%$/$%Y%$
*/

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

using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!

using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;

using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;

#define tcT template<class T
#define tcTU tcT, class U
// ^ lol this makes everything look weird but I'll try it
tcT> using V = vector<T>;
tcT, size_t SZ> using AR = array<T,SZ>;
tcT> using PR = pair<T,T>;

// pairs
#define mp make_pair
#define f first
#define s second

// vectors
// oops size(x), rbegin(x), rend(x) need C++17
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound
tcT> int lwb(V<T>& a, const T& b) { return int(lb(all(a),b)-bg(a)); }

// loops
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18; // not too close to LLONG_MAX
const db PI = acos((db)-1);
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

// bitwise ops
// also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set
constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until USACO updates ...
	return x == 0 ? 0 : 31-__builtin_clz(x); } // floor(log2(x))
constexpr int p2(int x) { return 1<<x; }
constexpr int msk2(int x) { return p2(x)-1; }

ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

tcT> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; } // set a = min(a,b)
tcT> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }

tcTU> T fstTrue(T lo, T hi, U f) {
	hi ++; assert(lo <= hi); // assuming f is increasing
	while (lo < hi) { // find first index such that f is true
		T mid = lo+(hi-lo)/2;
		f(mid) ? hi = mid : lo = mid+1;
	}
	return lo;
}
tcTU> T lstTrue(T lo, T hi, U f) {
	lo --; assert(lo <= hi); // assuming f is decreasing
	while (lo < hi) { // find first index such that f is true
		T mid = lo+(hi-lo+1)/2;
		f(mid) ? lo = mid : hi = mid-1;
	}
	return lo;
}
tcT> void remDup(vector<T>& v) { // sort and remove duplicates
	sort(all(v)); v.erase(unique(all(v)),end(v)); }
tcTU> void erase(T& t, const U& u) { // don't erase
	auto it = t.find(u); assert(it != end(t));
	t.erase(it); } // element that doesn't exist from (multi)set

#define el '\n'

void solve()
{
	ll n,S,D; cin>>n>>S>>D;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(x<S and y>D)
        {
            flag=true;
        }
    }
    if(flag) cout<<"Yes"<<el;
    else cout<<"No"<<el;
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);

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

}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 200005;
int seg[4*N],h;
void update(int idx,int p=1,int s=0,int e=h)
{
    if(s==e)
    {
        seg[p] = 1;
        return;
    }
    int mid = (s+e)>>1;
    if(idx<=mid)
        update(idx,2*p,s,mid);
    else
        update(idx,2*p+1,mid+1,e);
    seg[p] = seg[2*p] + seg[2*p+1];
}
int get(int l,int r,int p=1,int s=0,int e=h)
{
    if(r<s||l>e)
        return 0;
    if(l<=s&&e<=r)
        return seg[p];
    int mid = (s+e)>>1;
    return get(l,r,p<<1,s,mid)+get(l,r,p<<1|1,mid+1,e);
}
void solve()
{
    int w, m;
    cin>>h>>w>>m;
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++)
    {
        cin>>v[i].first>>v[i].second;
        v[i].first--;
        v[i].second--;
    }
    sort(v.begin(),v.end());

    vector<vector<int>> by_row(h), by_col(w);
    for (auto &it : v)
    {
        by_row[it.first].push_back(it.second);
        by_col[it.second].push_back(it.first);
    }
    for (int x = 0; x < h; x++)
        by_row[x].push_back(w);
    for (int y = 0; y < w; y++)
        by_col[y].push_back(h);

    int reachable_rows = by_col[0].front();
    int reachable_cols = by_row[0].front();

    ll ans = 0;
    for (int x = 0; x < reachable_rows; x++)
        ans += by_row[x].front();
    for (int y = 1; y < reachable_cols; y++)
    {
        int height = by_col[y].front();

        ans += max(0, height - reachable_rows);

        int x = min(reachable_rows, height);
        ans += get(0,x-1);

        for (int it : by_col[y])
            update(it);
    }
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false),cin.tie(0);
    solve();
    return 0;
}


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

signed main() {
	int a,b;
	cin >> a >> b;
	b = a-b;
	double tmp = 1.0*b/a;
	printf("%f",tmp*100);
	return 0;
}

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

//UnionFindテンプレ
class UnionFind {
    // まとめる 判定 サイズを知る
    public:
    // Aから見た親の番号を格納する。rootだったら-1*その集合のサイズ。
    vector<int> Parent;

    // 初期化
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }

    // Aのrootを調べる
    int root(int A) {
        if (Parent[A] < 0) return A;  // マイナスならそれはroot
        return Parent[A] = root(Parent[A]);
    }

    // rootの値をプラスに戻して返す(サイズ)
    int size(int A) {
        return -Parent[root(A)];
    }

    // くっつける関数
    bool connect(int A, int B) {
        // AとBのroot同士をくっつける
        A = root(A);  // ここのAは、"rootの場所"の意味
        B = root(B);
        if (A == B) return false;  // 既にくっついている
        if (size(A) < size(B))
        swap(A, B);            // 大きい方にくっつけるために中身交換
        Parent[A] += Parent[B];  // 中身更新
        Parent[B] = A;
        return true;
    }

    //連結か調べる関数
    bool issame(int A, int B) {
        return root(A) == root(B);
    }
};

//chmin,chmax関数(DP用)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//aのZ/mZでの逆元
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//ここから

int main() {
    int64_t S,P;
    cin >> S >> P;
    for (int64_t i = 1; i*i <= P; i++) {
        if (i*(S-i) == P) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,srt,end) for(ll i = (srt); i < (ll)(end); i++)
//ll MOD=1000000007;
//ll mod=998244353;
//int inf=1000001000;
//ll INF=1e18+5;
//cout << std::fixed << std::setprecision(15) << y << endl;

// For debug
// Ref: https://qiita.com/ysuzuki19/items/d89057d65284ba1a16ac
#define dump(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << "\n";}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << "\n";}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ std::cerr << "\n"; for(const auto& v : vv){ view(v); } }
template<typename T> void dump_cout(const T& v) { for(long long i = 0; i < v.size(); i++) std::cout << v[i] << (i == v.size()-1 ? "\n" : " "); }

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    ll cnt = 0;
    deque<char> q;
    rep(i,0,s.size()){
        if(s[i] == 'R') cnt ^= 1;
        else if(cnt) q.push_back(s[i]);
        else q.push_front(s[i]);
    }
    if(!cnt) reverse(q.begin(),q.end());

    string ans;
    for(auto c : q){
        if(ans.size() && ans.back() == c) ans.pop_back();
        else ans.push_back(c);
    }
    cout << ans << endl;
    return 0;
}

#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 <cmath>
#include <limits>
#include <stdio.h>
#include <string.h>
#include <numeric>
#define P pair<int, int>
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, a, b) for (int i = a; i < b; i++)
const long long INF = 1LL << 60;
typedef long long ll;
template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
#define all(x) (x).begin(), (x).end()

using namespace std;

// 上下左右の移動用配列
// セットで上、右、下、左の順番
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

int main(int, char **){
  ll n;
  cin >> n;
  set<ll> s;
  for(ll a = 2; a*a <= n; a++){
    ll x = a * a;
    while(x <= n){
      s.insert(x);
      x *= a;
    }
  }
  cout << n-s.size() << endl;
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<ll, ll>;
using tp = tuple<ll, ll, ll>;

template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;

#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rep2(i, m, n) for(ll i = (ll)(n)-1; i >= (ll)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)

constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
static const ld pi = 3.141592653589793L;

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

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

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

//グラフ関連
struct Edge {
    int to, rev;
    ll cap;
    Edge(int _to, int _rev, ll _cap) : to(_to), rev(_rev), cap(_cap) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, int from, int to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, (int)G[to].size(), cap));
    if(revFlag)
        G[to].push_back(Edge(from, (int)G[from].size() - 1, revCap));
}

void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if(b >= c * d) {
        cout << -1 << en;
        return;
    }

    ll ans = (a + (c * d - b - 1)) / (c * d - b);
    cout << ans << en;
}

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

    // ll t;
    // cin >> t;
    // REP(i, t - 1) {
    //     solve();
    // }

    solve();

    return 0;
}

/* >>>>>Shwetal<<<<< */
#include <bits/stdc++.h>
#define int long long
#define f(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inputArray(arr) f(i, 0, arr.size()) cin >> arr[i]
#define printArray(arr) f(i, 0, arr.size()) cout << arr[i] << ' '; cout << endl
#define endl '\n'
typedef long long ll;
const int mod = 1e9+7;
using namespace std;

void solve() {
    int x;
    cin >> x;
    int n = x;
    int a = 100;
    int rem = x % a;
    int div = x/a;
    if(rem == 0){
        cout << 100 << endl;
        return;
    }else{
        while(x % a != 0){
            div++;
            x = div * a;
            if(x % a == 0){
                cout << x - n << endl;
                return;
            }
        }
    }

}

int32_t main(){
    // freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1;
    // cin >> T;
    while(T--){
        solve();
        // if(solve())
            // cout << "YES" << endl;
        // else
            // cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
// 入力のときに10000倍して四捨五入する関数
int in() {
    double x;
    cin >> x;
    x *= 10000;
    return round(x);
}

// x^2 * y^2 = r^2
bool ok(ll dx, ll dy, ll z) { return dx * dx + dy * dy <= z * z; }
// 円の上半分を探索
ll f(ll x, ll y, ll z, ll lim) { //lim上限
    int l = 0, r = 1;
    ll res = 0;
    for (int i = int(1e9) + 50000; i >= lim; i -= 10000) {
        while (ok(x - l * 10000, i - y, z)) --l;
        while (ok(r * 10000 - x, i - y, z)) ++r;
        res += r - l - 1;
    }
    return res;
}

int main() {
    ll x = in();
    ll y = in();
    ll z = in();
    x %= 10000;
    y %= 10000;
    ll ans = f(x, y, z, 10000); //上半分
    ans += f(x, -y, z, 0); //下半分
    cout << ans << endl;
    return 0;
}

// D - Circle Lattice Points
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using dbl = long double;

int main(){
	ll scale = 1e4;
	dbl x, y, r; cin>>x>>y>>r;
	ll X = round(x*scale);
	ll Y = round(y*scale);
	ll R = round(r*scale);
	ll r2 = R*R;
	ll ans = 0;
	for(ll i=0; i<=2*R+scale; i+=scale){
		ll y = floor((Y+R)/(dbl)scale)*scale - i;
		ll dy = Y - y;
		ll dx2 = r2 - dy*dy;
		if(dx2 < 0) continue;
		ll dx = floor(sqrt((dbl)dx2));
		ll L = ceil((X - dx)/(dbl)scale);
		ll R = floor((X + dx)/(dbl)scale);
		ans += R - L + 1;
	}
	cout<< ans <<endl;
}


#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

const int INF = INT_MAX / 2;

ll gcd(const ll sx, const ll sy) {
    ll x = min(sx, sy);
    ll y = max(sx, sy);
    ll tmp;
    while (x > 0) {
        tmp = y;
        y = x;
        x = tmp % x;
    }
    return y;
}

vector<int> as;

vector<int> calc_divisors(const int a) {
    vector<int> ans;
    for (int i = 1; i * i <= a; i++) {
        if (a % i == 0) {
            if (i * i == a) {
                ans.push_back(i);
            } else {
                ans.push_back(i);
                ans.push_back(a / i);
            }
        }
    }
    sort(ans.begin(), ans.end());
    return ans;
}

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

    int min_a = INF;

    as.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> as[i];
        chmin(min_a, as[i]);
    }

    map<int, int> memo;

    for (int i = 0; i < N; i++) {
        vector<int> divisors = calc_divisors(as[i]);
        for (auto d : divisors) {
            if (memo.find(d) == memo.end()) {
                memo[d] = as[i];
            } else {
                memo[d] = gcd(memo[d], as[i]);
            }
        }
    }

    int ans = 0;
    for (auto kv : memo) {
        const int key = kv.first;
        const int val = kv.second;
        if (key <= min_a && key == val) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()

typedef  long long             ll;
typedef  unsigned long long    ull;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  1e6+5;
const ll   mod   =  998244353 ;
const ll   INF   =  0x7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll n, m, a[2002];
map <ll, ll> g;

void solve(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		for(int j = 1; j * j <= a[i]; j++){
			if(a[i] % j == 0){
				g[j] = __gcd(g[j], a[i]);
				g[a[i] / j] = __gcd(g[a[i] / j], a[i]);
			}
		}
	}
	int mn = *min_element(a + 1, a + n + 1);
	ll ans = 1;
	for(auto it : g){
		if(it.f < mn && it.s == it.f) ans++;
	}
	deb1(ans)
}

int main(){
	GODSPEED;
	int test = 1;
	//cin >> test;
	for(int i = 1; i <= test; i++){
		solve();
	}
}


//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define eps 1e-8
//#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int mod= 1e9+7;
long double pi = acosl(-1);
//const ll infl = LLONG_MAX;
const int inf = 1e9+2;
const int nmax = 2e5+5;
//const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;

void NA(){
    cout<<"-1", exit(0);
}

int a[nmax], b[nmax], p[nmax];
pii a2[nmax];
int koi[nmax];

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

    int n;
    cin>>n;
    for(int i=1; i<=n; i++) cin>>a[i];
    for(int i=1; i<=n; i++) cin>>b[i];
    for(int i=1; i<=n; i++) cin>>p[i];
    for(int i=1; i<=n; i++) a2[i] = {a[i], i};
    sort(a2+1, a2+1+n);
    for(int i=1; i<=n; i++){
        koi[ a2[i].second ] = i;
    }
    for(int i=1; i<=n; i++){
        if(p[i]!=i and b[ p[i] ] >= a[i]) NA();
    }

    vector<pii>ans;
    for(int i=1; i<=n; i++){
        int manid = a2[i].second;
        int bagid = p[ manid ];
        while( koi[ bagid ] < i){
            ans.push_back( {manid, bagid} );
            bagid = p[ bagid ];
            p[ manid ] = bagid;
        }
    }
    cout<<ans.size()<<"\n";
    for(pii z : ans) cout<<z.first<<" "<<z.second<<"\n";
}
/*
*/

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

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }

class BinaryIndexedTree {
private:
	int n;
	vector<ll> bit;

public:
	BinaryIndexedTree(int num)
	{
		// 0は番兵
		n = num + 1;
		bit.assign(n + 1, 0);
	}

	// idx is 1-indexed
	void add(int idx, ll val)
	{
		while (idx <= n) {
			bit[idx] += val;
			idx += idx & -idx;
		}
	}

	// [1, idx) idx is 1-indexed
	ll sum(int idx)
	{
		ll sum = 0;
		while (0 < idx) {
			sum += bit[idx];
			idx -= idx & (-idx);
		}
		return sum;
	}

	// [a, b) idx is 1-indexed
	ll range(int a, int b)
	{
		return (sum(b) - sum(a));
	}

	// val-th number (val is 0-indexed)
	int lower_bound(ll val)
	{
		int idx = 0;
		int k = 1;
		while (2 * k <= n) {
			k <<= 1;
		}
		for (; 0 < k; k >>= 1) {
			if (idx + k < n && bit[idx + k] < val) {
				val -= bit[idx + k];
				idx += k;
			}
		}
		return idx + 1;
	}
};

struct PINFO {
	ll	pIdx;
	ll	pWeight;
	ll	bIdx;
	ll	bWeight;
};

// 処理
void Solve()
{
	ll K;
	cin >> K;
	vector<PINFO> hito(K);
	VL b2w(K);
	REP(i, K) {
		ll a;
		cin >> a;
		hito[i].pIdx = i;
		hito[i].pWeight = a;
	}
	REP(i, K) {
		ll b;
		cin >> b;
		b2w[i] = b;
	}
	REP(i, K) {
		ll p;
		cin >> p;
		p--;
		hito[i].bIdx = p;
		hito[i].bWeight = b2w[p];
	}

	for (auto one : hito) {
		if (one.pIdx != one.bIdx) {
			if (one.pWeight <= one.bWeight) {
				cout << -1 << endl;
				return;
			}
		}
	}

	vector<PINFO> sortedHito = hito;
	auto comp = [](PINFO a, PINFO b) {
		return a.pWeight < b.pWeight;
	};
	sort(ALL(sortedHito), comp);

	VL b2Idx(K);
	REP(i, K) {
		auto one = hito[i];
		b2Idx[one.bIdx] = i;
	}

	vector<P> ans;
	for (PINFO s : sortedHito) {
		ll srcIdx = s.pIdx;
		auto &src = hito[srcIdx];
		auto dstIdx = b2Idx[srcIdx];
		auto &dst = hito[dstIdx];

		if (dstIdx == srcIdx) continue;

		ans.emplace_back(src.pIdx + 1, dst.pIdx + 1);

		swap(b2Idx[src.bIdx], b2Idx[dst.bIdx]);
		swap(src.bIdx, dst.bIdx);
		swap(src.bWeight, dst.bWeight);
	}

	cout << ans.size() << endl;
	for (auto a : ans) {
		cout << a.first << " " << a.second << endl;
	}
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


// Problem : A - Three Dice
// Contest : AtCoder - AISing Programming Contest 2021（AtCoder Beginner Contest 202）
// URL : https://atcoder.jp/contests/abc202/tasks/abc202_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;
/* DEBUGGING */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
/* MACROS */
typedef long long int ll;

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef map<int,int> mii;
typedef tuple<int,int,int> tup;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  all(x)      (x).begin(), (x).end()
#define  lcm(x, y)   ((x) * (y) / __gcd(x, y))
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcountll(x)
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)

/* CONSTANTS */
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

void solve(){
    vi v(3);
    rep(i,0,3) cin >> v[i];
    cout << 21-accumulate(all(v),0);
}

int main(){
    IOS;
    solve();
}

/* in the name of Anton */

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#ifdef ARYANC403
    #include "/home/aryan/codes/PastCodes/template/header.h"
#else
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
    #pragma GCC optimize ("-ffloat-store")
    #include<iostream>
    #include<bits/stdc++.h>
    #define dbg(args...)
#endif

using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 998244353LL;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{
    lli ans=1;
    k=3;
    while(k--)
    {
        cin>>n;
        ans*=(n*(n+1)/2)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
}   aryanc403();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long s,p;
int main() {
	cin>>s>>p;
	for(int i=1;i<=sqrt(p);i++){
		if(!(p%i)){
			if(i+p/i==s){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

int main(void){
    // Your code here!
    int t;
    t=1;
    while(t--)
    {
        ll s,p,m,n,i;cin>>s>>p;
        string ans="No";
        for(i=1;i*i<=p;i++)
        if(i*(s-i)==p)
        ans="Yes";
        cout<<ans<<endl;
    }
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
using namespace std;

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

int binary_search(vector<int> v,int key){
    int left=-1;
    int right=v.size();
    while(right-left>1){
        int mid=left+(right-left)/2;
        if (v[mid]>=key) right=mid;
        else left=mid;
    }
    return right;
}

int main(){
    int n;
    string S;
    int ar[4][n+1];
    cin>>n>>S;

    for (int i=0;i<4;i++){
        for(int j=0;j<n+1;j++){
            ar[i][j]=0;
        }
    }

    for (int j=0;j<n;j++){
        for (int i=0;i<4;i++){
            ar[i][j+1]=ar[i][j];
        }
        if (S[j]=='A') ar[0][j+1]+=1;
        if (S[j]=='T') ar[1][j+1]+=1;
        if (S[j]=='C') ar[2][j+1]+=1;
        if (S[j]=='G') ar[3][j+1]+=1;
    }

ll ans=0;
    for (int width=2;width<n+1;width++){
        for (int j=1;j<n-width+2;j++){
            int x=j+width-1;
            int y=j-1;
            int A_num=ar[0][x]-ar[0][y];
            int T_num=ar[1][x]-ar[1][y];
            int C_num=ar[2][x]-ar[2][y];
            int G_num=ar[3][x]-ar[3][y];

            if ((A_num==T_num)&&(C_num==G_num)) ans++;
        }
    }

    cout<<ans<<endl;

    return 0;
}

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

int main(){
  int N;
  long long ans = 0;
  string S;
  cin >> N >> S;
  int A, T, C, G;
  for(int i = 0; i < N; i++){
    A = 0;
    T = 0;
    C = 0;
    G = 0;
    for(int j = i; j < N; j++){
      if(S.at(j) == 'A') A++;
      if(S.at(j) == 'T') T++;
      if(S.at(j) == 'G') G++;
      if(S.at(j) == 'C') C++;
      if(A == T && C == G){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    long long N;
    cin >> N;
    set<long long> A,B,C;
    vector<vector<long long> > BB;
    vector<long long> v0;
    vector<long long> Ac,Cc;
    for(long long i=0; i<N; i++){
        Ac.push_back(0);
        BB.push_back(v0);
        Cc.push_back(0);
    }
    long long p;
    for(long long i=0; i<N; i++){
        cin >> p;
        Ac.at(p-1)++;
        A.insert(p-1);
    }
    for(long long i=0; i<N; i++){
        cin >> p;
        BB.at(p-1).push_back(i);
        B.insert(p-1);
    }
    for(long long i=0; i<N; i++){
        cin >> p;
        Cc.at(p-1)++;
        C.insert(p-1);
    }
    set<long long> D;
    set_intersection(A.begin(), A.end(),B.begin(), B.end(),inserter(D, D.end()));
    long long ans = 0;
    for(auto itr = D.begin(); itr != D.end(); ++itr) {
        long long d = *itr;
        //cout << d;
        long long ccc=0;
        for(long long i=0; i < BB.at(d).size(); i++){
            long long bbb = BB.at(d).at(i);
            //cout << Ac.at(bbb) << "*" << Cc.at(bbb) << "=" << ans << endl;
            ccc += Cc.at(bbb);
        }
        ans += Ac.at(d) * ccc;
    }
    cout << ans;
}

#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define fe(x)                   (*(x.begin()))
#define le(x)                   (*(x.rbegin()))
#define pb                      push_back
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x,id)               (*(x.find_by_order(id)))
#define ook(y)                  order_of_key(y)
#define all(x)                  (x).begin(),(x).end()
#define si(a)                   scanf("%d",&a)
#define sii(a,b)                scanf("%d %d",&a,&b)
#define siii(a,b,c)             scanf("%d %d %d",&a,&b,&c)
#define sl(a)                   scanf("%lld",&a)
#define sll(a,b)                scanf("%lld %lld",&a,&b)
#define slll(a,b,c)             scanf("%lld %lld %lld",&a,&b,&c)
#define rep(i,a,b)              for(ll i = a; i<=b;  i++)
#define un(x)                   x.erase(unique(all(x)), x.end())
#define TT                      long long TC;  scanf("%lld",&TC);  for(ll tc = 1; tc<=TC; tc++)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
#define assign(v,n,x)           v.clear(); for(int I = 0; I<n; I++)    v.pb(x);
#define SZ(x)                   (int)x.size()
#define ff                      first
#define ss                      second
#define FF                      fflush(stdout);
#define ms(AR,x)                memset(AR,x,sizeof AR);
#define case                    printf("Case %lld: ",tc);
using                           namespace __gnu_pbds;
using                           namespace std;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;

#define mx 200003

ll ara[mx];

map<char,vector<ll> > ar;

main(){
//read;

int n;
si(n);

for(int i = 0; i<2*n; i++){
    ll x;
    sl(x);
    char c;
    cin>>c;
    ar[c].pb(x);
}

ll ans = 0;
vector<char> v;
char d;

for(auto i:ar){
    if( SZ(i.ss)%2 )  v.pb(i.ff),ans = 9e18;
    else d = i.ff;
}

for(char X:{'R','G','B'})
    sort(all(ar[X]));

if(SZ(v)){
    for(ll i:ar[v[0]]){
        int id = lb( all(ar[v[1]]),i ) - ar[v[1]].begin();
        id = min( id,SZ(ar[v[1]]) - 1 );
        int id2 = id - 1;
        id2 = max(0,id2);
        ll x = ar[v[1]][id],y = ar[v[1]][id2];
        ans = min( { ans, abs(i-x) , abs(i-y) } );
    }
    if(SZ(ar[d])){
        ll tmp[mx];
        set<pll> st;
        for(ll i = 0; i<SZ(ar[d]); i++){
            ll x = ar[d][i];
            int id = lb( all(ar[v[1]]), x ) - ar[v[1]].begin();
            id = min( id,SZ(ar[v[1]]) - 1 );
            int id2 = id - 1;
            id2 = max(0,id2);
            ll p = min( abs(x - ar[v[1]][id] ) , abs( x - ar[v[1]][id2]) );
            tmp[i] = p;
            st.insert(pll(p,i));
        }

        for(ll i = 0; i<SZ(ar[d]); i++){
            pll u = pll(tmp[i],i);
            st.erase(u);
            ara[i] = fe(st).ff;
            st.insert(u);
        }

        for(ll i = 0; i<SZ(ar[d]); i++){
            ll x = ar[d][i],y,z;
            int id = lb(all(ar[v[0]]),x) - ar[v[0]].begin();
            id = min( id, SZ(ar[v[0]]) - 1);
            int id2 = id - 1;
            id2 = max(0,id2);
            y = ar[v[0]][id];
            z = ar[v[0]][id2];
            ll p = min( abs(x - y), abs(x - z) );
            ans = min(ans, p + ara[i]);
        }
    }
}

cout<<ans;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int H,W;cin>>H>>W;
  vector<vector<char>>S(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>S[i][j];
    }
  }
  vector<vector<int>>dp(H,vector<int>(W,0));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(S[i][j]=='R'){
        dp[i][j]++;
      }
      if(i!=0){
        dp[i][j]+=dp[i-1][j];
      }
      if(j!=0){
        dp[i][j]+=dp[i][j-1];
      }
    }
  }
  int ans=1;
  for(int i=0;i<=H+W-2;i++){
    char defo='-';
    for(int j=0;j<=i;j++){
      int k=i-j;
      if(j>=0&&k>=0&&j<H&&k<W){
        if(defo=='-'){
          if(S[j][k]!='.')defo=S[j][k];
        }
        else if(S[j][k]!='.'&&defo!=S[j][k]){
          cout<<0<<endl;
          return 0;
        }
      }
    }
    if(defo=='-'){
      ans*=2;
      ans%=998244353;
    }
  }
  cout<<ans<<endl;

}

#include <bits/stdc++.h>
int main() {
	using std::cin;
	using std::string;
	using std::vector;
	int h, w;
	cin >> h >> w;
	vector<string> s (h);
	for (int i = 0; i < h; i++)
		cin >> s[i];
	int ans = 1;
	for (int i = 0; i <= h + w - 2; i++) {
		int b_ok = 1, r_ok = 1;
		for (int j = std::max(0, i - w + 1); j <= std::min(h - 1, i); j++) {
			if (s[j][i - j] == 'R')
				b_ok = 0;
			if (s[j][i - j] == 'B')
				r_ok = 0;
		}
		ans = ans * (b_ok + r_ok) % 998244353;
	}
	std::cout << ans << std::endl;
	return 0;
}


#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N, M; cin >> N >> M;
    vector<vector<vector<int>>> G(N, vector<vector<int>>(26));
    vector<vector<bool>> adj(N, vector<bool>(N, false));
    REP(i, 0, M) {
        int a, b; char c; cin >> a >> b >> c; a--; b--; c -= 'a';
        G[a][c].push_back(b);
        G[b][c].push_back(a);
        adj[a][b] = adj[b][a] = true;
    }

    int ans = 1 << 30;
    queue<pair<int, int>> Q;
    Q.push({0, N - 1});
    vector<vector<int>> dist(N, vector<int>(N, -1));
    dist[0][N - 1] = dist[N - 1][0] = 0;

    while (!Q.empty()) {
        auto [u, v] = Q.front(); Q.pop();
        if (ans <= dist[u][v]) break;
        if (u == v) {
            ans = min(ans, 2 * dist[u][v]);
            continue;
        }
        if (adj[u][v]) {
            ans = min(ans, 2 * dist[u][v] + 1);
            continue;
        }
        REP(i, 0, 26) {
            for (auto x : G[u][i]) {
                for (auto y : G[v][i]) {
                    if (dist[x][y] != -1) continue;
                    dist[x][y] = dist[y][x] = dist[u][v] + 1;
                    Q.push({x, y});
                }
            }
        }
    }
    if (ans < (1 << 30)) cout << ans << endl;
    else cout << -1 << endl;

    return 0;
}

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

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

void chmin(ll& a, ll b) {
  if (a > b) a = b;
}

int main() {
  int N, M;
  cin >> N >> M;

  ll H[N];
  rep(i, N) {
    cin >> H[i];
  }
  sort(H, H+N);

  vector<ll> left(N/2), right(N/2);
  rep(i, N/2) {
    left[i] = H[2*i+1] - H[2*i];
    right[i] = H[2*(i+1)] - H[2*i+1];

  }

  vector<ll> left_sum(N/2 + 1, 0), right_sum(N/2+1, 0);
  rep(i, N/2) {
    left_sum[i+1] = left_sum[i] + left[i];
    right_sum[i+1] = right_sum[i] + right[i];
  }

  vector<ll> W(M);
  rep(i, M) {
    cin >> W[i];
  }

  ll ans = 10000000000000000;

  rep(i, M) {
    // 先生を初めて超えるindex
    int x = lower_bound(H, H +N, W[i]) - H;

    if (x % 2) {
      chmin(ans, left_sum[(x-1)/2] + (W[i]-H[x-1])
          + right_sum[(N-1)/2] - right_sum[(x-1)/2]);
    } else {
      chmin(ans, left_sum[x/2] + (H[x]-W[i])
            + right_sum[(N-1)/2] - right_sum[x/2]);
    }
  }

  cout << ans << endl;

}


#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<array<int, 2>> a(n);
	int res = INT_MAX;
	for(int i = 0;i < n;i ++) {
		cin >> a[i][0] >> a[i][1];
	}
	for(int i = 0;i < n;i ++) {
		for(int j = 0;j < n;j ++) {
			if(i == j) {
				res = min(res, a[i][0]+a[j][1]);
			} else {
				res = min(res, max(a[i][0], a[j][1]));
			}
		}
	}
	cout << res << '\n';
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using pint = pair<int,int>;
using p = complex<double>;

void f(vector<p>& B) {
	int N = B.size();
	double x = 0, y = 0;
	for(auto u : B)x += u.real(), y += u.imag();
	x /= N, y /= N;

	for(auto&u : B) {
		u = {u.real() - x, u.imag() - y};
	}
	sort(B.begin(), B.end(), [&](p a, p b){return (a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real()) ;});
}

void g(vector<p>& B, double b) {
	for(auto &i : B) {
		i *= p{cos(b), sin(b)};
	}
	sort(B.begin(), B.end(), [&](p a, p b){return (a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real()) ;});
}

int main()
{
	std::random_device seed_gen;
	std::default_random_engine engine(seed_gen());
	std::uniform_real_distribution<> dist(0.0, 2 * acos(-1));

	int N; cin >> N;
	vector<p> A(N), B(N);
	for(auto &u : A) {
		double a, b; cin >> a >> b;
		u = {a, b};
	}
	for(auto &u : B) {
		double a, b; cin >> a >> b;
		u = {a, b};
	}

	f(A);
	f(B);
	const double eps = 1e-2;
	for(int i = 0; i < 100000; i++) {
		g(B, dist(engine));

		bool ok = true;
		for(int i = 0; i < N; i++) {
			auto v = A[i] - B[i];
			if(abs(v) > eps) {
				ok = false;
			}
		}

		if(ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, c, n) for(int i = c; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void print(){ cout << endl; }
template <class H, class... T> void print(H&& h, T&&... t){ cout << h << ", "; print(forward<T>(t)...); }
template <class C> void dump(C o){ rep(i, o.size()-1) cout << o[i] << ", "; cout << o.back() << endl; }

int main() {
	int v, t, s, d; cin >> v >> t >> s >> d;

	if (v * t <= d && d <= v * s)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

#include <iostream>

using namespace std;

int main() {

	int v, t, s, d;

	cin >> v >> t >> s >> d;

	if (d >= v * t && d <= v * s) {
		cout << "No";
	} else {
		cout << "Yes";
	}
	return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define DEBUG(...) 6
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template <typename T, typename... Args> void debug(string s, T x, Args... args) {for (int i=0, b=0; i<(int)s.size(); i++) if (s[i] == '(' || s[i] == '{') b++; else
if (s[i] == ')' || s[i] == '}') b--; else if (s[i] == ',' && b == 0) {cerr << s.substr(0, i) << " = " << x << " | "; debug(s.substr(s.find_first_not_of(' ', i + 1)), args...); break;}}

template<int MOD>
struct ModInt {
    long long v;
    ModInt(long long _v = 0) {v = (-MOD < _v && _v < MOD) ? _v : _v % MOD; if (v < 0) v += MOD;}
    ModInt& operator += (const ModInt &other) {v += other.v; if (v >= MOD) v -= MOD; return *this;}
    ModInt& operator -= (const ModInt &other) {v -= other.v; if (v < 0) v += MOD; return *this;}
    ModInt& operator *= (const ModInt &other) {v = v * other.v % MOD; return *this;}
    ModInt& operator /= (const ModInt &other) {return *this *= inverse(other);}
    bool operator == (const ModInt &other) const {return v == other.v;}
    bool operator != (const ModInt &other) const {return v != other.v;}
    friend ModInt operator + (ModInt a, const ModInt &b) {return a += b;}
    friend ModInt operator - (ModInt a, const ModInt &b) {return a -= b;}
    friend ModInt operator * (ModInt a, const ModInt &b) {return a *= b;}
    friend ModInt operator / (ModInt a, const ModInt &b) {return a /= b;}
    friend ModInt operator - (const ModInt &a) {return 0 - a;}
    friend ModInt power(ModInt a, long long b) {ModInt ret(1); while (b > 0) {if (b & 1) ret *= a; a *= a; b >>= 1;} return ret;}
    friend ModInt inverse(ModInt a) {return power(a, MOD - 2);}
    friend ostream& operator << (ostream &os, const ModInt &m) {return os << m.v;}
};
typedef ModInt<998244353> M;

const int MAX = 5005;

M contr[MAX], pw[MAX][MAX];

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

    int n, m;
    cin >> n >> m;

    for (int x=0; x<=m; x++) {
        pw[x][0] = 1;
        for (int i=1; i<=n; i++)
            pw[x][i] = pw[x][i-1] * x;
    }

    M ret = 0;
    for (int i=0; i<n; i++) {
        for (int x=1; x<=m; x++) {
            contr[x] *= m;
            if (i > 0) contr[x] += pw[m-1][i-1] - pw[m-x][i-1];
            ret += (pw[m-1][i] + contr[x]) * pw[m][n-i-1];
        }
    }
    cout << ret << "\n";

    return 0;
}

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

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

void setIO(string name = "") {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/*if ((int)name.size()) {
		freopen((name + ".in").c_str(), "r", stdin);
		freopen((name + ".out").c_str(), "w", stdout);
	}*/
}

typedef long long ll;
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<n;i++)
#define ps(x,y) fixed << setprecision(y) << x

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

using pi = pair<int, int>;

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

const int MAX = 200005;
const int mod = 1e9 + 7;
const ll modulo = 998244353;

void anshu_man(int tt = 0) {
	//cout << "Case #" << tt << ": ";
	int t, n;
	cin >> t >> n;

	int ans = ((100LL + t) * n) / t;
	if (((100LL + t)*n) % t == 0)
		ans--;
	cout << ans << endl;

}

int32_t main() {

	setIO();

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

	int t = 1;
	//cin >> t;

	for (int i = 1; i <= t; i++)
	{
		anshu_man(i);
	}
	return 0;
}


#include <bits/stdc++.h>

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef long int li;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin >> t; while(t--)
const long long int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
const long long int cons = 100005;
const long long int MOD = 1000000007; // const long long int MOD = 998244353;
const long long int const_INT_MAX = 1000000000000000000, const_INT_MIN = -1 * 1000000000000000000;
using namespace std;
bool sortinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.first > b.first);}
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second < b.second);}
bool sortbysecinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second > b.second);}
ll gcd(ll x, ll y){return (ll)(__gcd(x, y));}
ll lcm(ll x, ll y){return (ll)((x * y) / gcd(x, y));}
ll mod_expo(ll x, ll y, ll p){
    ll res = 1;
    if((x + p) % p == 0){
        return res = 0;
    }
    x = (x + p) % p;
    while (y > 0){
        if (y & 1) res = (res*x + p) % p;
        y = y>>1; x = (x*x + p) % p;
    }
    return res;
}
void usaco(string str = ""){
    fastio;
    if(str.size()) {
        freopen((str + ".in").c_str(), "r", stdin);
        freopen((str + ".out").c_str(), "w", stdout);
    }
}
// GFG orz (and the blessings of nishuz sir)
ll getSum(ll BITree[], ll index){
    ll sum = 0;
    while (index > 0){
        sum += BITree[index]; index -= index & (-index);
    }
    return sum;
}
void updateBIT(ll BITree[], ll n, ll index, ll val){
    while (index <= n){BITree[index] += val; index += index & (-index);}
}
void convert(ll arr[], ll n){
    ll temp[n]; for(ll i=0;i<n;i++) temp[i] = arr[i];
    sort(temp, temp+n);
    for (ll i=0;i<n;i++){
        arr[i] = lower_bound(temp, temp+n, arr[i]) - temp + 1;
    }
}
ll getInvCount(ll arr[], ll n){
    ll invcount=0, BIT[n+1];;
    convert(arr, n);
    for (ll i=1;i<=n;i++) BIT[i] = 0;
    for (ll i=n-1;i>=0;i--){
        invcount += getSum(BIT, arr[i]-1); updateBIT(BIT, n, arr[i], 1);
    }
    return invcount;
}
int main(){
    usaco();
    ll n; cin >> n; ll a[n], dp[n], temp[n];
    for(ll i=0;i<n;i++){cin >> a[i]; temp[i] = a[i];}
    dp[0] = getInvCount(temp, n);
    for(ll i=1;i<n;i++){
        dp[i] = dp[i-1] - 2 * a[i-1] + n - 1;
    }
    for(ll i=0;i<n;i++) cout << dp[i] << "\n";
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}

#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rrep(i,n) for(ll i=n-1; i>=0; i--)
#define fi first
#define se second
#define pcnt __builtin_popcountll
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
string zero_padding(int val, int nf){ ostringstream sout;sout << setfill('0') << setw(nf) << val; return sout.str();};
const ld eps = 1e-10;
ull mo = 1000000007;
ld PI=asin(1)*2;
//using namespace atcoder;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N),S(N+1);
    rep(i,N) cin >> A[i];
    rep(i,N){
        if(i%2) A[i] = -A[i];
    }
    rep(i,N){
        S[i+1] = S[i] + A[i];
    }
    map<ll,ll> mp;
    rep(i,N+1) mp[S[i]]++;
    ll ans = 0;
    for(auto& p:mp){
        ll n = p.se;
        ans += n*(n-1)/2;
    }
    cout << ans << endl;
}


//W4P3R
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register ll
#define fr first
#define sd second
#define pa pair<ll,ll>
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define MEM(a) memset(a,0,sizeof(a))
#define N 200010
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
inline ll lowbit(ll x){return x&(-x);}
int n;
vector<int>e[N];
int sz[N],f[N];
void dfs(int x)
{
	sz[x]=1;
	for(int y:e[x]){dfs(y);sz[x]+=sz[y];}
	int sum=0;vector<int>v;
	for(int y:e[x])
	{
		if(sz[y]%2==0){if(f[y]<0)f[x]+=f[y];else sum+=f[y];}
		else {v.pb(f[y]);}
	}
	sort(v.begin(),v.end());
	int op=1;
	for(int val:v){f[x]+=op*val;op=-op;}
	//cout<<"WTF:"<<x<<" "<<sum<<" "<<op<<" "<<f[x]<<" "<<(v.size()?v[0]:0)<<endl;
	f[x]+=op*sum+1;
}
int main()
{
	//ios::sync_with_stdio(false);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();
	FOR(i,2,n)
	{
		int fa=read();
		e[fa].pb(i);
	}
	dfs(1);
	//FOR(i,1,n)cout<<f[i]<<' ';cout<<'\n';
	cout<<(n+f[1])/2<<'\n';
	return 0;
}
//gl

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = b; i >= a; i--)

using namespace std;

const int N = 200111;

int n, s, t, sub[N], ans[N], e = 1;
vector<int> g[N];

pair<int, int> dfs(int v, int p) {
	pair<int, int> a = {0, v};
	for (auto u : g[v]) {
		if (u != p) {
			auto b = dfs(u, v);
			b.first++;
			a = max(a, b);
		}
	}
	return a;
}

void go(int v, int p) {
	sub[v] = (v == t);
	for (auto u : g[v])
		if (u != p) {
			go(u, v);
			sub[v] |= sub[u];
		}
}

void solve(int v, int p) {
	ans[v] = e;
	sort(g[v].begin(), g[v].end(), [&](int a, int b) {
		return sub[a] < sub[b];
	});
	for (auto u : g[v])
		if (u != p) {
			e++;
			solve(u, v);
		}
	e++;
}

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

	cin >> n;
	rep(i, 1, n - 1) {
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	s = dfs(1, 0).second;
	t = dfs(s, 0).second;

	go(s, 0);
	solve(s, 0);

	rep(i, 1, n)
		cout << ans[i] << " ";
	return 0;
}


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

int main(){
    char s,t;
  	cin>>s>>t;
  if(s=='Y')t= toupper(t);
  cout<<t<<endl;

}

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

  int main(){
  int n , s , d;
    cin >> n >> s >> d;
    rep(i,n){
    int x , y;
      cin >> x >> y;
      if(x >= s || y <= d){
      continue;
      }
      else{
      cout << "Yes";
        return 0;
      }
    }
    cout << "No";
  }


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

int main() {
	// your code goes here
	int n,m,k,x,sum=0;

	cin>>n>>k>>m;
	for(int i=0;i<n-1;i++)
	{
		cin>>x;
		sum+=x;
	}

	int target = n*m;
	if(sum>target) cout<<0<<endl;
	else if(abs(target-sum)>k) cout<<-1<<endl;
	else {
		cout<<abs(target-sum)<<endl;
	}
	return 0;
}

/*
このコード、と～おれ!
Be accepted!
∧＿∧
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
#include <array>
#include <chrono>

//#pragma GCC target("arch=skylake-avx512")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)
#define printLdb(a) printf("%.50Lf\n", a)
#define printdbd(a) printf("%.16lf\n", a)
#define prints(s) printf("%s\n", s.c_str())
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d))

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

//cpp_int
#if __has_include(<boost/multiprecision/cpp_int.hpp>)
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace boost::multiprecision;
#else
using cpp_int = ll;
#endif

//atcoder library
#if __has_include(<atcoder/all>)
#include <atcoder/all>
//using namespace atcoder;
#endif

/*
	random_device seed_gen;
	mt19937 engine(seed_gen());
	uniform_int_distribution dist(1, 100);
*/

/*----------------------------------------------------------------------------------*/

ll pow(ll a, ll n, ll m) {
	ll ret = 1;
	while (n > 0) {
		a %= m;
		ret %= m;
		if (n % 2) ret *= a;
		a *= a;
		n /= 2;
	}
	ret %= m;
	return ret;
}

int main() {

	ll a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	vector<ll> ans;
	set<ll> st;
	{
		ll num = a % 10;
		while (st.find(num) == st.end()) {
			st.insert(num);
			ans.push_back(num);
			num *= a;
			num %= 10;
		}
	}
	b = pow(b, c, ans.size());
	if (b == 0)b = ans.size() - 1;
	else --b;
	printf("%lld\n", ans[b]);

	Please AC;
}


/**
*    author:  yuya1234
*    created: 17.10.2020 20:15:10
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

vector< ll > divisor(ll n) {
  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);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

  ll n;
  cin>>n;

  vector<ll> ret;

  ret=divisor(n);

  REP(i,SZ(ret))
  {
    cout<<ret[i]<<endl;
  }

  return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
//#include <Windows.h>
#include<unordered_map>
//#include"testlib.h"
using namespace std;
//<DEFINE>
void Fast() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
}
void File() {
#ifndef ONLINE_JUDGE
   /* HWND Stealth;
    AllocConsole();
    Stealth = FindWindowA("ConsoleWindowClass", NULL);
    ShowWindow(Stealth, 0);*/
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
#endif
}
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#ifdef _WIN64
#define __builtin_popcountll __popcnt64
#else
inline int __builtin_popcountll(__int64 a) {
    return __builtin_popcount((unsigned int)a) + __builtin_popcount(a >> 32);
}
#endif
#endif
using ll = long long;
using ull = unsigned long long;
#define mod 1000000007
ll gcd(ll a, ll b) {
    return!b ? a : gcd(b, a % b);
}
#define fix(n) cout << fixed << setprecision(n);
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define skip continue
#define pi  acos(-1)
#define endl "\n"
//#define ceil(x,y) (((x)+(y)-1)/(y))
#define clr(v,d) memset(v, d, sizeof v)
//sin(x*pi/180)
//alot of memset may cause TLE
#define TC int t$$t$;cin>>t$$t$;while(t$$t$--)
//</DEFINE>
int dx[] = { 0,0,-1,1,1,1,-1,-1 };
int dy[] = { 1,-1,0,0,1,-1,1,-1 };
//***********stop when you reach the concept of don't stop***********
//<FUNCTIONS>
struct point
{
    ll x, y;
    point() {}
    point(ll x, ll y) :x(x), y(y) {}
};
double getDis(point a, point b) {
    return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
void solve() {
    ll r, x, y;
    cin >> r >> x >> y;
    fix(0);
    if (getDis(point(0, 0), point(x, y)) < r)cout << 2;
    else
        cout << ceil(getDis(point(0, 0), point(x, y)) / r);
}
//</FUNCTIONS>
int main() {
    Fast();
    File();
    solve();
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
template<class T> void chmax(T& a, T b){
    if(a < b){
        a = b;
    }
}
template<class T> void chmin(T& a, T b){
    if(a > b){
        a = b;
    }
}
int main()
{
    int n;
    cin >> n;
    int a[n],b[n];
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];

    int ans = 0;
    for(int x = 0; x <= 1000; x++){
        bool check = true;
        rep(i,n){
            if(!(a[i] <= x && x <= b[i]))check = false;

        }
        if(check)ans++;

    }

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

//#include <stdio.h>
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n+5],b[n+5];
    int min=0;
    int max=10000;
    for(int i=0; i<n; i++){
        cin>>a[i];
        if(min<a[i]) min=a[i];
    }
    //cout<<min<<"\n";
    for(int i=0; i<n; i++){
        cin>>b[i];
        if(max>b[i]) max=b[i];
    }
    //cout<<max<<"\n";
    if(min>max) cout<<'0'<<"\n";
    else cout<<(max-min)+1<<"\n";
    return 0;
}


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

int a[100][100];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int h, w;
    cin >> h >> w;

    int mn = 1e9, total = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> a[i][j];
            mn = min(mn, a[i][j]);
            total += a[i][j];
        }
    }
    cout << total - h*w*mn;
}

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ld long double
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define mp map<ll, ll>
#define um unordered_map<ll, ll>
#define st set<ll>
#define us unordered_set<ll>
#define vt vector<ll>
#define vp vector<pll>
#define pll pair<ll, ll>
#define fl(i, x, y) for(ll i=x;i<y;++i)
#define flr(i, x, y) for(ll i=x;i>=y;--i)
#define endl "\n"
#define speedup ios_base::sync_with_stdio(false), cin.tie(NULL)

void  solve()
{
    ll n,m;
    cin>>n>>m;
    ll a[n][m], mn=LONG_MAX, s=0;
    fl(i, 0, n)
    {
        fl(j, 0, m)
        {
            cin>>a[i][j];
            mn = min(mn, a[i][j]);
        }
    }
    fl(i, 0, n)
    {
        fl(j, 0, m)
        s += (abs(a[i][j]-mn));
    }
    cout<<s<<endl;
}

int main()
{
    speedup;
    #ifndef ONLINE_JUDGE
        freopen("E:\\competitive programming\\input.txt", "r", stdin);
        freopen("E:\\competitive programming\\output.txt", "w", stdout);
    #endif
    ll tt=1;
    //cin>>tt;
    while(tt--)
    {
        solve();
    }
	return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll=long long;
using db=double;

///***************************************************** CONSTANTS ******************************************************///

int const N=1e6+3;
ll MOD=1e9+7,fact[N];
const long long inf=(long long)1e18;
const long double PI=3.14159265358979;

///************************************************ CONTAINER DEFINITIONS ***********************************************///

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef set<int> si;
typedef set<ll> sl;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

///************************************************ SHORT FORM KEYWORDS *************************************************///

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define I insert
#define lb lower_bound
#define ub upper_bound
#define endl '\n'

///************************************************ SHORT FORM FUNCTIONS ************************************************///

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loopr(i,a,b) for(ll i=a-1;i>=b;i--)
#define afor(x, y) for (auto x : y)
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define stll(x) stoll(x, nullptr, 10);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define all(a) a.begin(),a.end()
#define mxa(a,N) *max_element(a,a+N)
#define mna(a,N) *min_element(a,a+N)
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}

///******************************************** FAST IO $ FILE INPUT ****************************************************///

#define io() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define fio() freopen("input_file_name","r",stdin);freopen("output_file_name","w",stdout);

///********************************************* REQUIRED FUNCTIONS *****************************************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
ll inv(ll a,ll p){return powmod(a,p-2);}
ll nCr(ll n,ll k,ll p){fact[0]=1;loop(i,1,n+1) fact[i]=fact[i-1]*i;return ((fact[n]*inv(fact[k],p)%p)*inv(fact[n-k],p))%p;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0|n%(i+2)==0)return false;}return true;}

///######################################################################################################################///

typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

///************************************************ SOLUTION STARTS HERE ************************************************///
///======================================================================================================================///

void solve()
{
    ll n;
    cin>>n;
    ll ans=n;
    for(int i=1;i<=n;i++){
        ll k=i;
        bool b=true;
        while(k){
            if(k%10==7) {ans--;b=false;break;}
            k/=10;
        }
        k=i;
        if(b){
            while(k){
                if(k%8==7){
                    ans--;b=false;break;
                }
                k/=8;
            }
        }
    }
    cout<<ans<<endl;
}

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


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

double dp[101][101][101];

double funct(int a, int b, int c){
    if(dp[a][b][c]) return dp[a][b][c];
    if(a == 100 || b == 100 || c == 100) return 0;

    double ans = 0;
    ans += (funct(a + 1, b, c) + 1)*a/(a + b + c);
    ans += (funct(a, b + 1, c) + 1)*b/(a + b + c);
    ans += (funct(a, b, c + 1) + 1)*c/(a + b + c);
    dp[a][b][c] = ans;
    return ans;
}

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

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

    printf("%.9lf\n", funct(a, b, c));

    return 0;
}

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

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

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}

//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
ll const mod = 1e9+7;

// combination
const int MAX = 510000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// べき乗
ll modpow(ll x, ll n) {
    x = x%MOD;
    if(n==0) return 1;  //再帰の終了条件

    else if(n%2==1) {
        return (x*modpow(x, n-1))%MOD;  //nが奇数ならnを1ずらす
    }
    else return modpow((x*x)%MOD, n/2)%MOD;  //nが偶数ならnが半分になる
}

////
//Union Find
struct UnionFind {
  vector<int> par; // 親ノード
  vector<int> rank; // ランク

  UnionFind(int n = 1) {
    init(n);
  }
  void init(int n = 1) {
    par.resize(n); rank.resize(n);
    for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
  }
  int root(int x) {
    if (par[x] == x) {
    return x;
  }
    else {
      int r = root(par[x]);
      return par[x] = r;
    }
  }
  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y);
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    return true;
  }
};

//BIT
template <class Abel> struct BIT {
    vector<Abel> dat;
    Abel UNITY_SUM = 0;                     // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) {
        dat.resize(n + 1);
        for (int i = 0; i < (int)dat.size(); ++i) dat[i] = UNITY_SUM;
    }

    /* a is 1-indexed */
    inline void add(int a, Abel x) {
        for (int i = a; i < (int)dat.size(); i += i & -i)
            dat[i] = dat[i] + x;
    }

    /* [1, a], a is 1-indexed */
    inline Abel sum(int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }

    /* [a, b), a and b are 1-indexed */
    inline Abel sum(int a, int b) {
        return sum(b - 1) - sum(a - 1);
    }

    /* k-th number (k is 0-indexed) */
    int get(int k) {
        ++k;
        int res = 0;
        int N = 1; while (N < (int)dat.size()) N *= 2;
        for (int i = N / 2; i > 0; i /= 2) {
            if (res + i < (int)dat.size() && dat[res + i] < k) {
                k = k - dat[res + i];
                res = res + i;
            }
        }
        return res + 1;
    }
};

int main() {
  int N;
  cin >> N;
  int ans = 1e9+1;
  int a,p,x;
  rep(i,N) {
    cin >> a >> p >> x;
    if (x-a>0) chmin(ans,p);
  }
  if (ans>1e9) ans = -1;
  cout << ans << endl;
}