/*
このコード、と～おれ!
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>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("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()) //string出力
#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)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

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

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

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {

	string s;
	scans(s);
	int sum = 0, one = 0, two = 0;
	for (const auto& aa : s) {
		sum += aa - '0';
		if ((aa - '0') % 3 == 1)++one;
		else if ((aa - '0') % 3 == 2)++two;
	}
	sum %= 3;
	if (sum == 0)puts("0");
	else if (sum == 1) {
		if (one and s.length() > 1)puts("1");
		else if (two > 1 and s.length() > 2)puts("2");
		else puts("-1");
	}
	else {
		if (two and s.length() > 1)puts("1");
		else if (one > 1 and s.length() > 2)puts("2");
		else puts("-1");
	}

	Please AC;
}

/*input
11

*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define fr first
#define sc second
#define eps 1e-9
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define sni(x) scanf("%d",&x)
#define snl(x) scanf("%lld", &x)
#define snc(x) scanf("%c", &c);
#define rep(n) for(int i = 0 ; i < n ;i ++)
#define repc(i, n) for(int i = 0 ; i < n ; i ++)
#define FOR(i, x, y) for(int i = x ; i < y ; i ++)
#define DEC(i, x, y) for(int i = x ; i >= y ; i --)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b,c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a+n
using namespace std;

typedef long long ll;
const ll INF = 1e18;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
string s;
ll go(ll i, ll sum)
{
    if (i == s.length())
    {
        if (sum % 3 == 0 and sum != 0)
            return 0;
        else
            return INT_MIN;
    }
    ll res = INT_MIN;
    res = max(go(i + 1, sum + (s[i] - '0')) + 1, go(i + 1, sum));
    return res;

}
int main()
{

    cin >> s;
    ll res = 0;
    FOR(i, 0, s.length())
    res += s[i] - '0';
    if (res % 3 == 0)
    {
        cout << 0;
        return 0;
    }
    ll ans = go(0, 0);
    if (ans < 0)
        cout << -1;
    else
        cout << ((ll)s.length() - ans);

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cout << "(" << #x << ": " << x << ")" << endl;

void solve() {
    int x,y;
    cin >> x >> y;
    bool flag=0;
    if(x<y) {
        if(x+3>y)
            flag=1;
    }
    else {
        if(y+3>x)
            flag=1;
    }

    cout << (flag==1? "Yes\n":"No\n");
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    while (t--)
    {
        solve();
    }
}

#include <bits/stdc++.h>
#define loop(n) for(ll i=0;i<n;i++)
#define loopj(n) for(ll j=0;j<n;j++)
#define loopR(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define rng(i,a,b,c) for(ll i = a; i<b;i+=c)
#define loop2(i,a,b) for(long long i = a; i>=b;i--)
#define loop3(j,a,b) for(int j = a; j<b;j++)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long
#define ld long double
#define SET set<ll>
#define pb push_back
#define mp make_pair
#define gc getchar_unlocked
#define in ll n;cin>>n;
#define all(s) s.begin(),s.end()

ll mod=pow(10,9)+7;
using namespace std;
//--------------------------\\
//code once think twice

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

	return gcd(b,a%b);
}

void go()
{
	ll a,b;
	cin>>a>>b;
	if(min(a,b)+3>max(a,b))
	cout<<"Yes";
	else
	cout<<"No";

}

int main()
{

int t;

fast;
//cin>>t;
//
//loop(t)
go();
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define FOR(i, a, b) for (ll i=a; i<(b); i++)
#define FORD(i, a, b) for (int i=a-1; i>=(b); i--)

void solve () {
    ll ans = 0;
    ll n;
    cin >> n;
    vector<ll> a(n);
    FOR(i, 0, n) cin >> a[i];
    FOR(i, 0, n) {
        ll tmp;
        cin >> tmp;
        a[i] *= tmp;
        ans += a[i];
    }
    if(ans==0)
    cout << "Yes\n";
    else
    cout << "No\n";
}

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

    return 0;
}
//$ sudo g++ -o name name.cpp
//$ ./name

#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define vvi vector<vector<int>>
#define Pii pair<int,int>
#define SS second
#define F first
const int mod = 998244353;
#define ld long double
#define sp fixed<<setprecision(9)
const int inf =1e18+7;
using namespace std;

#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

// int a[1000000],fenw[1000000];

// int query(int k){

//     int s=0;
//     while(k>=1){
//         s+=fenw[k];
//         k-=(k&-k);
//     }
//     return s;
// }

// void update(int k,int x,int n){

//     while(k<=n){
//         fenw[k]+=x;
//         k+=(k&-k);
//     }
// }

int powmod(int x, int n, int md){
    int ans=1;
    while(n){
        if(n&1)
            ans=(ans*x)%md;
        n/=2;
        x=(x*x)%md;
    }
    return ans;
}

int merge(int arr[],int temp[],int left,int mid,int right){
    int i,j,k;
    int inv_count=0;
    i=left,j=mid,k=left;
    while(i<mid and j<=right){
        if(arr[i]<=arr[j]){
            temp[k++]=arr[i++];
        }else{
            temp[k++]=arr[j++];
            inv_count+=mid-i;
        }
    }
    while(i<mid){
        temp[k++]=arr[i++];
    }
    while(j<=right){
        temp[k++]=arr[j++];
    }
    for(i=left;i<=right;i++){
        arr[i]=temp[i];
    }
    return inv_count;
}

int merge_sort(int arr[],int temp[],int left,int right){
    int mid,inv_count=0;
    if(right>left){

        mid=(left+right)/2;

        inv_count+=merge_sort(arr,temp,left,mid);
        inv_count+=merge_sort(arr,temp,mid+1,right);

        inv_count+=merge(arr,temp,left,mid+1,right);
    }
    return inv_count;
}

void solve(int test){

    int n;
    cin>>n;
    int a[n];
    int b[n];
    vector<vector<int>> v1,v2;
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]+=i;
        v1.pb({a[i],i});
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
        b[i]+=i;
        v2.pb({b[i],i});
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    int v[n],temp[n];
    for(int i=0;i<n;i++){
        if(v1[i][0]!=v2[i][0]){
            cout<<-1;
            return;
        }
        v[v1[i][1]]=v2[i][1];
    }
    cout<<merge_sort(v,temp,0,n-1);

}

int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    //precompute();
    int t=1;
    //cin>>t;
    int test=1;
    while(t--){
        solve(test);
        test++;
    }

    return 0;

}//Ardhendu Reja , JGEC


#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define pii pair<int,int>
using namespace std;

const int mn=3006;
int n,a[mn];

int main()
{
    scanf("%d",&n);
    a[1]=6,a[2]=10,a[3]=15;a[0]=3;
    for(int i=1;i<=10000;++i) {
        if(i==6||i==10||i==15) continue;
        if(i%6==0||i%10==0||i%15==0) a[++a[0]]=i;
    }
    for(int i=1;i<=n;++i) cout<<a[i]<<" ";
}

#include <bits/stdc++.h>
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define REPS(i, ss, nn ) for(int i = ss ; i < (int) nn; i++)
#define REV(i, ss, nn ) for(int i = ss ; i >= nn; i--)
#define deb(x) std::cout << #x << " " << x << endl;
#define debl(x) std::cout << #x << " " << x << " ";
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
namespace std{
    template<class Fun>
    class y_combinator_result{
        Fun fun_;
        public:
            template<class T>
            explicit y_combinator_result(T &&fun) : fun_(std::forward<T>(fun)){}
            template<class ...Args>
            decltype(auto) operator()(Args&&...args){
                return fun_(std::ref(*this), std::forward<Args>(args)...);
            }
    };
    template<class Fun>
    decltype(auto) y_combinator(Fun && fun){
        return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
    }
};
template<typename T>
bool umax(T& a, T b){
    bool ret = a < b;
    if(ret) a = b;
    return ret;
}
template<typename T>
bool umin(T& a, T b){
    bool ret = a > b;
    if(ret) a = b;
    return ret;
}
struct edge{
    int to; ll cost;
    int from;
    edge(){ edge(0,0);}
    edge(int to_, ll cost_) : to(to_), cost(cost_){}
    edge(int to_, int from_, ll cost_) : to(to_), cost(cost_), from(from_){}
};

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}

template<typename... T>
void write(T... a){
    ((cout << a),...);
}

template<typename T>
vector<T> read_array(int sz){
    vector<T> ret(sz);
    for(auto & x : ret) cin >> x;
    return ret;
}

void solve(){
    int n;
    read(n);
    int mxN = 10000;
    vector<int> v;
    for(int k = 1; k <= mxN; k++){
        int c = 0;
        if ( k % 2 == 0) c++;
        if( k % 3 == 0) c++;
        if (k % 5 == 0) c++;
        if(c >= 2) v.push_back(k);
    }
    if(n == 3){
        vector<int> ans = {6, 10, 15};
        for(int i = 0 ; i < n ; i++) write(ans[i], " ");
        return;
    }
    // deb(v.size());
    for(int i = 0 ; i < n ; i++) write(v[i], " ");
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    int T = 1;
    // cin >> T;
    while(T--)
        solve();
    return 0;
}


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

bool mysolve(int arr[4]){
   int sum = 0;
   for(int i = 0 ; i< 4 ; i++){
      sum+=arr[i];
   }
   int flag = 0;
   for(int i = 0 ;  i< 4; i++){
      if(arr[i]==(sum-arr[i]))
      {flag=1;break;}
   }
   for(int i = 0 ;  i< 4; i++){
      for(int j = i + 1 ; j <4 ; j++){
      if((arr[i]+arr[j])==(sum-arr[i]-arr[j]))
      {flag=1;break;}}
   }
   for(int i = 0 ;  i< 4; i++){
      for(int j = i + 1 ; j <4 ; j++){
         for(int k = j +1 ; k < 4; k++){
      if((arr[i]+arr[j]+arr[k])==(sum-arr[i]-arr[j]-arr[k]))
      {flag=1;break;}}}
   }
   if(flag){
      return true;
   }
   else return false;
}

bool editoral(int arr[4]){
   if((arr[0]+arr[3] == arr[2]+arr[1])||(arr[0]+arr[1]+arr[2]==arr[3]))
      return true;
   else return false;
}

int main()
{
   int arr[4];
   cin>>arr[0]>>arr[1]>>arr[2]>>arr[3];
   sort(arr,arr+4);
   //bool answer = mysolve(arr);
   bool answer = editoral(arr);
   answer?cout<<"Yes"<<endl:cout<<"No"<<endl;
   return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a==b+c+d)return puts("Yes"),0;
	if(b==a+c+d)return puts("Yes"),0;
	if(c==b+a+d)return puts("Yes"),0;
	if(d==b+c+a)return puts("Yes"),0;
	if(b+a==c+d)return puts("Yes"),0;
	if(a+c==b+d)return puts("Yes"),0;
	if(b+c==a+d)return puts("Yes"),0;
	puts("No");
	return 0;
}


// https://atcoder.jp/contests/abc191/tasks/abc191_e
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using str = string;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

struct Graph {
    struct Edge {
        int from, to, cost;
    };
    int n;
    int INF;
    vector<vector<Edge>> adj_list;
    Graph(int _n) {
        n = _n;
        INF = 1e9;
        adj_list.resize(n, vector<Edge>(0));
    }
    void add(int from, int to, int cost) {
        adj_list[from].push_back({from, to, cost});
    }
    int dijkstra(int start) {
        int ans = INF;
        vector<int> dist(n, INF);
        dist[start] = 0;
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
        pq.push({dist[start], start});
        while (not pq.empty()) {
            int cur = pq.top().second;
            pq.pop();
            for (Edge e : adj_list[cur]) {
                if (dist[e.to] > dist[cur] + e.cost) {
                    dist[e.to] = dist[cur] + e.cost;
                    pq.push({dist[e.to], e.to});
                }
                if (e.to == start) {
                    ans = min(ans, dist[cur] + e.cost);
                }
            }
        }
        return ans == INF ? -1 : ans;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    Graph g(n);
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        g.add(a, b, c);
    }
    rep(i, n) {
        cout << g.dijkstra(i) << endl;
    }
}

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

using std::cin;
using std::cout;
using std::vector;

const int N = 200005;

vector<int> to[N];
int dep[N];
int in[N];
int out[N];
int k;
vector<int> ls[N];

void dfs(int v, int d) {
	in[v] = k++;
	dep[v] = d;
	for (int u : to[v]) dfs(u, d + 1);
	out[v] = k;
}

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

	rep(i, n - 1) {
		int p;
		cin >> p;
		to[p - 1].push_back(i + 1);
	}

	dfs(0, 0);

	rep(i, n) ls[dep[i]].push_back(in[i]);
	rep(i, n) sort(ls[i].begin(), ls[i].end());

	int q;
	cin >> q;

	auto f = [&](int d, int r) {
		return lower_bound(ls[d].begin(), ls[d].end(), r) - ls[d].begin();
	};

	rep(qi, q) {
		int u, d;
		cin >> u >> d;
		--u;
		int ans = f(d, out[u]) - f(d, in[u]);
		cout << ans << '\n';
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {

	long long n, a, b, x, mn = 10000000000, pre = 0, d = 0;
	cin>>n;
	while(n--){
		cin>>a>>b>>x;
		d = d + a - pre;
		x = x - d;
		if(x > 0) mn = min(mn, b);
		pre = a;
	}
	if(mn == 10000000000) cout<<-1<<endl;
	else cout<<mn<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define LOCAL
#endif
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
const long infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
#define endl        '\n'
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
//#define hell        998244353
#define peak        9e18
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

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

namespace Ops{
template<class y,class z> ll expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class y> ll power(ll b,y e){ll a=1;while(e!=0){if((e&1)==1){a=a*b;}b=b*b;e>>=1;}return a;}
template<class x,class z> ll inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y> x min(x a,y b){x c;if(a<=b)c=a;else c=b;return c;}
template<class x,class y> x max(x a,y b){x c;if(a>=b)c=a;else c=b;return c;}
ll mul(ll x,ll y,ll m){x%=m;y%=m;if(x==0)return 0;if(x%2==0)return (mul(x/2,y,m)*2)%m;return ((mul(x/2,y,m)*2)%m+y)%m;}
}
using namespace Ops;

namespace InOp{
template<class x>istream &operator>>(istream &in,vector<x> &v) {for(auto& i:v)in>>i;return in;}
template<class x,class y> ostream &operator<<(ostream &out,pair<x,y> &p) {out<<"("<<p.F<<","<<p.S<<")";return out;}
template<class x> ostream &operator<<(ostream &out,vector<x> &v) {out<<"Size : "<<v.size()<<endl;for(auto i:v)out<<i<<" ";out<<endl;return out;}
}
using namespace InOp;

namespace Debug{
#ifdef LOCAL
#define deb(...) printall(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void printall(const char* name, Arg1&& arg1){cerr<<name<<" : "<<arg1<<endl;}
template <typename Arg1, typename... Args>
void printall(const char* names,Arg1&& arg1,Args&&... args){const char* comma=strchr(names,',');cerr.write(names,comma-names)<<" : " <<arg1<<" | ";printall(comma+1,args...);}
#else
#define deb(...) void(0)
#endif
}
using namespace Debug;

namespace Bits{
template<class x> constexpr int onbits(x a){return __builtin_popcount(a);}
constexpr int bits(long long x){return 64-__builtin_clzll(x);}//take care of 0
constexpr int bits(int x){return 32-__builtin_clz(x);}//take care of 0
constexpr int traz(int a){return __builtin_ctz(a);}
constexpr int traz(long long a){return __builtin_ctzll(a);}
}
using namespace Bits;

namespace YesNo{
//#define CAPITAL
void yes(){
    #ifdef CAPITAL
    cout<<"YES"<<"\n";
    #else
    cout<<"Yes"<<"\n";
    #endif
}
void no(){
    #ifdef CAPITAL
    cout<<"NO"<<"\n";
    #else
    cout<<"No"<<"\n";
    #endif
}
}
using namespace YesNo;

void maester();
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(6);
    cerr<<fixed<<setprecision(6);
    ll test=1;
    //cin>>test;
    for(ll tt=1;tt<=test;tt++)
    {
        //cout<<"Case #"<<tt<<": ";
    	maester();
    }
    #ifdef LOCAL
    cerr<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}
#define N  1000005

void maester()
{
    ll i,j,k,l,r,m,n,x,y;
    cin>>n;
    vi v(n);
    cin>>v;
    map<ll,ll> ma;
    ll ans=0;
    for(i=0;i<n;i++)
    {
    	ans+=ma[v[i]%200];
    	ma[v[i]%200]++;
    }
    cout<<ans<<endl;
}

// Write CPP code here
#include <bits/stdc++.h>
using namespace std;

// function to Count pairs in an array whose
// absolute difference is divisible by k
void countPair(long int arr[], long int n, long int k)
{

	// long intialize the count
	long int cnt = 0;

	// making every element of arr in
	// range 0 to k - 1
	for (long int i = 0; i < n; i++) {
		arr[i] = (arr[i]) % k;
	}

	// create an array hash[]
	long int hash[k] = { 0 };

	// store to count of element of arr
	// in hash[]
	for (long int i = 0; i < n; i++) {
		hash[arr[i]]++;
	}

	// count the pair whose absolute
	// difference is divisible by k
	for (long int i = 0; i < k; i++) {
		cnt += (hash[i] * (hash[i] - 1)) / 2;
	}

	// prlong int the value of count
	cout << cnt << endl;
}

// Driver Code
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long int n;
	long int arr[1000000];
	cin >> n;
	for (long int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	long int k = 200;

	// calculate the size of array
	//long int n = sizeof(arr) / sizeof(arr[0]);
	countPair(arr, n, k);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, M = 1e3 + 5;
#define int long long
#define double long double
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
char s[1111];
void solve() {
    cin>>s+1;
    for(int i=1;i<=strlen(s+1);i++){
        if(i&1) {
            if(s[i]>='A'&&s[i]<='Z') {
                cout<<"No"<<endl;
                return;
            }
        }
        else{
            if(s[i]>='a'&&s[i]<='z') {
                cout<<"No"<<endl;
                return;
            }
        }
    }
    cout<<"Yes"<<endl;
}
signed main() {
    fio;
    solve();

    return 0;
}

#include<bits/stdc++.h>
#define inf 1e18
#define endl "\n"
#define loop(i,x,y) for(int i = x; i < y ; i++ )
#define in(n)       int n; cin>>n;
#define inarr(arr,n) int arr[n]; for(int i = 0; i < n ; i++){cin>>arr[i];}
#define maploop(x) for(auto itr = x.begin(); itr != x.end();itr++)
#define int long long
using namespace std;
const int N = 10001;
int mod = 1000000007;

void Main()
{
	string s;
	cin >> s;
	loop(i, 0, s.size())
	{
		if (i % 2 == 1)
		{
			if (s[i] >= 'A' && s[i] <= 'Z')
			{
				continue;
			}
			else
			{
				cout << "No" << endl;
				return;
			}
		}
		else
		{
			if (s[i] >= 'a' && s[i] <= 'z')
			{
				continue;
			}
			else
			{
				cout << "No" << endl;
				return;
			}
		}

	}
	cout << "Yes" << endl;

}

int32_t main()
{
	srand(time(0));
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;
	//cin >> t;
	while (t--)
	{
		Main();
	}
}


//~ author      : Sumit Prajapati
#include <bits/stdc++.h>
using namespace std;

#define ull                 unsigned long long
#define ll                  long long
#define int                 long long
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pb                  push_back
#define mk                  make_pair
#define ff                  first
#define ss                  second
#define all(a)              a.begin(),a.end()
#define trav(x,v)           for(auto &x:v)
#define rep(i,n)            for(int i=0;i<n;i++)
#define repe(i,n)           for(int i=1;i<=n;i++)
#define read(a,n)           rep(i,n)cin>>a[i]
#define reade(a,n)          repe(i,n)cin>>a[i]
#define FOR(i,a,b)          for(int i=a;i<=b;i++)
#define printar(a,s,e)      FOR(i,s,e)cout<<a[i]<<" ";cout<<'\n'
#define curtime             chrono::high_resolution_clock::now()
#define timedif(start,end)  chrono::duration_cast<chrono::nanoseconds>(end - start).count()

auto time0 = curtime;
const int MD=1e9+7;
const int MDL=998244353;
const int INF=1e9;
const int MX=1e5+5;

void solve(){

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    rep(k,MX){
        int cyan=a+k*b;
        int red=d*k*c;
        if(cyan<=red){
            cout<<k<<"\n";
            return;
        }

    }
    cout<<"-1\n";

}

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

    time0 = curtime;
    srand(time(NULL));
    int t=1;
    // cin>>t;
    repe(tt,t){
        // cout<<"Case #"<<tt<<": ";
        solve();
    }

    // cerr<<"Execution Time: "<<timedif(time0,curtime)*1e-9<<" sec\n";
    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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a)
#define dumparr(a,n)
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

ll solve(long long X, long long Y){
  static map<ll,ll> cache;
  if(cache.count(Y)){
    return cache[Y];
  }
  if(X>=Y){
    return X-Y;
  }
  ll ret=abs(X-Y);
  if(Y%2){
    chmin(ret,solve(X,(Y+1)/2)+2);
    chmin(ret,solve(X,(Y-1)/2)+2);
  }else{
    chmin(ret,solve(X,Y/2)+1);
  }
  return cache[Y]=ret;
}

int main(){
  cout<<setprecision(1000);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    cout<<solve(X, Y)<<endl;;
    return 0;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<vector<int>> g(n);
  rep(i,n-1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int l = -1, r = n, m;
  vector<int> dp(n), yet(n), done(n);
  auto dfs = [&](auto&& self, int u, int p) -> void {
    dp[u] = 0; yet[u] = 0; done[u] = INF;
    for(auto x : g[u]) {
      if(x == p) continue;
      self(self,x,u);
      dp[u] += dp[x];
      done[u] = min(done[u],done[x]+1);
    }
    if(done[u] <= m) yet[u] = -1;
    for(auto x : g[u]) {
      if(x == p) continue;
      if(yet[x]+1+done[u] > m) yet[u] = max(yet[u],yet[x]+1);
    }
    if(yet[u] == m) {
      dp[u]++; done[u] = 0; yet[u] = -1;
    }
  };
  while(r - l > 1) {
    m = (l + r) / 2;
    dfs(dfs,0,-1);
    if(yet[0] != -1) dp[0]++;
    (dp[0] <= k ? r : l) = m;
  }
  cout << r << endl;
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

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

template<class T> T T_INF(){ return 1000000000000000000; }
template<> int T_INF<int>(){ return 1000000000; }

struct Tree{
	int n;
	vector<vector<pair<int,int>>> G;
	Tree(int n_){ init(n_); }
	Tree(){}
	void init(int n_){
		n=n_;
		G=vector<vector<pair<int,int>>>(n);
	}
	void add_edge(int u,int v,int i=0){
		G[u].push_back(mp(v,i));
	}
};

struct rooted_tree{
	Tree* Tr;
	int root;
	vector<pair<int,int>> par;
	vector<int> dep;
	vector<int> vs; //pre-orderにvertexを並べたもの
	vector<int> pre_order; //頂点iがpre-orderで何番目か
	rooted_tree(Tree* Tr_,int r=0):Tr(Tr_),root(r),par(Tr->n),dep(Tr->n),vs(Tr->n),pre_order(Tr->n,-1){ dfs(mp(r,-1),-1,0,0); }
	rooted_tree(){}
	int dfs(pair<int,int> e, int p,int d,int k){
		if(pre_order[e.fr]!=-1)return k;
		par[e.fr]=mp(p,e.sc);
		dep[e.fr]=d;
		vs[k]=e.fr;
		pre_order[e.fr]=k++;
		for(auto ed: Tr->G[e.fr])k=dfs(ed,e.fr,d+1,k);
		return k;
	}
};

template<class T> vector<T> dist_on_tree(const Tree &Tr, int s){
	vector<T> dist(Tr.n,-1);
	queue<int> que;
	dist[s]=0;
	que.push(s);
	while(!que.empty()){
		int v=que.front(); que.pop();
		for(auto ed: Tr.G[v]){
			if(dist[ed.fr]!=-1)continue;
			dist[ed.fr]=dist[v]+1;
			que.push(ed.fr);
		}
	}
	return dist;
}

int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	Tree Tr(n);
	for(int i=0;i<n-1;i++){
		int u,v;
		scanf("%d%d",&u,&v); u--; v--;
		Tr.add_edge(u,v);
		Tr.add_edge(v,u);
	}
	rooted_tree rt(&Tr);

	vector<pair<int,int>> vs;
	for(int i=0;i<Tr.n;i++)vs.push_back(mp(rt.dep[i],i));
	sort(vs.begin(),vs.end(),greater<pair<int,int>>());

	int l=0,r=n-1;
	while(l<r){
		int m=(l+r)/2;
		bool ok=false;
		if(m<=800){
			static int d[200010];
			fill(d,d+n,-1);
			int cnt=0;
			for(auto p: vs){
				int v=p.sc;
				bool used=false;
				pair<int,int> loc(v,0);
				do{
					if(d[loc.fr]>=loc.sc){
						used=true;
						break;
					}
					loc.fr=rt.par[loc.fr].fr;
					loc.sc++;
				}while(loc.fr!=-1&&loc.sc<=m);
				if(!used){
					for(int i=0;i<m&&v!=-1;i++)v=rt.par[v].fr;
					if(v==-1)v=0;
					cnt++; if(cnt>k)break;
					loc=mp(v,0);
					do{
						d[loc.fr]=m-loc.sc;
						loc.fr=rt.par[loc.fr].fr;
						loc.sc++;
					}while(loc.fr!=-1&&loc.sc<=m);
				}
			}
			ok=cnt<=k;
		}
		else {
			static bool used[200010];
			fill(used,used+n,false);
			int cnt=0;
			for(auto p: vs){
				int v=p.sc;
				if(!used[v]){
					for(int i=0;i<m&&v!=-1;i++)v=rt.par[v].fr;
					if(v==-1)v=0;
					cnt++; if(cnt>k)break;
					auto d=dist_on_tree<int>(Tr,v);
					for(int i=0;i<n;i++)if(d[i]<=m)used[i]=true;
				}
			}
			ok=cnt<=k;
		}
		if(ok)r=m;
		else l=m+1;
	}
	cout<<l<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define eb emplace_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>
#define N 100100
#define MOD 1000000007 //998244353
#define pii pair<int,int>
#define pll pair<ll,ll>

int main() {
	ll n;
	vector<ll>a;
	vector<ll>b;
	ll x, y, z;
	ll l[N];
	ll r[N];
	bool v;
	ll s, ans;
	cin >> n >> x;
	a.pb(0);
	rep(i, n) {
		cin >> y;
		a.pb(y);
	}
	a.pb(x + 1);
	b.pb(0);
	rep(i, n) {
		cin >> y;
		b.pb(y);
	}
	b.pb(x + 1);
	x = 0;
	n += 2;
	rep(i, n) {
		l[i] = -1;
		r[i] = -1;
	}
	rep(i, n) {
		while (true) {
			if (x >= i) {
				if (a[x] + (i - x) < b[i])x++;
				else break;
			}
			else {
				if (a[x + 1] + (i - x - 1) > b[i])break;
				else x++;
			}
		}
		if (a[x] + (i - x) != b[i]) {
			cout << -1 << endl;
			return 0;
		}
		if (l[x] == -1)l[x] = i;
		r[x] = i;
	}
	ans = 0;
	rep(i,n) {
		if (l[i] >= 0) {
			if (l[i] < i) {
				ans += (i - l[i]);
			}
			if (r[i] > i) {
				ans += (r[i] - i);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();

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

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }
        template <typename T>
        void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++)
                std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T>
        void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++)
                    std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N, L;
    cin >> N >> L;
    Vl A(N + 2), B(N + 2);
    for (ll i = 1; i <= N; i++) {
        cin >> A[i];
        A[i] -= i;
    }
    for (ll i = 1; i <= N; i++) {
        cin >> B[i];
        B[i] -= i;
    }
    A[N + 1] = B[N + 1] = (L + 1) - (N + 1);

    Vl pos = B;
    pos.erase(unique(pos.begin(), pos.end()), pos.end());

    ll ans = 0;
    for (auto p : pos) {
        int idxl_a = lower_bound(A.begin(), A.end(), p) - A.begin();
        int idxr_a = upper_bound(A.begin(), A.end(), p) - A.begin();
        int idxl_b = lower_bound(B.begin(), B.end(), p) - B.begin();
        int idxr_b = upper_bound(B.begin(), B.end(), p) - B.begin();
        if (idxr_a - idxl_a == 0) {
            prints()(-1);
            return;
        }
        ans += max(idxr_b - idxr_a, 0) + max(idxl_a - idxl_b, 0);
    }

    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    std::ifstream ifs("./in_out/input.txt");
    std::cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    std::ofstream ofs("./in_out/output.txt");
    std::cout.rdbuf(ofs.rdbuf());
#endif
    std::cout << std::setprecision(18) << std::fixed;
    solve();
    std::cout << std::flush;
    return 0;
}


/*
    author:  Maksim1744
    created: 10.04.2021 15:15:03
*/

#include "bits/stdc++.h"

using namespace std;

#define ll   long long
#define ld   long double

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

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             vector<T>& operator--            (vector<T>& v){for (auto& i : v) --i;            return  v;}
template<typename T>             vector<T>& operator++            (vector<T>& v){for (auto& i : v) ++i;            return  v;}
template<typename T>             istream& operator>>(istream& is,  vector<T>& v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>& v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> pair<T,U>& operator--           (pair<T, U> &p){--p.first; --p.second;            return  p;}
template<typename T, typename U> pair<T,U>& operator++           (pair<T, U> &p){++p.first; ++p.second;            return  p;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}

#ifdef HOME
#define SHOW_COLORS
#include "C:/C++ libs/print.cpp"
#else
#define show(...)     42
#define mclock        42
#define shows         42
#define debug if (false)
#endif

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

    int n;
    cin >> n;
    vector<int> v(n * 2);
    cin >> v;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        a[i] = v[n - 1 - i];
        b[i] = v[n + i];
    }
    set<pair<int, int>> cur;
    ll ans = 0;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    for (int i = 0; i < n; ++i) {
        cur.emplace(a[i], i);
        cur.emplace(b[i], i + n);
        ans += cur.rbegin()->first;
        cur.erase(--cur.end());
    }
    cout << ans << '\n';

    return 0;
}

#line 1 "main.cpp"

/**
 * @title Template
 */

#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <cassert>

#line 2 "/Users/kodamankod/Desktop/cpp_programming/Library/other/chmin_chmax.cpp"

template <class T, class U>
constexpr bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { lhs = rhs; return true; }
  return false;
}

template <class T, class U>
constexpr bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { lhs = rhs; return true; }
  return false;
}

/**
 * @title Chmin/Chmax
 */
#line 2 "/Users/kodamankod/Desktop/cpp_programming/Library/other/range.cpp"

#line 4 "/Users/kodamankod/Desktop/cpp_programming/Library/other/range.cpp"

class range {
public:
  class iterator {
  private:
    int64_t M_position;

  public:
    constexpr iterator(int64_t position) noexcept: M_position(position) { }
    constexpr void operator ++ () noexcept { ++M_position; }
    constexpr bool operator != (iterator other) const noexcept { return M_position != other.M_position; }
    constexpr int64_t operator * () const noexcept { return M_position; }
  };

  class reverse_iterator {
  private:
    int64_t M_position;

  public:
    constexpr reverse_iterator(int64_t position) noexcept: M_position(position) { }
    constexpr void operator ++ () noexcept { --M_position; }
    constexpr bool operator != (reverse_iterator other) const noexcept { return M_position != other.M_position; }
    constexpr int64_t operator * () const noexcept { return M_position; }
  };

private:
  const iterator M_first, M_last;

public:
  constexpr range(int64_t first, int64_t last) noexcept: M_first(first), M_last(std::max(first, last)) { }
  constexpr iterator begin() const noexcept { return M_first; }
  constexpr iterator end() const noexcept { return M_last; }
  constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(*M_last - 1); }
  constexpr reverse_iterator rend() const noexcept { return reverse_iterator(*M_first - 1); }
};

/**
 * @title Range
 */
#line 16 "main.cpp"

using i32 = std::int32_t;
using i64 = std::int64_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

int main() {
  isize N, M;
  std::cin >> N >> M;
  if (M < 0) {
    std::cout << "-1\n";
    return 0;
  }
  if (N == 1) {
    if (M == 0) {
      std::cout << "1 2\n";
    }
    else {
      std::cout << "-1\n";
    }
    return 0;
  }
  if (M >= N - 1) {
    std::cout << "-1\n";
    return 0;
  }
  std::vector<std::pair<i32, i32>> ans;
  ans.emplace_back(1, 1000000);
  for (auto i: range(0, M + 1)) {
    ans.emplace_back(2 * i + 2, 2 * i + 3);
  }
  for (auto i: range(0, N - M - 2)) {
    ans.emplace_back(1000000 + 2 * i + 1, 1000000 + 2 * i + 2);
  }
  for (auto [x, y]: ans) {
    std::cout << x << ' ' << y << '\n';
  }
  return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
#include <cstdio>
#include <cmath>
#include <climits>
#include <fstream>
using namespace std;

const long long INF = LLONG_MAX;
const long long MOD = 1000000007;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

ostream& operator<<(ostream& os, vector<vector<char>> v)
{
    for (int y = 0; y < v.size(); y++)
    {
        for (int x = 0; x < v[y].size(); x++)
        {
            os << v[y][x];
        }
        os << endl;
    }

    return os;
}

class UnionFind
{
private:
    vector<int> parent;
public:
    UnionFind(int N)
    {
        parent.resize(N);
        for (int i = 0; i < N; ++i)
        {
            parent[i] = i;
        }
    }

    int root(int x)
    {
        if (parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

long long comb2(long long n)
{
    return n * (n-1) / 2;
}

int main(void)
{
    int n;
    cin >> n;
    vector<pll> a(n);
    vector<long long> sum(n+1, 0);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i].first;
        a[i].first %= 200;
        a[i].second = i + 1;
    }
    sort(a.begin(), a.end());

    for (int i = 0; i < n; ++i)
    {
        sum[i+1] = sum[i] + a[i].first;
    }

    vector<vector<pii>> v(200);
    for (int left = 0; left < n; ++left)
    {
        for (int right = left + 1; right <= n; ++right)
        {
            long long s = sum[right] - sum[left];
            long long mod = s % 200;
            v[mod].emplace_back(left, right);
        }
    }

    for (int mod = 0; mod < 200; ++mod)
    {
        if (v[mod].size() > 1)
        {
            cout << "Yes" << endl;
            for (int i = 0; i < 2; ++i)
            {
                cout << v[mod][i].second - v[mod][i].first;

                vector<int> index;
                for (int j = v[mod][i].first; j < v[mod][i].second; ++j)
                {
                    index.push_back(a[j].second);
                }
                sort(index.begin(), index.end());
                for (int i : index)
                {
                    cout << ' ' << i;
                }
                cout << endl;
            }
            return 0;
        }
    }

    cout << "No" << endl;
}

#include <bits/stdc++.h>
#include <cmath>
#include <unordered_set>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> A(n);
  for(int i = 0; i < n; i++){
    ll a;
    cin >> a;
    A.at(i) = a;
  }

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

  ll ans = 1;

  for(int i = 0; i < n-1; i++){
    ans *= A.at(i) - A.at(i+1) + 1;
    ans %= MOD;
  }

  ans *= A.at(n-1) + 1;
  ans %= MOD;

  cout << ans << endl;
}


#include<bits/stdc++.h>

#define ll long long

using namespace std;
//memset(dp, 0, sizeof(dp));

void work(int T) {
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;
		if(s == "AND") {
			a[i] = 1;
		} else {
			a[i] = 0;
		}
	}
	vector<vector<ll>> dp(n + 1, vector<ll>(2));
	dp[0][0] = dp[0][1] = 1;
	for(int i = 1; i <= n; i++) {
		if(a[i - 1]) {
			dp[i][0] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][0];
			dp[i][1] = dp[i - 1][1];
		} else {
			dp[i][0] = dp[i - 1][0];
			dp[i][1] = dp[i - 1][1] + dp[i - 1][0] + dp[i - 1][1];
		}
	}
	cout << dp[n][1] << endl;
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
	// int t;
	// for(cin >> t; t > 0; t--) {
		// work(t);
	// }
	work(0);

	return 0;
};

#include<bits/stdc++.h>
#define rep(a,b,c) for(register int a=(b);a<=(c);++a)
#define dow(a,b,c) for(register int a=(b);a>=(c);--a)
using namespace std;
const int MaxN=1000000+5;
int lef[MaxN],rig[MaxN];
bool usd[MaxN];
int main()
{
	register int n;
	scanf("%d",&n);
	register int pos,typ;
	rep(i,1,n)
	{
		scanf("%d%d",&pos,&typ);
		if(!usd[typ])
		{
			usd[typ]=true;
			lef[typ]=rig[typ]=pos;
			continue;
		}
		lef[typ]=min(lef[typ],pos);
		rig[typ]=max(rig[typ],pos);
	}
	usd[n+1]=true;
	register long long dpB=0,dpE=0,_dpB=0,_dpE=0,Answer;
	register int Last=0;
	rep(i,1,n+1)
	{
		if(!usd[typ=i])
			continue;
		_dpB=dpB,_dpE=dpE;
		dpB=(rig[typ]-lef[typ])+min(_dpB+abs(rig[typ]-lef[Last]),_dpE+abs(rig[typ]-rig[Last]));
		dpE=(rig[typ]-lef[typ])+min(_dpB+abs(lef[typ]-lef[Last]),_dpE+abs(lef[typ]-rig[Last]));
		Last=typ;
	}
	printf("%lld\n",Answer=min(dpB,dpE));
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=INF;
const ll inf=INF*INF;
const ll mod=MOD;
const ll MAX=100010;

signed main(){
    ll n;cin>>n;
    double d,h;cin>>d>>h;
    double ans=0;
    rep(i,n){
        double a,b;cin>>a>>b;
        ans=max(ans,h-(h-b)*d/(d-a));
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using LD = long double;

template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void yes(bool ok = true){ cout << (ok ? "yes" : "no") << endl; }
void Yes(bool ok = true){ cout << (ok ? "Yes" : "No") << endl; }
void YES(bool ok = true){ cout << (ok ? "YES" : "NO") << endl; }

LD memo[105][105][105];

LD dfs(int a, int b, int c){
    if(memo[a][b][c] != 0) return memo[a][b][c];
    if(a == 100 || b == 100 || c == 100) return memo[a][b][c] = 0;
    LD sum = a + b + c;
    return memo[a][b][c] = a * (dfs(a+1, b, c)+1) / sum + b * (dfs(a, b+1, c)+1) / sum + c * (dfs(a, b, c+1)+1) / sum;
}

void Main(){
    int a, b, c; cin >> a >> b >> c;
    cout << dfs(a, b, c) << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

//begin of def
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define endl '\n'

using lli = long long int;
using ulli = unsigned long long int;
using Ld = long double;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using pld = pair<Ld, Ld>;
#define X first
#define Y second

#define rep(I, S, E) for(int I = (S); I < (E); I++)
#define repq(I, S, E) for(int I = (S); I <= (E); I++)

#define pb push_back
#define epb emplace_back

#define ALL(P) P.begin(), P.end()

//end of def

const lli MOD = 1e9 + 7;

int main(){
    fastio;
    int n;
    cin >> n;
    vector<lli> v(n);
    rep(i, 0, n)
        cin >> v[i];
    v.pb(0);
    sort(ALL(v));
    v.erase(unique(ALL(v)), v.end());
    n = v.size();
    lli res = 1;
    rep(i, 1, n){
        res = (res * (v[i] - v[i - 1] + 1)) % MOD;
    }
    cout << res;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define int long long int

#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define repd(i, n) for(int i = (int) (n - 1); i >= 0; i--)
#define FOR(i, a, b) for(int i = a; i <= (int) b; i++)
#define FORD(i, a, b) for(int i = a; i >= (int) b; i--)

template <typename T>
void load(int n, vector<T> &v) {
  rep(i, n) {
    T a;
    cin >> a;
    v.push_back(a);
  }
}

signed main() {
  int k;
  cin >> k;

  /*
   * AとBのペアを考えれば,Cは floor(k/AB) 個の候補が存在する.
   * よって以下のコードを書くことができる.
   */
  /*
  int count = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; b <= k; b++) {
      count += floor((double) k / ((double) a * (double) b));
    }
  }
  cout << count << endl;
  */
  /*
   * これで正解は出るが,計算量はO(N^2)であるから,間に合わない.
   * ここから改良する.まず,a * b > kの時点で組み合わせは無いので答えにはなり得ない.
   * よって,以下のコードを得る
   */
  int count = 0;
  for (int a = 1; a <= k; a++) {
    for (int b = 1; a * b <= k; b++) {
      count += floor((double) k / ((double) a * (double) b));
    }
  }
  cout << count << endl;
  /*
   * この計算量について考えてみよう.
   * aが1からkまで動くとき,bは1からk / aまで動く.
   * よって,計算量は, Sum(a=1->k)[k / a] = k * Sum(a=1->k)[1 / a] を考えることにより,
   * O(klog(k))である.よって十分高速に動作する.
   * ※ 1 + 1/2 + 1/3 + ... 1/n < log(n) は面積評価することにより証明できる.
   */
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  string s;
  cin >> s;
  vector<int> v(10);
  int sz = s.size();
  for (int i = 0; i < sz; i++) {
    int idx = s[i] - '0';
    v[idx]++;
  }
  debug(v);
  if (sz == 1) {
    if (s == "8")
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    return 0;
  }
  vector<string> vs = {"16", "61", "24", "42", "32", "23", "48", "84", "56",
                       "65", "64", "46", "72", "27", "88", "96", "69"};
  if (sz == 2) {
    for (auto a : vs) {
      if (a == s) {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
    return 0;
  }
  for (int i = 104; i < 1000; i += 8) {
    bool break_flag = false;
    vector<int> v_tmp = v;
    string tmp = to_string(i);
    debug(tmp);
    for (int j = 0; j < 3; j++) {
      if (v_tmp[tmp[j] - '0'] <= 0) {
        break_flag = true;
        break;
      }
      v_tmp[tmp[j] - '0']--;
    }
    debug(v_tmp);
    if (!break_flag) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define maxe              *max_element
#define mine              *min_element
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    string s; cin>>s;

    if(s.sz==1)
    {
        if(s=="8") cout<<"Yes";
        else cout<<"No";
        return 0;
    }

    set<ll>two, three;

    for(ll i=10;i<=99;i++) if(i%8==0) two.insert(i);
    for(ll i=100;i<=999;i++) if(i%8==0) three.insert(i);

    if(s.sz==2)
    {
        for(auto i:two)
        {
            string k=s;
            reverse(all(k));
            ll a,b;
            a=stoi(s);
            b=stoi(k);
            if(a%8==0 || b%8==0)
            {
                cout<<"Yes"; return 0;
            }
        }

        cout<<"No"; return 0;
    }

    //for(auto i:three) cout<<i<<" "; cout<<endl;

    for(auto i:three)
    {
        string now=to_string(i);
        string k=s;
        ll f=0;
        //see(now);

        for(ll i=0;i<now.sz;i++)
        {
            for(ll j=0;j<k.sz;j++)
            {
                if(now[i]==k[j])
                {
                    //cout<<k<<" ";
                    k[j]='X'; f++; break;
                    //cout<<k<<endl<<endl;
                }
            }
        }

        if(f==3)
        {
            cout<<"Yes"; return 0;
        }
    }

    cout<<"No"; return 0;
}


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

typedef long long int ll;

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

	ll i,j,k,l,m,n,t;

	char s,c;

	cin >> s;

	cin >> c;

	if(s == 'Y')
		cout << (char)toupper(c) << '\n';
	else
		cout << c << '\n';

}

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define fi first
#define se second
#define endl '\n'
#define sf(n) scanf("%d",&n);
#define pf(n) printf("%d\n",n);
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{
	fast_io;

	char v1,v2,v3;
	cin >> v1 >> v2 >> v3;

	if(v1==v2 && v2==v3){
		cout << "Won" << endl;
	}
	else{
		cout << "Lost" << endl;
	}

	return 0;

}


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

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int n, a[100], b[100], c[100], d[100];

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

bool comp(const P& p1, const P& p2) {
    if (p1.fi >= 0 && p2.fi < 0) return true;
    if (p1.fi < 0 && p2.fi >= 0) return false;
    if (p1.fi == 0 && p2.fi == 0) {
        if (p1.se > 0 && p2.se < 0) return true;
        if (p1.se < 0 && p2.se > 0) return false;
        return abs(p1.se) < abs(p2.se);
    }
    if (p2.fi * p1.se == p1.fi * p2.se)
        return sq(p1.fi, p1.se) < sq(p2.fi, p2.se);
    return p2.fi * p1.se < p1.fi * p2.se;
}

bool judge(vector<P> &x, vector<P> &y) {
    rep(i, n) {
        bool tmp = true;
        rep(j, n) if (sq(x[j].fi, x[j].se) !=
            sq(y[(j + i) % n].fi, y[(j + i) % n].se) ||
            sq(x[(j + 1) % n].fi - x[j].fi, x[(j + 1) % n].se - x[j].se) !=
            sq(y[(j + i + 1) % n].fi - y[(j + i) % n].fi,
               y[(j + i + 1) % n].se - y[(j + i) % n].se)) {
            tmp = false;
            break;
        }
        if (tmp) return true;
    }
    return false;
}

int main() {
    ci(n);
    rep(i, n) ci2(a[i], b[i]);
    rep(i, n) ci2(c[i], d[i]);
    if (n < 2) {
        co("Yes");
        return 0;
    }
    vector<P> u[n], v[n];
    rep(i, n) {
        rep(j, n) {
            if (j == i) continue;
            u[i].epb(a[j] - a[i], b[j] - b[i]);
            v[i].epb(c[j] - c[i], d[j] - d[i]);
        }
        sort(u[i].begin(), u[i].end(), comp);
        sort(v[i].begin(), v[i].end(), comp);
    }
    bool ans = false;
    rep(i, n) rep(j, n) ans |= judge(u[i], v[j]);
    if (n == 3 &&
        sq(u[0][0].fi, u[0][0].se) != sq(u[0][1].fi, u[0][1].se) &&
        sq(u[1][0].fi, u[1][0].se) != sq(u[1][1].fi, u[1][1].se) &&
        sq(u[2][0].fi, u[2][0].se) != sq(u[2][1].fi, u[2][1].se)) {
        rep(i, 3) rep(j, 3) rep(k, 2) {
            if (sq(u[i][0].fi, u[i][0].se) !=
                sq(v[i][k].fi, v[i][k].se)) continue;
            int t = (i + 1) % 2;
            if (u[i][0].fi * u[t][0].se - u[i][0].se * u[t][0].fi !=
                v[i][k].fi * v[t][k].se - v[i][k].se * v[t][k].fi) {
                co("No");
                return 0;
            }
        }
    }
    if (ans) co("Yes");
    else co("No");
    return 0;
}

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

void solve() {
    int n, ans = 0;
    cin >> n;
    vector<array<int, 2>> v(n), w(n);
    for (int i=0;i<n;++i) {
        cin >> v[i][0] >> v[i][1];
    }
    for (int i=0;i<n;++i) {
        cin >> w[i][0] >> w[i][1];
    }
    if (n == 1) {
        cout << "Yes\n";
        return;
    }
    auto dist = [](array<int, 2> a, array<int, 2> b) {
        LL x = a[0] - b[0], y = a[1] - b[1];
        return x * x + y * y;
    };
    for (int i=0;i<n;++i) {
        for (int j=0;j<n;++j) if (j != i) {
            // v[0] maps to w[i]
            // v[1] maps to w[j]
            LL r1 = dist(v[0], v[1]), r2 = dist(w[i], w[j]);
            if (r1 != r2) continue;
            // cout << i << " " << j << " match\n";

            LL av = v[1][0] - v[0][0], bv = v[1][1] - v[0][1], aw = w[j][0] - w[i][0], bw = w[j][1] - w[i][1];

            vector<array<LL, 2>> vv, ww;

            for (auto p : v) {
                p[0] -= v[0][0];
                p[1] -= v[0][1];
                vv.push_back({av * p[0] + bv * p[1], av * p[1] - bv * p[0]});
            }
            for (auto p : w) {
                p[0] -= w[i][0];
                p[1] -= w[i][1];
                ww.push_back({aw * p[0] + bw * p[1], aw * p[1] - bw * p[0]});
            }
            sort(vv.begin(), vv.end());
            sort(ww.begin(), ww.end());

            if (vv == ww) {
                cout << "Yes\n";
                return;
            }
            // for (auto p : vv) cout << p[0] << "," << p[1] << " "; cout << '\n';
            // for (auto p : ww) cout << p[0] << "," << p[1] << " "; cout << '\n';
        }
    }
    cout << "No\n";
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FI freopen("../in", "r", stdin)
#define FO freopen("../out", "w", stdout)
#define X first
#define Y second
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef EDBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int, int> ii;

void solve() {
  int n;
  cin >> n;
  int ans = 0;
  while (n --) {
    int x;
    cin >> x;
    ans += max(0, x - 10);
  }
  cout << ans;
}

int main() {
  ios::sync_with_stdio(false);
#ifndef EDBUG
  cin.tie(nullptr);
#endif
#ifdef QUICKRUN
  FI;
    // FO;
#endif

  solve();
  return 0;
}

#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mm(arr) memset(arr, 0, sizeof(arr))
#define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
#define pb push_back
#define PI 3.141592653589793
#define MOD 1000000007

#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;
int main() {
    int a,b,c;
    char d;
    string e,f;
    cin >>a;
    if (a>=0){
        cout <<a;
    }
    else cout <<0;

  return 0;
}


/** I can do this all day **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define SZ(x)			    		(int)x.size()
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);

const int N = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll mod2 = 998244353;
const ll inf = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll M)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M : pw(a * a % M, b / 2, M))); }

int n, A[N];

int main()
{
	scanf("%d", &n);
	A[1] = 6;
	A[2] = 10;
	A[3] = 15;
	int ptr = 16;
	for(int i = 4; i <= n; i ++)
	{
		int ok = 0;
		while(!ok)
		{
			ok = 1;
			for(int j = 1; j < i; j ++)
			{
				if(__gcd(ptr, A[j]) == 1)
				{
					ok = 0;
					break;
				}
			}
			if(!ok)
			{
				ptr ++;
			}
		}
		A[i] = ptr;
		ptr ++;
	}
	for(int i = 1; i <= n; i ++)
	{
		printf("%d ", A[i]);
	}
    return 0;
}

/** test corner cases(n = 1?) watch for overflow or minus indices **/

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

#define ll long long int
#define ull unsigned long long int

/**********************************************/

bool rec(set<char> s, map<char, vector<pair<int, int>>>& mp, vector<string>& num) {
	if (mp.empty()) {
		for (int i = 0; i < 3; i++) {
			if (num[i][0] == '0') return false;
		}

		ll a = stoll(num[0]);
		ll b = stoll(num[1]);
		ll c = stoll(num[2]);

		if (a + b == c) {
			cout << a << endl;
			cout << b << endl;
			cout << c << endl;
			return true;
		} else {
			return false;
		}
	}

	char currentChar = mp.begin()->first;
	auto v = mp.begin()->second;
	mp.erase(currentChar);

	vector<char> v1;
	for (auto& x : s) v1.push_back(x);

	for (auto& x : v1) {
		s.erase(x);
		for (auto& p : v) {
			int stringIndex = p.first;
			int charIndex = p.second;

			num[stringIndex][charIndex] = x;
		}

		if (rec(s, mp, num)) return true;

		s.insert(x);
	}

	mp[currentChar] = v;
	return false;
}

void solve(vector<string>& v) {
	if (v[2].size() < v[0].size() || v[2].size() < v[1].size()) {
		cout << "UNSOLVABLE" << endl;
		return;
	}

	map<char, vector<pair<int, int>>> mp;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < v[i].size(); j++) {
			mp[v[i][j]].push_back({i, j});
		}
	}

	if (mp.size() > 10) {
		cout << "UNSOLVABLE" << endl;
		return;
	}

	vector<string> num(3);
	for (int i = 0; i < 3; i++) {
		num[i] = "";
		for (int j = 0; j < v[i].size(); j++) {
			num[i] += 'x';
		}
	}

	set<char> s;
	for (char i = '0'; i <= '9'; i++) s.insert(i);

	if (!rec(s, mp, num)) {
		cout << "UNSOLVABLE" << endl;
	}
}

int main() {

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

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

	ll t = 1;
	// cin >> t;
	while (t--) {
		vector<string> v(3);
		for (int i = 0; i < 3; i++) {
			cin >> v[i];
		}

		solve(v);
	}
}


#include<iostream>
#include<iomanip>
#include<bitset>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<queue>
#include<map>
#include<set>
using namespace std;
using ll=long long;

int main(){
    int N;
    string S;
    cin >> N >> S;
    N++;
    vector<int> A(N);
    for(int &x: A)cin >> x;
    int dmi = 1000000;
    for(int i = 1; i < N; i++){
        int d = abs(A[i] - A[i - 1]);
        dmi = min (dmi, d);
    }
    cout << dmi << endl;
    for(int i = 0; i < dmi; i++){
        vector<int> B(N, 0);
        for(int j = 0; j < N; j++){
            B[j] = A[j] / dmi;
            if(dmi - i <= A[j] % dmi)B[j]++;
        }
        for(int j = 0; j < N; j++){
            if(j < N - 1){
                cout << B[j] << " ";
                continue;
            }
            cout << B[j] << endl;
        }
    }
    return 0;
}

/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define urep(i,n)     for(int i=n-1;i>=0;i--)
#define urep1(i,n)    for(int i=n;i>=1;i--)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(2);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int n,l;cin>>n>>l;
    cout<<n/l<<nl;
    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;

#pragma GCC optimize("Ofast")
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
template<typename T>
using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const bool DEBUG = 0;
const int MAXN = 100005;

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

	ll b,c; cin>>b>>c;
	vii v;
	v.pb({b,b-c/2}); //subtract only
	v.pb({-b,-b-(c-1)/2}); //flip then subtract
	v.pb({-b,-(b-(c-1)/2)}); //subtract then flip
	v.pb({b,(b+(c-2)/2)}); //flip, subtract, flip

	forn(i,0,v.size()) if(v[i].F>v[i].S) swap(v[i].F,v[i].S);
	sort(v.begin(), v.end());
	ll ans=0,l=v[0].F,r=v[0].S;

	//for(ii tmp: v) cout<<tmp.F<<" "<<tmp.S<<'\n';

	forn(i,1,v.size())
	{
		if(v[i].F>r)
		{
			ans+=r-l+1;
			l=v[i].F, r=v[i].S;
		}
		else
		{
			r=max(r,v[i].S);
		}
	}
	ans+=r-l+1;

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

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pll> vpll;
typedef vector<pii> vpii;

#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define in() freopen("test.txt","r",stdin)
#define out() freopen("output.txt","w",stdout)
#define vt vector
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define mk make_pair
#define fi first
#define se second
#define nl "\n"
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define s(v) v.size()
#define test ll t;cin>>t;while(t--)
#define read0(v,n) for(int i=0;i<n;i++)cin>>v[i];
#define read1(v,n) for(int i=1;i<=n;i++)cin>>v[i];
#define trav(a,x) for (auto& a: x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cut(x) {cout<<x;return 0;}
#define print(x) {cout<<x<<nl;}
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define FORB(i,a,b) for(int i=a;i>=b;--i)
#define err1(a) {cout<<#a<<' '<<a<<nl;}
#define err2(a,b) {cout<<#a<<' '<<a<<' '<<#b<<' '<<b<<nl;}
#define mem(a,b) memset(a,b,sizeof(a))
#define maxn 100000
#define dis(ar,n) {for(int i=0;i<(n);++i) cout << ar[i] << " "; cout << nl;}
ll gcd(ll a, ll b){if (b==0)return a;return gcd(b, a % b);}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll bpow(ll a, ll b){ll ans=1;while(b){if(b&1)ans=(ans*a)%MOD;b/=2;a=(a*a)%MOD;}return ans;}
vt<pair<int,int>> dir = {{1,0},{-1,0},{0,1},{0,-1}};
int main(){
 	fast
	ld a,b;
	cin >> a >> b;
    cout << a*(b/100.0) << endl;
	return 0;
}


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

mt19937 rand_mt(42);

const int N = 20;

class Genome{
public:
    Genome(const vector<string>& S): sequences(S){

        // auto dna = init_random();
        auto dna = init_bf();

        for(int i=0; i<N; i++){
            dna_w[i] = dna[i];

            for(int j=0; j<N; j++){
                dna_h[j] += dna[i][j];
            }
        }
        for(int i=0; i<N; i++){
            dna_w[i] += dna_w[i];
            dna_h[i] += dna_h[i];
        }
    }

    array<string, N> init_random(){
        auto dna = array<string, N>();
        for(int i=0; i<N; i++){
            for(int j=0; j<N; j++){
                dna[i] += 'A' + rand_mt() % 8;
            }
        }
        return dna;
    }

    array<string, N> init_bf(){
        auto dna = array<string, N>();
        int i = 0;
        for(auto s : sequences){
            for(int i=0; i<N; i++){
                if(N - dna[i].size() < s.size()) continue;

                dna[i] += s;
                break;
            }
        }
        return dna;
    }

    int evaluate(){
        const auto M = sequences.size();
        int c = 0;
        for(auto s : sequences){
            bool hasSeq = false;
            for(auto dw : dna_w){
                if(dw.find(s) != string::npos){ hasSeq = true; break;}
            }
            if (hasSeq){ c++; continue;}

            for(auto dw : dna_h){
                if(dw.find(s) != string::npos){ hasSeq = true; break;}
            }
            if (hasSeq){ c++; continue;}
        }

        int d = 0;
        auto dna = getDNA();
        for(auto s : dna){
            d += count(s.begin(), s.end(), '.');
        }

        if(c < M){
            return int(1e+8 * (c / (double) M));
        }else{
            return int(1e+8 * ((2 * N * N) / (double) (2 * N * N - d)));
        }
    }

    array<string, N> getDNA(){
        auto dna = array<string, N>();
        for(int i=0; i<N; i++){
            dna[i] = dna_w[i].substr(0, 20);
        }
        return dna;
    }

    void print(){
        auto dna = getDNA();
        for(int i=0; i<N; i++){
            cout << dna[i] << endl;
        }
    }

public:
    array<string, N> dna_w;
    array<string, N> dna_h;

    const vector<string> sequences;

};

int main()
{
    int M;
    cin >> M >> M;
    vector<string> S(M, "");
    for(int i=0; i<M; i++) cin >> S[i];
    sort(S.begin(), S.end(), [](const string& s1, const string& s2){return s1.size() > s2.size();});

    auto genome = Genome(S);
    genome.print();

    // cerr << "score = "<< genome.evaluate() << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<endl
#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<string> C(vector<string> s) {
  ll n=s.size();
  rep(i,n)REP(j,i+1,n) swap(s[i][j],s[j][i]);
  return s;
}

ll n,m;
string s[1000];

ll calc(vector<string> t) {
  ll cnt=0;
  rep(k,m) {
    ll f=0;
    rep(l,2) {
      rep(i,n) {
        rep(j,n) {
          if(t[i].substr(0,s[k].size())==s[k]) f=1;
          rotate(t[i].begin(),t[i].begin()+1,t[i].end());
        }
      }
      t=C(t);
    }
    cnt+=f;
  }
  return cnt;
}

vector<string> ans;
ll MM;

void solve(vector<string> t) {
  ll d=calc(t);
  if(MM<d) {
    MM=d;
    ans=t;
  }
  rep(k,5) {
    random_shuffle(all(t));
    rep(i,n) rotate(t[i].begin(),t[i].begin()+rand()%n,t[i].end());
    ll d=calc(t);
    if(MM<d) {
      MM=d;
      ans=t;
    }
  }
}

void Main() {
  srand((unsigned)time(NULL));
  cin >> n >> m;
  rep(i,m) R s[i];
  vector<string> v[15];
  rep(i,m) v[s[i].size()].pb(s[i]);
  rep(e,30) {
    vector<string> t(n);
    rrep(i,15) {
      random_shuffle(all(v[i]));
      rep(j,v[i].size()) {
        ll M=MAX,x=0;
        string rr;
        rep(k,n) {
          rep(l,t[k].size()+1) {
            string r1=t[k].substr(l);
            if(r1.size()<=v[i][j].size()) {
              string r2=v[i][j].substr(0,r1.size());
              if(r1==r2) {
                ll d=t[k].size()+v[i][j].size()-r1.size();
                if(d<=n&&M>d) {
                  M=d;
                  x=k;
                  rr=t[k]+v[i][j].substr(r1.size());
                }
              }
            }
          }
        }
        if(rand()%9==0) M=MAX;
        if(M!=MAX) t[x]=rr;
      }
    }
    rep(i,n) {
      while(t[i].size()<n) {
        //t[i]+='.';
        t[i]+=(char)(rand()%8+'A');
      }
    }
    solve(t);
  }
  rep(i,n) pr(ans[i]);
}

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


#include <iostream>
using namespace std;

int main(void) {
  unsigned long long n, n1, m;
  cin >> n;
  n1 = n + 1; // n+1本目の残り長さ
  m = 1; // 最初に切る木の長さ = n+1本目の木で賄えた本数 - 1

  while(true)
    if (n1 >= m) {//次の長さの木を賄えたら
      n1 -= m; //n+1本目の木を切る
      m++;    //次に賄う木の長さ+1増加 = n+1本目の木で賄えた本数 + 1
    } else
      break;

  cout << n + 2 - m << endl;
  return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n; cin >> n;
    ll l = 1, r = 2002002002;
    while(l+1<r){
        ll m = (l+r) /2;
        if(m*(m+1)/2 <= n+1) l = m;
        else r = m;
    }

    ll ans = n+1 - l;
    cout << ans << endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<map>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<ctime>
using namespace std;
#define M 200005
#define N 1000005
#define MP make_pair
#define debug() cerr<<"Why So Serious?"<<endl
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T>void Rd(T &x){
	x=0;static char c;
	while(c=getchar(),c<48);
	do x=(x<<1)+(x<<3)+(c^48);
	while(c=getchar(),c>47);
}
int n;
int Id1[M],Id2[M];
int A[M],B[M];
bool cmp1(int a,int b){
	return (A[a]==A[b])?a<b:A[a]<A[b];
}
bool cmp2(int a,int b){
	return (B[a]==B[b])?a<b:B[a]<B[b];
}
int P[M];
int Sum[M];
void Add(int x){
	for(;x>0;x-=x&-x)Sum[x]++;
}
int Query(int x){
	int res=0;
	for(;x<=n;x+=x&-x)res+=Sum[x];
	return res;
}
int main(){
	Rd(n);
	for(int i=1;i<=n;++i)Id1[i]=Id2[i]=i;
	for(int i=1;i<=n;++i)Rd(A[i]),A[i]+=i;
	for(int i=1;i<=n;++i)Rd(B[i]),B[i]+=i;
	sort(Id1+1,Id1+n+1,cmp1);
	sort(Id2+1,Id2+n+1,cmp2);
	ll ans=0;
	for(int i=1;i<=n;++i){
		if(A[Id1[i]]!=B[Id2[i]]){
			puts("-1");
			return 0;
		}
		P[Id1[i]]=Id2[i];
	}
	for(int i=1;i<=n;++i){
		ans+=Query(P[i]);
		Add(P[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
	int n,m,a[2200000],mex,nums[2200000];
  vector<int> v;
  cin >> n >> m;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    if(i<m) v.push_back(a[i]);
  }
  sort(v.begin(),v.end());
  int now=0;
  bool ok=true;
  for(int i=0; i<m; i++){
  	if(v[i] == now) now++;
    if(v[i] > now && ok) {
      mex = now;
      ok=false;
    }
    nums[v[i]]++;
  }
  if(ok) mex = now;
  for(int i=0; i<n-m; i++){
  	nums[a[i]]--;
    nums[a[i+m]]++;
    if(a[i] < mex && nums[a[i]]==0) mex = a[i];
  }
  cout << mex;
}


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

#define stp(var, init, end) for (auto var = init; var < end; ++var)
#define stpe(var, init, end) for (auto var = init; var <= end; ++var)
#define stpi(iter, array) for (auto iter = array.begin(); iter != array.end(); ++iter)
#define ll long long

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(max(a + b, b + c), c + a);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(a==b)cout<<c;
	else if(b==c)cout<<a;
	else if(a==c)cout<<b;
	else cout<<0;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define rev(v)  if(!v.empty())reverse(v.begin(),v.end())
#define PI 3.141592653589793238
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

const ll N=(ll)3e5;
ll inv[N];
ll fac[N];

void init(){
  fac[0]=1;

  for(ll i=1;i<N;i++)
  fac[i]=(i*fac[i-1])%mod;

  for(ll i=0;i<N;i++)
  inv[i]=inv_mod(fac[i]);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;

    if(n==r||r==0)
    return 1LL;

    ll x=fac[n];
    ll y=inv[n-r];
    ll z=inv[r];

    return ((x*y)%mod*z)%mod;
}
ll n;

void solve(ll test_case)
{
   string s;
   cin>>s;

   s.pb(s[0]);

   s.erase(0,1);

   cout<<s<<endl;
}
int main()
{

   // init();   //factorial calculations

   //Start from Here.

  ll t;
  t=1;
  ll q;
//   cin>>t>>n>>q;
  for(ll i=1;i<=t;i++)
  solve(i);
//Good Bye!
    return 0;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <valarray>
#include <cstdlib>
#include <array>
#include <random>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define sort(A) sort(A.begin(), A.end())
#define zisyo(v) next_permutation(begin(v),end(v))
#define check(i) cout<<"*"<<i<<endl
#define vec(a) vector<a>
#define vvec(a) vector<vector<a>>
#define keta(a) setprecision(a)
//最小公倍数はこれ→ (a*b / gcd(a,b))

//最大公約数
int gcd(int x, int y) {
    int m = min(x, y);
    for (int d = m; d > 0; d--) {
        if (x % d == 0 && y % d == 0) {
            return d;
        }
    }
}

//各桁の和
ll ketawa(ll n) {
    ll sum = 0;
    while (n > 0) {
        sum += n % 10; n /= 10;
    }
    return sum;
}

//回文判定
bool KIBN(string s) {
    rep(i, 0, s.size() / 2) {
        if (s[i] != s[s.size() - 1 - i])return false;
    }
    return true;
}

//素数判定
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main(void) {
    char a, b, c;
    cin >> a >> b >> c;
    cout << b << c << a << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

ll arr[102];
unordered_map < ll , ll > facs;
vector < mp > ans;

void hashIt(ll x) {
	ll v = sqrt(x);
	for(ll i=2;i<=v;i++) {
		if(x % i == 0) {
			facs[i] ++ ;
			while(x % i == 0) x /= i;
		}
	}
	if(x > 1) facs[x] ++ ;
}

void thisIsMain() {
	facs.clear();
	ans.clear();
	ll n;
	cin>>n;
	forl(i,n) cin>>arr[i];
	forl(i,n) hashIt(arr[i]);
	for(auto v : facs) ans.push_back({v.ss, v.ff});
	sort(all(ans));
	// forl(i,ans.size()) cout<<ans[i].ff<<" "<<ans[i].ss<<"\n";
	cout<<ans.back().ss<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int ma=0;
  rep(i,n){
    cin>>a[i];
    ma = max(a[i],ma);
  }

  int ans=0;
int index;
  for (int i = 2; i <= ma; i++)
  {
    /* code */
    int sum=0;

    for (int j = 0; j < n; j++)
    {
       if(a[j]%i ==0) sum++;
    }
    if(ans<=sum) {
      ans = sum;
      index = i;
    }
  }
      cout<<index<<endl;

  return 0;

}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
const int N = 500005;
char s[N], e[N];
vector<int> v[2];
vector<int> df;
int t[N];
int n;
int lowbit(int x){
	return x & -x;
}
void add(int x, int w){
	while(x <= n){
		t[x] += w;
		x += lowbit(x);
	}
}
int query(int x){
	int res = 0;
	while(x){
		res += t[x];
		x -= lowbit(x);
	}
	return res;
}
int main(){
	scanf("%d", &n);
	scanf("%s", s);
	scanf("%s", e);
	bool flag = 1;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		if(s[i - 1] == '0') add(i, 1);
		if(s[i - 1] != e[i - 1]){
			v[s[i - 1] - '0'].push_back(i);
			df.push_back(i);
		}
	}
	df.push_back(n + 1);
	if(v[0].size() != v[1].size()) printf("-1\n");
	else{
		int l = df[0], mt = 0;
		for(int i = 0; i < df.size(); i++){
			if(s[df[i] - 1] == '0') mt--;
			else mt++;
//			cout << mt << endl;
			if(mt == 0){
				ans += query(df[i]) - query(l - 1);
				l = df[i + 1];
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x)cout << a << ' '; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pair<pll, ll> &p1, const pair<pll, ll> &p2)const {
        if (p1.S == p2.S)
        {
            return p1.F.F > p2.F.F;
        }
        return p1.S < p2.S;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 2e5 + 5, inf = 2e18;

void solve()
{
    ll N, P;
    cin >> N >> P;
    ll ans = (P - 1);
    ans = ans * get_pow(P - 2, N - 1) % MOD;
    cout << ans << '\n';
}

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

    int test = 1;
    clock_t z = clock();
    //cin >> test;
    forn(tes, 0, test)
    {
        solve();
    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}


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

int main(){

	int n;
	cin>>n;

	vector<ll> lista(n+1);
	for(int i = 1; i<=n; i++){
		cin>>lista[i];
	}

	vector<vector<ll> > dp(n+1, vector<ll>(n+1, 0));

	for(int i = 1; i<=n; i++){
		dp[i][1] = 1;
	}

	for(int i = 2; i<=n; i++){
		vector<ll> resto(i, 0);
		ll sum = 0;
		for(int j = 1; j<=n; j++){
			sum = (sum + lista[j])%i;
			dp[j][i] = (dp[j][i] + resto[sum%i])%MOD;
			resto[sum%i] = (resto[sum%i] + dp[j][i-1])%MOD;
		}
	}

	ll res = 0;
	for(int i = 1; i<=n; i++){
		res = (res + dp[n][i])%MOD;
	}

	cout<<res<<"\n";

	return 0;
}

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

ll p=998244353;

vector<ll> a(200100);
vector<ll> b(200100);

ll powk(ll k,ll n){
  ll ans=1,m=k;
  while(n){
    if(n%2) ans=ans*m%p;
    m=m*m%p; n/=2;
  }
  return ans;
}

void comb1(){
  a[0]=1;
  for(ll i=1;i<200100;i++) a[i]=a[i-1]*i%p;
  rep(i,200100) b[i]=powk(a[i],p-2);
  return;
}

ll comb(int n,int k){
  ll ans=a[n]*b[n-k]%p*b[k]%p;
  return ans;
}

int main(){
  comb1();
  ll n,m;
  cin >> n >> m;
  ll ans=1;
  for(int i=2;i<=m;i++){
    int j=i,x=2; ll y=1;
    while(x*x<=i){
      int k=0;
      while(j%x==0){
        j/=x; k++;
      }
      y*=comb(n+k-1,k);
      y%=p;
      x++;
    }
    if(1<j) y=y*n%p;
    ans=(ans+y)%p;
  }
  cout << ans << endl;
}


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

int main(void)
{
    char c1, c2, c3;

    cin >> c1 >> c2 >> c3;

    if ((c1 == c2) && (c2 == c3))
        cout << "Won" << endl;
    else
        cout << "Lost" << endl;

    return 0;
}

// C++ (GCC9.2.1) AtCoder
/*
Ctrl+Option+N で　実行

*/

#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  print(b-c)

  return 0;
}


/**
 * 問題順: D
 * 問題名: Base n
 * 実行時間制限: 2 sec
 * メモリ制限: 1024 MB
 * 配点: 400点
 * URL: https://atcoder.jp/contests/abc192/tasks/abc192_d
 * 最終結果: WA
 * 問題分類: 数学, 数え上げ
 * アルゴリズム: 二分探索
 */
#include<iostream>
using namespace std;
using ll = long long;

string X;
ll M;
bool isOK(ll d) {
  ll x=0,tM=M;
  int i;
  int Mlen=0;
  while(tM>0) {
    Mlen++;
    tM/=d;
  }
  if (Mlen<X.size()) return false;

  for (i=0;i<X.size() && x<=M;i++) {
    x *= d;
    x += (X[i]-'0');
  }
  return x<=M;
}

int main() {
  int i;
  cin>>X>>M;
  int maxD=0;
  for (i=0;i<X.size();i++) {
    maxD = max(maxD, (int)(X[i]-'0'));
  }
  ll ans=0;
  ll ok = maxD+1, ng=1e18; ng++;
  if (X.size()>1) {
    if (isOK(ok)) {
      while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (isOK(mid)) ok = mid;
        else ng = mid;
      }
      ans = ok-maxD;
    }
  } else {
    ans = isOK(ok) ? 1 : 0;
  }
  cout<<ans<<endl;
  return 0;
}

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

int sum_digit(int n){
    int res = 0;
    while(n){
        res += n%10;
        n /= 10;
    }
    return res;
}

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

    int a, b;
    cin >> a >> b;
    int x = sum_digit(a);
    int y = sum_digit(b);
    cout << (x > y ? x : y) ;
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>
#ifdef _DEBUG
#include "_DEBUG.hpp"
#endif
#define int long long
using namespace std;
using P = pair<int, int>;
const int inf = 2e18;
const int mod = 1e9 + 7;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}

template <class T>
vector<T> make_vec(size_t a) {
  return vector<T>(a);
}

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

template <class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
  t = v;
}

template <class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
  for (auto &e : t) fill(e, v);
}

bool kaibun(string s) {
  bool ok = true;
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[(int)s.size() - 1 - i]) ok = false;
  }
  return ok;
}

signed main() {
  string s;
  cin >> s;

  bool ok = false;
  for (int i = 0; i < 99; i++) {
    string t = s;
    for (int j = 0; j < i; j++) {
      t.insert(0, "0");
    }
    if (kaibun(t)) {
      ok = true;
      break;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;

  return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    while(n!=0&&n%10==0){
        n/=10;
    }
    int k=0;
    int o=n;
    while(o!=0){
        k*=10;
        k+=(o%10);
        o/=10;
    }
    if(k==n){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return(0);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define HERE
#define debug(args...)
#endif
const int N = 1e5 +5;
const ll mod = 1e9+7;
typedef pair<int,int> pii;

bool issub(int i, int j , string &s1, string &s2)
{
    if(j==s2.size())
    {
        return 1;
    }
    if(i==s1.size() || j==s2.size())
    {
        return 0;
    }
    if(s1[i]== s2[j])
    {
        return issub(i+1, j+1 , s1, s2);
    }
    else{
        return issub(i+1 , j , s1, s2);
    }
}

void TEST_CASES(int cas)
{
    int n;
    string s1,s2,s3;
    cin>>n>>s1>>s2>>s3;
    s1+=s1;
    s2+=s2;
    s3+=s3;
    debug(s1,s2,s3);
    string ans;
    for(int i=0;i<n;i++)
    {
        ans+="0";
    }
    for(int i=0;i<n;i++)
    {
        ans+="1";
    }
    ans+="0";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.pop_back();
    ans+="1";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.clear();
    for(int i=0;i<n;i++)
    {
        ans+="1";
    }
    for(int i=0;i<n;i++)
    {
        ans+="0";
    }
    ans+="0";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.pop_back();
    ans+="1";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
}

/*
*/

int32_t main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int t=1,cas=0;
    cin>>t;
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}

#include<bits/stdc++.h>
const int N=1e5+100;
using namespace std;
int n;
void run(){
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	for(int i=1;i<=n;i++)cout<<0;
	for(int i=1;i<=n;i++)cout<<1;
	cout<<0<<endl;
}
int main(){
	int T;cin>>T;
	while(T--)
	run();
}


#include <bits/stdc++.h>
#define ar array
#define ll long long
#define endl '\n'
using namespace std;

const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;

int MAX = INT_MAX;
long long LMAX = LONG_LONG_MAX;

vector<vector<int>> a;
bool check[2000];

void dfs(int c) {
    if(check[c]) return;
    check[c] = true;
    for(auto it:a[c]) {
        dfs(it);
    }
}

void solve() {
    int n, m;
    cin >> n >> m;
    a.resize(n);
    for(int i=0; i<m; i++) {
        int x,y;
        cin >> x >> y;
        a[x-1].push_back(y-1);
    }
    int ans=0;
    for(int i=0; i<n; i++) {
        for(int j=0; j<n; j++) check[j] = false;
        dfs(i);
        for(int j=0; j<n; j++) if(check[j]) ans++;
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    while(tc--) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}