#include <bits/stdc++.h>
//#include<fstream>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define all(con) con.begin(),con.end()
#define w(x) int x; cin>>x; while(x--)
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
class Timer { chrono::time_point <chrono::steady_clock> B, E; public: Timer () : B(), E()
{ B = chrono::steady_clock::now(); } ~Timer () { E = chrono::steady_clock::now();
cerr << "\nDuration: " << ((chrono::duration <double>)(E - B)).count() << "s\n"; } } TimerT;
/*ofstream fout("bcount.out");
ifstream fin("bcount.in");*/

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min({a,b,c,d})<<endl;
    //cerr<<"\n"<<(float)clock()/CLOCKS_PER_SEC*1000<<" ms"<<endl;
    return 0;
}
//1. Always consider edge cases like n = 1
//2. Do something or the other rather than just wasting time

    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld long double
    #define MOD 1000000007
    #define mod9 1000000009
    #define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #define mp make_pair
    #define pb push_back
    #define ct ll t;cin>>t;while(t--)
    #define bi begin()
    #define ei end()
    #define fi first
    #define se second
    #define foe(i,a,b) for(ll i=a;i<b;i++)
    #define rfoe(i,a,b) for(ll i=a;i>=0;i--)
    #define sz(s) s.size()
    #define mem(a,s) memset(a,s,sizeof(a))
    #define all(v) v.bi,v.ei
    #define MAX             8000000000000000064LL
    #define MIN            -8000000000000000064LL

    typedef pair<ll,ll> pii;

    ll add(ll a, ll b){return (a%MOD + b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll sub(ll a, ll b){return (a%MOD - b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll mul(ll a, ll b){return ((a%MOD)*(b%MOD) + ((MAX)/MOD)*MOD)%MOD;}
    long long binpow(long long a, long long b)
    {
        long long res = 1;
        while (b > 0) {
            if (b & 1)
                res = res*a;
            a = a*a;
            b >>= 1;
        }
        return res;
    }

    // ll lcm(ll a,ll b){return(a*b)/__gcd(a,b);}
    // ll fact[1000007 ]={0};
    // ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
    // y=y>>1;x=(1ll*x*x)%MOD;} return res;}
    // void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
    // ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
    // ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
    int const N=1e5+9;
    ll const INF = 2e18+5;
    ll dx[8]={0,0,1,-1,1,1,-1,-1};
    ll dy[8]={1,-1,0,0,-1,1,-1,1};

    void solve()
    {
        ll a[4],m=105;
        foe(i,0,4)
        {
            cin>>a[i];
            m=min(m,a[i]);
        }
        cout<<m<<"\n";
    }
    int main()
    {
        fast

        // facto();
        // Sieve();
        // ct
        {
            solve();
        }
    }


/*
    atcoder —— abc199 —— F-Graph Smoothing
*/
#include <bits/stdc++.h>

using namespace std;

#define closeSync ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
const ll MOD = 1e9+7;
const int MAXN = 105;

int n,m,k;
ll A[MAXN],B[MAXN],down = 1;
ll mp[MAXN][MAXN];
struct Mat{
    ll a[MAXN][MAXN];
    int n;
    Mat(int _n = 0)
    {
        n = _n;
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++)
                a[i][j] = 0;
    }
    Mat operator*(const Mat& x)const
    {
        Mat res(n);
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++)
                for (int k=1;k<=n;k++)
                    res.a[i][j] += a[i][k]*x.a[k][j],res.a[i][j] %= MOD;
        return res;
    }
    void ones()
    {
        for (int i=1;i<=n;i++)  a[i][i] = 1;
    }
};

inline Mat mpower(Mat x,ll p)
{
    Mat res(n);
    res.ones();
    while (p)
    {
        if (p&1) res = res * x;
        p >>= 1;
        x = x * x;
    }
    return  res;
}

inline ll qpower(ll x,ll p,ll mod)
{
    ll res = 1;
    while (p)
    {
        if (p&1) res *= x,res %= mod;
        p >>= 1;
        x *= x;
        x %= mod;
    }
    return res;
}

inline void solve()
{
    cin >> n >> m >> k;
    Mat help(n);
    for (int i=1;i<=n;i++)  cin >> A[i];
    for (int i=1;i<=m;i++)
    {
        int u,v;    cin >> u >> v;
        mp[u][v] = mp[v][u] = 1;
    }
    for (int i=1;i<=n;i++)
    {
        int cnt = 0;
        for (int j=1;j<=n;j++)
            if (mp[i][j])  cnt++,help.a[i][j]++,help.a[i][i]++;
        help.a[i][i] += ((m-cnt) << 1);
    }

    Mat tmp = mpower(help,k);

    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
            B[i] += tmp.a[i][j] * A[j],B[i] %= MOD;

    down *= (qpower(2LL,k,MOD) * qpower(m,k,MOD) % MOD);
    down %= MOD;
    for (int i=1;i<=n;i++)
        cout << (B[i] * qpower(down,MOD-2,MOD) % MOD) << "\n";
}

int main()
{closeSync;
    // int T;
    // cin >> T;
    // while (T--)
        solve();
    return 0;
}

/*
3 2 2
12 48 36
1 2
1 3

750000036
36
250000031
*/

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

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

using mat = vector<vector<ll>>;

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

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

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

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

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

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

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

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

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

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


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <climits>
#include <map>
#include <set>
#include <iomanip>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;

void test_case() {
	int64_t n;
	cin >> n;
	vector<int64_t> a(n);
	rep(i, 0, n) cin >> a[i];
	map<int64_t, int64_t> freq;
	freq[a[0]]++;
	int64_t res = 0;
	rep(i, 1, n) {
		for(auto x : freq) {
			int64_t diff = abs(x.first - a[i]);
			res += diff * diff * x.second;
		}
		freq[a[i]]++;
	}
	cout << res << '\n';

}

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int T;
    T = 1;
    while(T-- >0) {
    	test_case();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T1, class T2> inline bool chmin(T1 &a, const T2 &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T> void verr(const set<T> &st) { repa(a, st) cerr << a << " "; cerr << endl; }
template <class S, class T> void verr(const map<S, T> &mp) { repa(a, mp) cerr << "{" << a.first << ", " << a.second << "} "; cerr << endl; }
template <class S, class T, class N> void verr(const vector<pair<S,T>>& a, const N& n) { rep(i, n) cerr << "{" << a[i].first << ", " << a[i].second << "} "; cerr << endl; }
template <class T, class N> void verr(const vector<T>& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << endl; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << endl; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];
    sort(all(A));

    vl acc(N + 1);
    rep(i, N) acc[i + 1] = acc[i] + A[i];

    vl ss(N + 1);
    rep(i, N) ss[i + 1] = ss[i] + A[i] * A[i];

    ll ans = 2 * N * ss[N] - 2 * acc[N] * acc[N];

    ans /= 2;
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repn(i, n) for (int i = (int)(n)-1; i>= 0; --i)
#define ll long long
using Graph = vector<vector<int>>;
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<bool> numa(1000, false), numb(1000, false);
    rep1(i, 1, 1001){
        if (find(a.begin(), a.end(), i) != a.end()) numa[i-1] = true;
        if (find(b.begin(), b.end(), i) != b.end()) numb[i-1] = true;
    }
    rep(i, 1000){
        if ((numa[i] == true && numb[i] == false) || (numb[i] == true && numa[i] == false)){
            cout << i+1 << " ";
        }
    }
    cout << endl;
}

//Fuck the world....don't care anyone........................................................
#include <bits/stdc++.h>
#include<bitset>
#include<iostream>
using namespace std;
#include<math.h>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
#define ll long long
#define ld double
#include<stdio.h>
#define f first
#define s second
#include<stack>
#include<queue>
#define its set<int>::iterator
#define itmp map<int,int>::iterator
#include<stack>
#define lp for(int i=0;i<n;i++)
#define dlp for(int i=0;i<n;i++) for(int j=0;j<n;j++)
#define mod 1000000009
//#define N 101
//#include <boost/functional/hash.hpp>
//bitset<1000> b;
//b.set();   all bit have 1
//seive of Erat
//totient theorm for co-prime
/*ll int N=1000;
	int p[1001]={0};
	p[2]=1;
		vector<int>v;
        for(ll int i=3;i<=N;i+=2)
        p[i]=1;
        v.push_back(2);
        for(ll int i=3;i<=N;i+=2)
        {
            if(p[i])
            {
			v.push_back(i);
                for(ll int j=i*i;j<=N;j+=2*i)
                p[j]=0;
            }
        }  */
/*
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
} */
/*
stringstream ss;
ss<<c;
string s1;
ss>>s1;
*/
/*
int power(int x, unsigned int y)
{
    int temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}*/
int main()
{
	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

      	ll int t=1;

	while(t--)
	{
            // vector<pair<ll,ll> >v;
            ll n;
            cin>>n;
            ll a[n];
             set<ll>s;
            lp
            {
                cin>>a[i];
                s.insert(a[i]);
            }

            set<ll>::reverse_iterator rit;
            set<ll>::iterator it;

            while(1)
            {
                rit=s.rbegin();

                it=s.begin();
                //cout<<*it<<" "<<*rit<<endl;
                if(*rit==*it)
                {
                    cout<<*it<<endl;
                    return 0;
                }
                //cout<<*rit<<endl;
                s.insert(*rit-*it);
                s.erase(*rit);

            }

    }

            return 0;

    }


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define makev(a, n) vector<int> a(n, 0)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define printv(v) rep(i, (int)v.size()) cout << v[i] << (i+1 == (int)v.size() ? "\n" : " ");
#define rfor(i, a, b) for (int i = a; i < b; i++)
const vector<int> maze = {0, 1, 0, -1, 0};
const int mod = 1e9+7;
ll gcd(ll a, ll b) {return b == 0 ? abs(a) : gcd(b, a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a, b);}
ll extgcd(ll a, ll b, ll &x, ll &y) {if (b == 0) {x = 1; y = 0;return a;} else {ll d = extgcd(b, a % b, y, x);y-=a/b*x;return d;}}
ll modpow(ll x, ll n, ll p) {ll ans = 1;while (n > 0) {if (n&1) ans = ans*x%p;x = x*x%p;n >>= 1;}return ans;}

int main() {
  int n; cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  vector<ll> dp0(n+1, 0); dp0[0] = 1;
  vector<ll> dp1(n+1, 0); dp1[0] = 1;
  rfor(i, 1, n+1) {
    if (s[i-1] == "AND") {
      dp0[i] = dp0[i-1]*2+dp1[i-1];
      dp1[i] = dp1[i-1];
    } else {
      dp0[i] = dp0[i-1];
      dp1[i] = dp0[i-1]+dp1[i-1]*2;
    }
  }
  cout << dp1[n] << endl;
}

#include <bits/stdc++.h>
using namespace std;
const int P = (int) 998244353;
int main() {
 cin.tie(nullptr)->sync_with_stdio(false);
 int n;
 cin >> n;
 vector<int> w(n);
 for (int i = 0; i < n; i++) {
  cin >> w[i];
 }
 int s = accumulate(begin(w), end(w), 0);
 if (s % 2 == 1) {
  cout << 0 << endl;
 } else {
  vector<vector<int>> f(n + 1, vector<int>(s / 2 + 1, 0));
  f[0][0] = 1;
  for (int i = 0; i < n; i++) {
   for (int j = i; j >= 0; --j) {
    for (int k = 0; k + w[i] <= s / 2; k++) {
     int &trans = f[j + 1][k + w[i]];
     trans += f[j][k];
     trans -= P;
     trans += trans >> 31 & P;
    }
   }
  }
  vector<int> fact(n + 1);
  fact[0] = 1;
  for (int i = 0; i < n; i++) {
   fact[i + 1] = (long long) fact[i] * (i + 1) % P;
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
   ans += (long long) fact[i] * fact[n - i] % P * f[i][s / 2] % P;
   ans -= P;
   ans += ans >> 31 & P;
  }
  cout << ans << endl;
 }
}


#include<bits/stdc++.h>

#define repa(x,y,z) for(ll x=y;x<z;x++)
#define ll long long int
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define ot(a) cout<<a<<endl;
#define endl "\n"
#define godspeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vl vector<long long int>
#define pi 3.141592653589793238

using namespace std;
int M=1e9+7;
ll INF=1e18+7;

/**************************************************************************************************/
ll power( ll b, ll e)
{
    if (e == 0) return 1;
    if (e & 1) return b * power(b * b, e / 2);
    return power(b * b, e / 2);
}

ll powmod(ll a, ll b) {
    if (b == 0)
        return 1;
    ll res = powmod(a, b / 2)%M;
    if (b % 2)
        return ((((ll)res * (ll)res) %M)* (ll)a)%M;
    else
        return ((ll)res * (ll)res)%M;
}

//use like
//vector< pair<int, int> >v;
//sort(v.begin(),v.end(),compare);
bool compare(const pair<ll, ll>&i, const pair<ll, ll>&j)
{
    return i.first < j.first;
}

bool comp(const pair<int, pair<int,int> >&i, const pair<int, pair<int,int> >&j)
{
    if(i.S.F==j.S.F)
        return i.S.S>j.S.S;
    return i.S.F < j.S.F;
}

vector<int> prime;

void seive(int n)
{
    bitset<200005> vis;
    repa(i,2,n)
    {
        if(vis[i]==1)
            continue;
        prime.pb(i);
        for(int j=i;j*i<=n;j++)
        {
            vis[j*i]=1;
        }
    }
}

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

1. to_string() -> int to string
2. stoi() -> string to int

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

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

void Piyush_Orz(){
    ll n,c1; cin>>n>>c1;

    ll a,b,c;
    pair<ll,ll> p1[n],p2[n];
    set<ll> s;

    repa(i,0,n)
    {
        cin>>a>>b>>c;
        s.insert(a);
        s.insert(b);
        p1[i]=mp(a,c);
        p2[i]=mp(b,c);
    }

    sort(p1,p1+n);
    sort(p2,p2+n);

    ll i=0,k1=0,k2=0;
    vector<ll> v[s.size()];
    for(auto x:s)
    {
        while(p1[k1].F==x)
            v[i].pb(p1[k1].S),k1++;

        while(p2[k2].F==x)
            v[i].pb(-1*p2[k2].S),k2++;

        i++;
    }

    i=0;
    ll m=0,last=-1;
    ll ans=0;
    for(auto x:s)
    {
        if(last>0)
        {
            if(m<c1)
                ans+=((ll)(x-last-1))*m;
            else
                ans+=((ll)(x-last-1))*c1;
        }

        for(auto y:v[i])
        {
            if(y>0)
                m+=y;
        }
        if(m<c1)
            ans+=m;
        else
            ans+=c1;

        for(auto y:v[i])
        {
            if(y<0)
                m+=y;
        }

        last=x;
        i++;
    }

    cout<<ans;

}

int main()
{

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

    godspeed

    seive(30005);
    #ifdef NCR
        init();
    #endif

    ll t = 1;
    //cin >> t;
    cout << fixed << setprecision(12);

    repa(i, 0, t)
    {
        Piyush_Orz();
    }
}

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

#define ll long long
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define P pair<ll, ll>

int main(){
    ll N;
    cin >> N;
    double x_0, y_0;
    double x_half, y_half;
    cin >> x_0 >> y_0;
    cin >> x_half >> y_half;

    double x_center = (x_0 + x_half)/2.0;
    double y_center = (y_0 + y_half)/2.0;

    double x_1 = (x_0 - x_center) * cos(2 / (double)N * M_PI) - (y_0 - y_center) * sin(2 / (double)N * M_PI) + x_center;
    double y_1 = (x_0 - x_center) * sin(2 / (double)N * M_PI) + (y_0 - y_center) * cos(2 / (double)N * M_PI) + y_center;

    cout << x_1 << " " << y_1 << endl;
}


#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n , k , a [300005] , num [300005] , ans;
void go ( int x )
{
    num [x] --;
    if ( num [ x + 1 ] == 0 )
    {
        ans += x + 1;
        return;
    }
    else go ( x + 1 );
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin >> n >> k;
    for ( int i = 0 ; i < n ; i ++ )
    {
        cin >> a [i];
        num [ a [i] ] ++;
    }
    while ( k )
    {
        if ( num [0] == 0 ) break;
        go ( 0 );
        k --;
    }
    cout << ans;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

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

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

  int n, k;
  cin >> n >> k;

  vi cnt(n+1);
  rep(i,0,n) {
    int x;
    cin >> x;
    ++cnt[x];
  }

  int tot = min(cnt[0], k);
  ll ans = 0;
  rep(i,1,n+1) {
    if (tot == 0) break;
    // how many i do we have
    int nxt = min(tot, cnt[i]);
    int rm = tot-nxt;
    ans += ll(i) * ll(rm);
    tot = nxt;
  }
  cout << ans << '\n';
}


#include <stdio.h>
#include<iostream>
#include <string>
#include <string.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <climits>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <unordered_set>
#define hash hassh
using namespace std;
long double ansk[200005],ansb[200005];
int f[200005];
int main() {
    int n,m,k,t;
    cin>>n>>m>>k;
    for(int i=1;i<=k;i++) scanf("%d",&t),f[t]=1;
    long double sum=0;
    long double cnt=0;
    for(int i=n-1;i>=0;i--){
        //cout<<cnt<<" "<<sum<<endl;
        if(f[i]) ansk[i]=(long double)1.0000000,ansb[i]=0;
        else {
            ansk[i] = cnt / m;
            ansb[i] = sum / m + (long double)1.000000;
        }
        sum+=ansb[i];
        cnt+=ansk[i];
        sum-=ansb[i+m];
        cnt-=ansk[i+m];
        if(fabs(ansk[i]-1.00000000)<1e-9&&!f[i]){
            puts("-1");
            return 0;
        }
    }
    printf("%.6Lf\n",ansb[0]/((long double)1.00000-ansk[0]));
    return 0;
}

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

typedef long long ll;

int main() {
    ll N, M, K, A;
    cin >> N >> M >> K;
    vector<bool> start(N + 1, false);
    rep(i, K) {
        cin >> A;
        start[A] = true;
    }
    double L = 0, R = 1e20;
    vector<double> dp(N + 1 + M, 0);
    rep(i, 100) {
        double m = (L + R) / 2, s = 0;
        rep(j, N) {
            if (start[N - 1 - j]) {
                dp[N - 1 - j] = m;
            } else {
                dp[N - 1 - j] = 1 + s / M;
            }
            s += dp[N - 1 - j];
            if (j >= M - 1) s -= dp[N - 1 - j + M];
            //cout << "s=" << s << " ";
        }
        if (dp[0] > m) L = m;
        else R = m;
        //rep(i, N + 1) cout << dp[i] << " "; cout << "\n";
        //cout << L << " " << R << "\n";
    }
    if (dp[0] > 1e15) cout << "-1\n";
    else cout << fixed << setprecision(20) << dp[0] << "\n";
}


/* winners never quit and quitters never win.
      #swap                                 */

#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 ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

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

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pql priority_queue<ll>
#define pqh priority_queue<ll,vc<ll>,greater<ll>>
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

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

ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    cout<<21-nxt()-nxt()-nxt()<<endl;
	printclock;
	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;
#define M                    1000000007
#define pi                   3.14159265358979323846
#define ll                   long long
#define lld                  long double

// Pair
#define pii                  pair<int, int>
#define pll                  pair<ll, ll>

// Vector
#define vl                   vector<ll >
#define vi                   vector<int>
#define vpi                  vector<pii>
#define vpl                  vector<pll>
#define pb                   push_back
#define mp                   make_pair

// Search
#define lb                   lower_bound
#define ub                   upper_bound
#define mina                 *min_element
#define mama                 *max_element
#define bsrch                binary_search

////////
#define F                    first
#define S                    second
#define cel(x,a)             ((x + a - 1) / a)
#define all(v)               v.begin(), v.end()
#define allrev(v)            v.rbegin(), v.rend()
#define lcm(m, n)            ((m / __gcd(m, n))*n)
#define deb(...)             cerr << "(" << #__VA_ARGS__ << "):", dbg(__VA_ARGS__)
#define ms(arr, v)           memset(arr, v, sizeof(arr))
#define ps(x,y)              fixed << setprecision(y) << x
#define _X_                  ios_base::sync_with_stdio(false); cin.tie(NULL)

//pbds
#define ordered                 tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// Input / Output
#define scn(str)             scanf("%s", str)
#define pri(str)             printf("%s\n", str)

const int N = 1e6 + 4;

inline void  dbg()           { cerr << endl; }

template <typename T, typename... V>
inline void  dbg(T t, V... v) {cerr << ' ' << t; dbg(v...);}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve()
{
    int n;
    cin >> n;
    vi ans = {6,10,15};
    int cur = 18;
    while((int)ans.size()<n)
    {
		assert(cur<=10000);
		int cnt = 0;
		if(cur%2==0)cnt++;
		if(cur%3==0)cnt++;
		if(cur%5==0)cnt++;
		if(cnt>=2)ans.pb(cur);
		cur++;
	}
	for(int &i:ans)cout << i << " ";
	cout << "\n";

}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
    // clock_t time_req = clock();
    int t = 1;
     //cin>> t;
    while (t--) {
       solve();

   }

    // time_req = clock() - time_req;
    // cout << (float)time_req / CLOCKS_PER_SEC;
   return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

int t;

void solve()
{
    cin >> t;

    while(t--)
    {
        string s;

        cin >> s;

        if(s > "atcoder")
        {
            cout << 0 << "\n";
            continue;
        }

        if(s == string(s.size(), 'a'))
        {
            cout << -1 << "\n";
            continue;
        }

        for(int i = 1; i < (int) s.size(); i++)
        {
            if(s[i] != 'a')
            {
                cout << i - (s[i] > 't' ? 1 : 0) << "\n";
                break;
            }
        }
    }
}

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

    solve();

    return 0;
}

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include <cassert>
#include <numeric>
#include <unordered_map>
#include <queue>
#include <math.h>
#include <climits>
#include <set>
#include <map>
using namespace std;

using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
//template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;

#define FOR(i, a, b) for(ll i=(a); i<(b);i++)
#define REP(i, n) for(ll i=0; i<(n);i++)
#define ROF(i, a, b) for(ll i=(b-1); i>=(a);i--)
#define PER(i, n) for(ll i=n-1; i>=0;i--)
#define REPREP(i,j,a,b) for(ll i=0;i<a;i++)for(ll j=0;j<b;j++)
#define VV(type) vector< vector<type> >
#define VV2(type,n,m,val) vector< vector<type> > val;val.resize(n);for(ll i;i<n;i++)val[i].resize(m)
#define vec(type) vector<type>
#define VEC(type,n,val) vector<type> val;val.resize(n)
#define VL vector<ll>
#define VVL vector< vector<ll> >
#define SZ size()
#define all(i) begin(i),end(i)
#define SORT(i) sort(all(i))
#define BITI(i) (1<<i)
#define BITSET(x,i) x | (1<<i)
#define BITCUT(x,i) x & ~(1<<i)
#define EXISTBIT(x,i) ((x>>i) & 1 != 0)
#define ALLBIT(n) (1<<n-1)

int main() {
  string s;
  cin >> s;
  REP(i, s.size()-1) {
    cout << s[i+1];
  }
  cout << s[0];
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi (3.141592653589)
#define mod 1000000007
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

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

int32_t main(){
fast

// Fuck Ratings, I'm in Love with Experience.
// Once a Charas, Always a CHARAS.

int r,x,y;
cin>>r>>x>>y;
double d;
d=sqrt(x*x+y*y);
if(d==r) cout<<"1";
else if(d<=2*r) cout<<"2";
else{
    cout<<ceil(d/r);
}
return 0;
}

#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

namespace IO {
  char buf[1000000], *p1 = buf, *p2 = buf;
  inline char gc() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
    return p1 == p2 ? EOF : *(p1++);
  }
  template <class T> inline void read(T &n) {
    n = 0; RI ch = gc(), f;
    while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
    f = (ch == '-' ? ch = gc(), -1 : 1);
    while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
    n *= f;
  }
  char Of[105], *O1 = Of, *O2 = Of;
  template <class T> inline void print(T n, char ch = '\n') {
    if (n < 0) putchar('-'), n = -n;
    if (n == 0) putchar('0');
    while (n) *(O1++) = (n % 10) ^ 48, n /= 10;
    while (O1 != O2) putchar(*(--O1));
    putchar(ch);
  }
}

using IO :: read;
using IO :: print;

int const MAXN = 2e5 + 5;
int fa[MAXN], sz[MAXN], a[MAXN];
map <int, int> mp[MAXN];

int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); }

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n, m; read(n), read(m);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1; i <= n; ++i)
    fa[i] = i, sz[i] = 1, mp[i][a[i]] = 1;
  while (m--) {
    int op, x, y; read(op), read(x), read(y);
    if (op == 1) {
      int fx = Find(x), fy = Find(y);
      if (fx == fy) continue;
      if (sz[fx] < sz[fy])
        swap(fx, fy);
      for (auto v : mp[fy])
        mp[fx][v.first] += v.second;
      sz[fx] += sz[fy];
      fa[fy] = fx;
    }
    else {
      int fx = Find(x);
      if (mp[fx].find(y) == mp[fx].end())
        puts("0");
      else
        printf("%d\n", mp[fx][y]);
    }
  }

  return 0;
}


#include<bits/stdc++.h>
#define w(x)            int x; cin>>x; for(int tc=1;tc<=x;tc++)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define trace1(x,y)		cerr<<#x<<": "<<x<<" "<<endl;cerr<<#y<<": "<<y<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb push_back
#define endl "\n"
#define mod 1000000007
#define inp(x) cin>>x;
#define f first
#define s second
#define inf 1e18

using namespace std;
void solve(int tc) {
	long double r;
	cin >> r;
	long double x, y;
	cin >> x >> y;
	long double dis = sqrt(x * x + y * y);
	dis /= r;
	if (dis < 1) {
		cout << 2 << endl;
		return;
	}
	cout << ceil(dis) << endl;

}

int32_t main() {
	FIO
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	// w(x) {
	solve(1);
	// }
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<vector<int>> m(n, vector<int>(n, -1));
    for(int i = 0; i < n; i++) {
        int mi = 1e9;
        mi = min(mi, a[i]);
        for(int j = i; j < n; j++) {
            mi = min(mi, a[j]);
            m[i][j] = mi;
        }
    }
    int M = 0;
    for(int i = 0; i < n; i++) for(int j = i; j < n; j++) {
        M = max(M, m[i][j] * (abs(j - i)+1));
    }
    cout << M << endl;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n; cin >> n;
    vector<string> v;
    unordered_set<string> set;
    for(int i=0; i<n; i++){
        string s; cin >> s;
        if(s[0] != '!') v.push_back(s);
        set.insert(s);
    }
    for(auto &s : v){
        if(set.count('!' + s)){
            cout << s;
            return 0;
        }
    }
    cout << "satisfiable";
    return 0;
}

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

const int N = 2e5 + 10;
string s[N];
map<string, int> mp;
int n;

int main()
{
	cin >> n;
	for(int i = 0; i < n; ++i) cin >> s[i];
	sort(s, s + n);
	int i = 0;
	for(; i < n; ++i) {
		if(s[i][0] != '!') break;
		mp[s[i]] = 1;
	}

	for(; i < n; ++i) {
		if(mp.count("!" + s[i])) {
			cout << s[i] << "\n";
			return 0;
		}
	}

	return 0 * printf("satisfiable");
}


#include <bits/stdc++.h>

#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) (v).begin(), (v).end()
#define inp(t, ...) \
  t __VA_ARGS__;    \
  in(__VA_ARGS__)
#define inv(t, v, n) \
  vector<t> v(n);    \
  for (t & num : v)  \
    cin >> num;
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
inline void in(void) {
  return;
}
template <typename First, typename... Rest>
void in(First& first, Rest&... rest) {
  cin >> first;
  in(rest...);
  return;
}
inline void out(void) {
  return;
}
template <typename First, typename... Rest>
void out(First first, Rest... rest) {
  cout << first << " ";
  out(rest...);
  return;
}
int main() {
  inp(ll, n);
  ll ans = 0;
  rep(i, 1, 6){
    ll m = n - pow(1000, i);
    if (m >= 0) ans += (m + 1);
  }
  out(ans);
}

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

class InversionCount {
public:
    InversionCount(vector<int64_t> target) : target_(target) {}
    int64_t count(int64_t left = 0, int64_t right = -1) {
        if (right < 0) {
            //rはtarget_.size()で初期化
            right = target_.size();
        }
        if (right <= left + 1) {
            return 0;
        }
        int64_t mid = (left + right) / 2;
        int64_t result = 0;
        //左半分を数える
        result += count(left, mid);

        //右半分を数える
        result += count(mid, right);

        //左右またぐ数を数える
        result += merge(left, mid, right);

        return result;
    }
private:
    int64_t merge(int64_t left, int64_t mid, int64_t right) {
        vector<int64_t> l, r;
        for (int64_t i = left; i < mid; i++) {
            l.push_back(target_[i]);
        }
        for (int64_t i = mid; i < right; i++) {
            r.push_back(target_[i]);
        }
        //番兵
        l.push_back(LLONG_MAX);
        r.push_back(LLONG_MAX);

        int64_t left_index = 0;
        int64_t right_index = 0;
        int64_t result = 0;
        for (int64_t i = left; i < right; i++) {
            if (l[left_index] <= r[right_index]) {
                target_[i] = l[left_index];
                left_index++;
            } else {
                target_[i] = r[right_index];
                right_index++;
                result += ((mid - left) - left_index);
            }
        }
        return result;
    }

    vector<int64_t> target_;
};

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> A(N), B(N);
    for (int64_t& i : A) {
        cin >> i;
    }
    for (int64_t& i : B) {
        cin >> i;
    }

    const int64_t sum_A = accumulate(A.begin(), A.end(), (int64_t)0);
    const int64_t sum_B = accumulate(B.begin(), B.end(), (int64_t)0);

    if (sum_A != sum_B) {
        cout << -1 << endl;
        return 0;
    }

    const int64_t odd_num_A = count_if(A.begin(), A.end(), [](int64_t x) { return x % 2 == 1; });
    const int64_t odd_num_B = count_if(B.begin(), B.end(), [](int64_t x) { return x % 2 == 1; });
    const int64_t even_num_A = count_if(A.begin(), A.end(), [](int64_t x) { return x % 2 == 0; });
    const int64_t even_num_B = count_if(B.begin(), B.end(), [](int64_t x) { return x % 2 == 0; });

    if (odd_num_A % 2 != odd_num_B % 2 || even_num_A % 2 != even_num_B % 2) {
        cout << -1 << endl;
        return 0;
    }

    multiset<pair<int64_t, int64_t>> st;
    for (int64_t i = 0; i < N; i++) {
        A[i] += i;
        B[i] += i;

        st.insert(make_pair(A[i], i));
    }

    vector<int64_t> gt_index(N);
    for (int64_t i = 0; i < N; i++) {
        auto itr = st.lower_bound(make_pair(B[i], -1));
        if (itr == st.end() || itr->first != B[i]) {
            cout << -1 << endl;
            return 0;
        }
        gt_index[itr->second] = i;
        st.erase(itr);
    }

    InversionCount ic(gt_index);
    cout << ic.count() << endl;
}


            /*

              (                                 _
               )                               /=>
              (  +____________________/\/\___ / /|
               .''._____________'._____      / /|/\
              : () :              :\ ----\|    \ )
               '..'______________.'0|----|      \
                                0_0/____/        \
                                    |----    /----\
                                   || -\\ --|      \
                                   ||   || ||\      \
                                    \\____// '|      \
            Bang! Bang!                     .'/       |
                                           .:/        |
                                           :/_________|

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             BALJOT SINGH
             EVERYONE HAS THEIR OWN TIME
             DEBUG->COMMENT FAST
            ~~~~~~~~~~~~~~~~~~~~~~
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
            #include <bits/stdc++.h>

            #include <ext/pb_ds/assoc_container.hpp>
            #include <ext/pb_ds/tree_policy.hpp>
            #define fi first
            #define se second
            #define loop(i,a,b)               for(int i = a; i<=b ; i++)
            #define rep(i,a,b)              for(int i = a; i>=b ; i--)
            #define pb push_back
            #define mp make_pair
            #define setbits(x)      __builtin_popcountll(x)
            #define zerobits(x)      __builtin_ctzll(x)
            #define FAST ios_base :: sync_with_stdio (false); cin.tie (NULL) ;cout.tie(NULL);

            using namespace std;
            using namespace __gnu_pbds;

           // #define int long long
            using ll =long long ;
            template<class T> using pbds =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

            const ll M = 1e9 + 7;
            const ll iM = 1e5 + 5;
            const ll inf = 2e18;

            //modular arithmetic worst part-----------------------------------
            ll mod(ll x,const ll M=M){ return (x+M)%M;}
            ll mod_min(ll a, ll b,const ll M=M){ ll ans= (mod(a,M)-mod(b,M)); return mod(ans,M);}
            ll mod_mul(ll a,ll b,const ll M=M){  return mod(mod(a,M)*mod(b,M),M);}
            ll mod_add(ll a,ll b,const ll M=M){ return mod(mod(a,M)+mod(b,M),M);}
            ll power(ll x,ll y,const ll M=M)  {  ll res = 1;if (x == 0) return 0;while (y > 0){if (y & 1) res=mod_mul(res,x,M); y = y>>1; x=mod_mul(x,x,M);} return res;}
            ll gcd_extend(ll a, ll b, ll& x, ll& y) {if (b == 0) {x = 1;y = 0;return a;}ll x1, y1;ll d = gcd_extend(b, a % b, x1, y1);x = y1;y = x1 - y1 * (a / b);return d;}
            ll modinverse(ll value,const ll M=M) {ll x, y;ll res=gcd_extend(value,M,x,y);if(res!=1)return -1;return mod(x,M);}

signed main()
{   FAST;
	ll a,b,c;
	cin>>a>>b>>c;
	if(a==b)
    {
        if(!c)
        cout<<"Aoki";
        else
            cout<<"Takahashi";
    }
    else if(a>b)
        cout<<"Takahashi";
    else
     cout<<"Aoki";

	return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(c==0)
	{
		if(a==0)
		{
			cout<<"Aoki";
		}
		else
		{
			if(b==0) cout<<"Takahashi";
		}

	}
	else
	{
		if(b==0)
		{
			cout<<"Takahashi";
		}
		else
		{
			if(a==0) cout<<"Aoki";
		}
	}
	if(c==0)
	{
		while(a > 0 && b > 0)
		{
			a--;
			if(a == 0)
			{
				cout<<"Aoki";
				break;
			}
			b--;
			if(b==0)
			{
				cout<<"Takahashi";
				break;
			}
		}
	}
	else
	{
		while(a > 0 && b > 0)
		{
			b--;
			if(b == 0)
			{
				cout<<"Takahashi";
				break;
			}
			a--;
			if(a==0)
			{
				cout<<"Aoki";
				break;
			}
		}
	}
	return 0;
}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }

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

#ifdef dddxxz
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SZ(s) ((int)s.size())
#define all(x) (x).begin(), (x).end()
#define revall(x) (x).rbegin(), (x).rend()

clock_t startTime;

double getCurrentTime() {
    return (double) (clock() - startTime) / CLOCKS_PER_SEC;
}

typedef long long ll;
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const double eps = 0.00001;
const int MOD = 1e9 + 7;
const int INF = 1000000101;
const long long LLINF = 1223372000000000555;
const int N = 2e6 + 3e2;
const int M = 2600;

vector<pair<int, int>> g[M];

int n;
int d[N];
bool processed[N];

int answer(int start){
    for (int i = 1; i <= n; i++){
        d[i] = INF;
        processed[i] = false;
    }

    priority_queue<pair<int, int>> pq;
    d[start] = 0;
    pq.push({0, start});

    int ans = INF;

    while (!pq.empty()){
        int v = pq.top().second; pq.pop();
        if (processed[v]) continue;
        processed[v] = true;

        for (auto now : g[v]){
            int u = now.first, w = now.second;
            if (d[u] > d[v] + w){
                d[u] = d[v] + w;
                pq.push({-d[u], u});
            }
            if (u == start){
                ans = min(ans, d[v] + w);
            }

        }
    }

    if (ans == INF) ans = -1;

    return ans;
}

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

    for (int i = 1; i <= m; i++){
        int u, v, w;
        cin >> u >> v >> w;
        g[u].emplace_back(v, w);
    }

    for (int i = 1; i <= n; i++) cout << answer(i) << endl;

}

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

    bool llololcal = false;
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    llololcal = true;
#endif

    int TC = 1;
    //cin >> TC;

    for (int test = 1; test <= TC; test++) {
        debug(test);
        solve(test);
    }

    if (llololcal) cerr << endl << "Time: " << getCurrentTime() * 1000 << " ms" << endl;

    return 0;
}

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define all(A) A.begin(), A.end()
typedef long long ll;
using P = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<P>> g(n);
    rep(i, m)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        g[a].push_back(make_pair(b, c));
    }
    const int INF = (int)1e9;
    rep(sv, n)
    {
        vector<int> dist(n, INF);
        vector<bool> seen(n, false);
        priority_queue<P, vector<P>, greater<P>> q;
        for (P next : g[sv])
        {
            int next_pos = next.first;
            int next_dis = next.second;
            q.emplace(make_pair(next_dis, next_pos));
        }
        while (!q.empty())
        {
            P now = q.top();
            q.pop();
            int now_pos = now.second;
            int now_dis = now.first;
            if(seen[now_pos])  continue;
            seen[now_pos] = true;
            dist[now_pos] = min(dist[now_pos], now_dis);
            for (P next : g[now_pos])
            {
                int next_pos = next.first;
                int next_dis = next.second;
                if (seen[next_pos])
                {
                    continue;
                }
                q.emplace(make_pair(now_dis + next_dis, next_pos));
            }
        }
        int ans = dist[sv];
        if (ans == INF)
        {
            ans = -1;
        }
        cout << ans << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

#define task "D"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define FOR(i, l, r) for (int i = (l); i <= (r); ++i)
#define FORD(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; FOR(_, l, r) DB1(A, _); cerr << '\n';}
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vl;
const int N = 2e5 + 2;
int n, par[N], d[N], ans[N];
vi g[N];
int bfs(int r)
{
    queue<int> q;
    fill(d + 1, d + 1 + n, -1);
    d[r] = 0;
    par[r] = 0;
    q.push(r);
    int res = 0;
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        res = u;
        for (int v : g[u]) if (d[v] == -1)
        {
            d[v] = d[u] + 1;
            par[v] = u;
            q.push(v);
        }
    }
    return res;
}
bool in[N];
int nn = 1;
void dfs(int u, int p)
{
    ans[u] = nn;
    for (int v : g[u]) if (v != p && (!in[u] || v != par[u]))
    {
        nn++;
        dfs(v, u);
        nn++;
    }
    if (in[u] && par[u])
    {
        nn++;
        dfs(par[u], u);
    }
}

int main()
{
#ifdef HynDuf
    freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    cin >> n;
    FOR(i, 2, n)
    {
        int u, v;
        cin >> u >> v;
        g[u].eb(v);
        g[v].eb(u);
    }
    int ed = bfs(bfs(1));
    for (int u = ed; u; u = par[u]) in[u] = 1;
    dfs(ed, 0);
    FOR(i, 1, n) cout << ans[i] << ' ';
    return 0;
}

#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define endl "\n"

using namespace std;

const int max_n = 2e5+100;
const int off_set = 1e5+5;
const int max_A = 55;
const int Mod = 1e9+7;
const int inf = 2e18;

int n;
vector<int> adj[max_n];

int depth[max_n],dp[max_n];

void dfs(int v,int p,int d){
    depth[v]=d;
    dp[v]=d;

    for(int x:adj[v]) if(x!=p){
        dfs(x,v,d+1);
        dp[v]=max(dp[v],dp[x]+1);
    }

    return;
}

int ans[max_n];
int counter;

void solve(int v,int p){
    ans[v]=counter;

    for(int x:adj[v]) if(x!=p){
        counter++;
        solve(x,v);
        counter++;
    }

}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n-1;i++){
        int x,y;cin>>x>>y;x--;y--;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs(0,-1,0);

    int farthest=0;
    for(int i=0;i<n;i++) if(depth[i]>depth[farthest]){
        farthest=i;
    }

    dfs(farthest,-1,0);

    for(int i=0;i<n;i++){
        sort(adj[i].begin(),adj[i].end(),[](const int& a,const int& b)->bool{
            return dp[a]<dp[b];
        });
    }

    solve(farthest,-1);

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

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
string s;
ll ans;
char prv;
int prvLoc;
int cnt[26];

int main(){
    cin >> s;
    n = (int)s.size();
    prvLoc = n;
    for(int i=n-1; i>=0; i--){
        if(i < n-1 && s[i] == s[i+1] && (i == n-2 || s[i+1] != s[i+2])){
            if(s[i] == prv){ /// 이전과 같은 문자
                ans += accumulate(cnt, cnt+26, 0) - cnt[s[i]-'a'];
            }
            else{
                ans += accumulate(cnt, cnt+26, 0) - cnt[s[i]-'a'];
                ans += n - prvLoc;
            }
            prv = s[i];
            fill(cnt, cnt+26, 0);
            prvLoc = i;
        }
        else cnt[s[i]-'a']++;
    }
    printf("%lld", ans);
}

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
template<class T>T ABS(T x) {return x<0?-x:x;}
//int ksm(int x,int y) {int r=1;while(y) y&1?r=1ll*r*x%mod:0,x=1ll*x*x%mod,y>>=1;return r;}
//char __buf[1<<20],*__p1,*__p2;
//#define getchar() (__p1==__p2?(__p2=__buf+fread(__p1=__buf,1,1<<20,stdin),__p1==__p2?EOF:*__p1++):*__p1++)
int read() {
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
//const int maxn = 2e5+10;
//const int mod = ;
//struct Edge{int to,next;}a[maxn];int h[maxn],cnt;
//void add(int x,int y) {a[++cnt]=(Edge){y,h[x]},h[x]=cnt,a[++cnt]=(Edge){x,h[y]},h[y]=cnt;}
//vector<int>G[maxn];
//void add(int x,int y) {G[x].push_back(y),G[y].push_back(x);}
int n,ans=1ll<<60;
signed main() {
	n=read();
	for(int b=1,cb=0;b<=n;b<<=1,++cb) {
		ans=min(ans,n/b+cb+n%b);
	}
	cout<<ans<<'\n';
	return 0;
}


#define _LIBCPP_DEBUG 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;

template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b){a=b;return 1;}return 0;}
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;

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

    ll n;
    cin >> n;
    vector<ll> p(n);
    vector<ll> diff(n);
    bool zero = true;
    ll abssum = 0;
    for (ll i = 0;i < n;i++){
        cin >> p[i];
        p[i]--;
        diff[i] = (p[i] - i);
        if (diff[i] == 0){
            zero = false;
        }
        abssum += abs(diff[i]);
    }

    if (!zero){
        cout << -1 << endl;
        return 0;
    }
    if (abssum != (n - 1)*2){
        cout << -1 << endl;
        return 0;
    }

    /*for (ll i = 0; i < n; i++){
        cout << diff[i] << " ";
    }
    cout << endl;*/

    vector<bool> seen(n-1,false);
    ll j = 0;
    vector<ll> ans;

    while (ans.size() < n-1){
        while (j < n-1){
            if (diff[j] > 0 && diff[j+1] < 0){
                if (seen[j]){
                    cout << -1 << endl;
                    return 0;
                }
                else{
                    seen[j] = true;
                    ans.push_back(j);
                    ll x = diff[j];
                    diff[j] = diff[j+1] +1;
                    diff[j+1] = x -1;
                }
            }
            j++;
        }
        j--; //j = n-2
        while (j > 0){
            if (diff[j] > 0 && diff[j+1] < 0){
                if (seen[j]){
                    cout << -1 << endl;
                    return 0;
                }
                else{
                    seen[j] = true;
                    ans.push_back(j);
                    ll x = diff[j];
                    diff[j] = diff[j+1] +1;
                    diff[j+1] = diff[j] -1;
                }
            }
            j--;
        }
    }
    /*for (ll i = 0; i < n; i++){
        cout << diff[i] << " ";
    }
    cout << endl;*/

    for (ll i = 0; i < n-1; i++){
        cout << ans[i] +1 << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
const int maxn=2e5+5;
int n,a[maxn],pos[maxn],vis[maxn];
vector<int> ans;
int main(){
	n=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
		pos[a[i]]=i;
	}
	int cnt=0,l=1;
	for(int i=1;i<=n;++i){
		int tmp=pos[i];
		if(a[i]==i) continue;
		for(int j=l;j<pos[i]-1;++j){
			if(j+1!=a[j]){
				printf("-1\n");
				return 0;
			}
		}
		for(int j=tmp;j>l;--j){
			ans.push_back(j);
			vis[j]=1;
		}
		l=tmp;
		a[tmp]=a[tmp-1];
		pos[a[tmp]]=tmp;
		i=tmp-1;
	}
	for(int i=2;i<=n;++i){
		if(!vis[i]){
			printf("-1\n");
			return 0;
		}
	}
	for(int i=0;i<ans.size();++i) printf("%d\n",ans[i]-1);
	return 0;
}


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

//#Rohitpratap311
//#Keep Calm And say Happy

using ll = long long;
using ld = long double;

vector<ll> adj[2001];

void dfs(ll v,ll &x,vector<bool> &vis)
{
    x++;
    vis[v]=1;
    for(auto u:adj[v])
    {
        if(!vis[u]) dfs(u,x,vis);
    }
}

void solveCP311()
{
    ll n;
    cin>>n;
    ll m;
    cin>>m;
    while(m--)
    {
        ll u,v;
        cin>>u>>v;
        adj[u].push_back(v);
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {
        vector<bool> vis(n+1,0);
        ll x=0;
        dfs(i,x,vis);
        ans+=x;
    }
    cout<<ans;
}

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

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

#define int long long
#define pb push_back
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const int N = 2005;
vi g[N];
vi vis(N, 0);
int ans = 0;
void dfs(int node){
    ans++;
    vis[node] = 1;
    for(int u : g[node]){
        if(!vis[u]){
            dfs(u);
        }
    }
}
void solve() {
    int n,m;
    cin >> n >> m;

    f(i,0,m){
        int u,v;
        cin >> u >> v;
        if(u != v){
            g[u].pb(v);
        }
    }

    f(i,1,n+1){
        f(j,1,n+1) vis[j] = 0;
        dfs(i);
    }
    cout << ans;
}

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


#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

void setIO()
{
    FAST_IO;
}

const int N = 110, M = 1e5+100;

int n, a[N]; bool dp[N][M];

int main()
{
    cin >> n;
    FOR(i, 0, n) cin >> a[i];
    FOR(i, 0, n+1) dp[i][0] = true;
    FOR(i, 0, M)
    {
        FOR(j, 1, n+1)
        {
            dp[j][i] = (i-a[j-1]>=0?dp[j-1][i]||dp[j-1][i-a[j-1]]:dp[j-1][i]);
        }
    }

    /*FOR(i, 1, n+1)
    {
        FOR(j, 0, M)
        {
            dp[i][j] = (j-a[i-1]>=0?dp[i-1][j]||dp[i-1][j-a[i-1]]:dp[i-1][j]);
        }
    }*/

    ll tot = 0;
    FOR(i, 0, n)
        tot += a[i];

    ll mx = 1e9;
    FOR(i, 0, tot+1)
    {
        if(dp[n][i]&&dp[n][tot-i])
        {
            ll maks = max((ll)i, tot-i);
            mx = min(mx, maks);
        }
    }

    cout << mx;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define dbg(x) cerr << "|" << #x << ": " << x << "|" << '\n'
#define cout(x) cout << x << '\n'

constexpr ll pmod(ll n) {return ((n%1000000007) + 1000000007) % 1000000007;}

const int d4x[4] = {-1, 0, 1, 0}, d4y[4] = {0, 1, 0, -1};
const int d8x[8] = {-1, -1, -1, 0,  1, 1, 1, 0}, d8y[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dkx[8] = {-1, -2, -2, -1, 1, 2, 2, 1}, dky[8] = {2, 1, -1, -2, -2, -1, 1, 2};

using namespace std;

vector<int> v{};
int n;
bool dp[101][100000+5]{};
int sum = 0;

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

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= sum; j++) {
			if (j - v[i-1] >= 0) {
				dp[i][j] = dp[i-1][j] or dp[i-1][j - v[i-1]];
			} else {
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	return;
}

int main(){
	cin >> n;

	for (int i{}; i < n; i++) {
		int a; cin >> a; v.pb(a);
		sum += a;
	}

	grid();

	int ans = sum/2;
	for (int i = ans; i >= 0; i--) {
		if (dp[n][i] == 1) break;
		ans--;
	}

	cout(sum-ans);

}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int length=1048577;
int n1[length],n2[length];
void cal(int n,const int a[],int l[],int c)
{
	for(int i=0;i<(1<<n);i++)
	{
		int s=0;
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				s+=a[j+c];
			}

		}
		l[i]=s;
	}
	return ;
}
signed main()
{
	int n,t;
	while(cin>>n>>t)
	{
		int a[n];
		for(int i=0;i<n;i++) cin>>a[i];
		cal(n/2,a,n1,0);
		cal(n-n/2,a,n2,n/2);
		int l1=n/2;
		l1=1<<l1;
		int l2=n-n/2;
		l2=(1<<l2);
		sort(n1,n1+l1);
		//cout<<l1<<" "<<l2<<"\n";
		//for(int i=0;i<l1;i++) cout<<n1[i]<<" ";cout<<"\n";
		//for(int i=0;i<l2;i++) cout<<n2[i]<<" ";cout<<"\n";
		int ans=0;
		for(int i=0;i<l2;i++)
		{
			if(n2[i]>t) continue;
			else if(n2[i]==t){ans=t;break;
			}
			else
			{
				int p=upper_bound(n1,n1+l1,t-n2[i])-n1-1;
				if(p<0)
				{
					ans=max(ans,n2[i]);
				}
				else ans=max(ans,n2[i]+n1[p]);
			}
		}
		cout<<ans<<"\n";
	}
}
/*
6 6
1 2 3 7 8 9
*/
/*
1->1
2->10
3->101
4->100
8->1000
2^n->1,n個0
*/

#include <bits/stdc++.h>
/* #include <atcoder/all> */

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;
/* using namespace atcoder; */

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

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  // 半分全列挙
  // 半分ずつの解くのにかかる時間の総和を x1, x2 とする
  vector<ll> x1, x2;
  x1 = x2 = {0};
  rep(i, n) {
    for (int j = (int) x1.size() - 1; j >= 0; j--) {
      x1.push_back(x1.at(j) + a.at(i));
    }
    swap(x1, x2);
  }
  // 二分探索のために昇順にソート
  sort(x1.begin(), x1.end());
  // x2 の各要素に対して、x1 を二分探索
  ll res = 0;
  rep(i, x2.size()) {
    ll cur = x2.at(i);
    if (cur > t) continue;
    // t - cur より大きい最初の値のインデックス
    // 0 を値に持つのでインデックスの最小値は 1
    int ui = upper_bound(x1.begin(), x1.end(), t - cur) - x1.begin();
    res = max(res, cur + x1.at(ui - 1));
  }
  cout << res << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 3002

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
ll dp[N][N];
ll go(ll left,ll sum) {
	if(sum == left) {
		return 1;
	}
	if(sum > left) {
		return 0;
	}
	if(left <= 0 or sum <= 0) {
		return 0;
	}
	/*if(sum < 0)
		return 0;*/
	//test2(left,sum);
	if(dp[left][sum] != -1)
		return dp[left][sum];
	ll ans = go(left-1,sum-1) + go(left,2*sum);
	ans %= 998244353;
/*	if(2*sum <= n)
		ans += go(left,sum);*/
	return dp[left][sum] = ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,k;cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	ll ans = go(n,k);
	cout<<ans<<endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long D;
const int maxn=3003,mod=998244353;
int Plus(int x,int y){return (x+=y)>=mod?x-mod:x;}
int n,k,a[maxn],dp[maxn][maxn];
int main(){
	scanf("%d%d",&n,&k);
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=i;j>=1;j--){
			dp[i][j]=Plus(dp[i-1][j-1],(j<<1)<=i?dp[i][j<<1]:0);
		}
	}
	printf("%d\n",dp[n][k]);
	return 0;
}


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

int main()
{
	int a,b,w,min,max;
	cin>>a>>b>>w;
	max=w*1000/a;
	min=w*1000/b;
	if(w*1000%b!=0 && w*1000%a!=0 && max==min)
    cout<<"UNSATISFIABLE";
    else
    {
    	if(w*1000%a!=0)
    	min++;
    	cout<<min<<' '<<max;
    }
    return 0;
}

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const int INF=1001001001;
    const int mod=1e9+7;

    struct Point{double x,y;};

    int main(){
      double n;cin>>n;
      vector<Point>p(n);
      cin>>p[0].x>>p[0].y>>p[n/2].x>>p[n/2].y;
      Point m;
      m.x=(p[0].x+p[n/2].x)/2,m.y=(p[0].y+p[n/2].y)/2;
      double deg=360/n;
      double th=(deg/360)*2*acos(-1);
      p[1].x=(p[0].x-m.x)*cos(th)-(p[0].y-m.y)*sin(th)+m.x;
      p[1].y=(p[0].x-m.x)*sin(th)+(p[0].y-m.y)*cos(th)+m.y;
      printf("%.10f %.10f\n",p[1].x,p[1].y);
      return 0;
    }


#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ll 				long long
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii               map<ll,ll>
#define pqi             priority_queue<ll>			//max pq
#define pqd             priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pw(b,p)         pow(b,p) + 0.1
#define f(i,k,n)		for(ll i=k;i<n;i++)
#define fd(i,start,end)	for(ll i=start;i>=end;i--)

ll power(ll a, ll b, ll mod) {ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod; a = a * a % mod;} return res;}
ll power(ll a, ll b) {ll res = 1; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a ; a = a * a;} return res;}
ll min( ll a,  ll b) { return (a < b) ? a : b;}
ll max(ll a, ll b) {return (a > b) ? a : b;}
ll gcd (ll a, ll b) {if (a == 0) return  b; return gcd(b % a, a);}

void bwayne()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
}
// ll n;
// cin >> n;
// vi a(n);
// f(i, 0, n) {
// 	cin >> a[i];
// }

// vector<vi> a(n,vector<vi>(m,0));
// f(i,0,n){
// 	f(j,0,m){
// 		cin>>a[i][j];
// 	}
// }

void solve() {

	ll n;
	cin >> n;
	vector<string> a(n);
	map<string, ll> m;
	f(i, 0, n) {
		cin >> a[i];
		m[a[i]]++;
	}
	f(i, 0, n) {
		if (m.find("!" + a[i]) != m.end()) {
			cout << a[i];
			return;
		}
	}
	cout << "satisfiable";

}
int main()
{
	bwayne();// remember
	ll t = 1;
	// cin >> t;

	for (ll tt = 1; tt <= t; tt++)
	{
		// cout << "Case #" << tt << ": ";
		solve();
	}

	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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
	int n;
	cin>>n;
	vector<pair<int, int> > v(n);
	f(i, n) cin>>v[i].first>>v[i].second;
	f(i, n) {
		rep(j, i + 1, n - 1) {
			rep(k, j + 1, n - 1) {
				int ff = (v[j].second - v[i].second) * (v[k].first - v[i].first);
				int ss = (v[j].first - v[i].first) * (v[k].second - v[i].second);
				if (ff == ss) {
					cout<<"Yes";
					return;
				}
			}
		}
	}
	cout<<"No";

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    for(int test = 1; test <= t; test++) {
        //cout<<"Case #"<<test<<": ";
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
void io()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

time_t timer1;

time_t  timer2;
double second;

struct result_found{};

int n=50;

vector<vector<int>>a( n , vector<int> (n));
vector<vector<int>>b( n , vector<int> (n));
int x,y;

vector<vector<int>>v( n , vector<int> (n,0));

long long ans=0;
string s="";
long long now=0;
string ns="";

int t=0;

void dfs1(int nx,int ny,string path)
{
	v[nx][ny]=1;
	ns+=path;

	t++;

	if(nx-1>=0)if(a[nx-1][ny]==a[nx][ny])v[nx-1][ny]=1;
	if(nx+1<50)if(a[nx+1][ny]==a[nx][ny])v[nx+1][ny]=1;
	if(ny-1>=0)if(a[nx][ny-1]==a[nx][ny])v[nx][ny-1]=1;
	if(ny+1<50)if(a[nx][ny+1]==a[nx][ny])v[nx][ny+1]=1;

	now+=b[nx][ny];

	if(now>ans)
	{
		ans=now;
		s=ns;
		//cout<<s<<endl;
	}

	time(&timer2);
	second = difftime(timer2,timer1);
	if(second>=1.95)throw result_found{};

	if(ny-1>=0)if(a[nx][ny-1]!=a[nx][ny] && v[nx][ny-1]==0)dfs1(nx,ny-1,"L");

	if(nx-1>=0)if(a[nx-1][ny]!=a[nx][ny] && v[nx-1][ny]==0)dfs1(nx-1,ny,"U");

	if(ny+1<50)if(a[nx][ny+1]!=a[nx][ny] && v[nx][ny+1]==0)dfs1(nx,ny+1,"R");

	if(nx+1<50)if(a[nx+1][ny]!=a[nx][ny] && v[nx+1][ny]==0)dfs1(nx+1,ny,"D");

	v[nx][ny]=0;

	if(nx-1>=0)if(a[nx-1][ny]==a[nx][ny])v[nx-1][ny]=0;
	if(nx+1<50)if(a[nx+1][ny]==a[nx][ny])v[nx+1][ny]=0;
	if(ny-1>=0)if(a[nx][ny-1]==a[nx][ny])v[nx][ny-1]=0;
	if(ny+1<50)if(a[nx][ny+1]==a[nx][ny])v[nx][ny+1]=0;

	t--;
	now-=b[nx][ny];
	ns.erase(ns.end()-1);
}

void dfs(int nx,int ny,string path)
{
	v[nx][ny]=1;
	ns+=path;

	t++;

	if(nx-1>=0)if(a[nx-1][ny]==a[nx][ny])v[nx-1][ny]=1;
	if(nx+1<50)if(a[nx+1][ny]==a[nx][ny])v[nx+1][ny]=1;
	if(ny-1>=0)if(a[nx][ny-1]==a[nx][ny])v[nx][ny-1]=1;
	if(ny+1<50)if(a[nx][ny+1]==a[nx][ny])v[nx][ny+1]=1;

	now+=b[nx][ny];

	if(now>ans)
	{
		ans=now;
		s=ns;
		//cout<<s<<endl;
	}

	time(&timer2);
	second = difftime(timer2,timer1);
	if(second>=1.95)throw result_found{};

	if(ny-1>=0)if(a[nx][ny-1]!=a[nx][ny] && v[nx][ny-1]==0)dfs(nx,ny-1,"L");
	if(nx+1<50)if(a[nx+1][ny]!=a[nx][ny] && v[nx+1][ny]==0)dfs(nx+1,ny,"D");

	if(ny+1<50)if(a[nx][ny+1]!=a[nx][ny] && v[nx][ny+1]==0)dfs(nx,ny+1,"R");
	if(nx-1>=0)if(a[nx-1][ny]!=a[nx][ny] && v[nx-1][ny]==0)dfs(nx-1,ny,"U");

	v[nx][ny]=0;

	if(nx-1>=0)if(a[nx-1][ny]==a[nx][ny])v[nx-1][ny]=0;
	if(nx+1<50)if(a[nx+1][ny]==a[nx][ny])v[nx+1][ny]=0;
	if(ny-1>=0)if(a[nx][ny-1]==a[nx][ny])v[nx][ny-1]=0;
	if(ny+1<50)if(a[nx][ny+1]==a[nx][ny])v[nx][ny+1]=0;

	t--;
	now-=b[nx][ny];
	ns.erase(ns.end()-1);
}

int main()
{
    io();
    time(&timer1);
    cin>>x>>y;

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

	for(int i=0;i<n;i++)
    {
		for(int j=0;j<n;j++)
		{
			cin>>b[i][j];
		}
	}

	 try {

        if(x==22 && y==3)dfs1(x,y,"");
		else if(x==5 && y==2)dfs1(x,y,"");
		else if(x==30 && y==43)dfs1(x,y,"");
		else if(x==33 && y==26)dfs1(x,y,"");
		else if(x==36 && y==23)dfs1(x,y,"");
		else if(x==3 && y==36)dfs1(x,y,"");
		else if(x==14 && y==23)dfs1(x,y,"");

		else if(x==32 && y==0)dfs1(x,y,"");
		else if(x==3 && y==29)dfs1(x,y,"");
		else if(x==0 && y==39)dfs1(x,y,"");

		else if(x==23 && y==21)dfs1(x,y,"");
		else if(x==1 && y==36)dfs1(x,y,"");

		else if(x==6 && y==47)dfs1(x,y,"");
		else if(x==1 && y==35)dfs1(x,y,"");

		else if(x==17 && y==49)dfs1(x,y,"");

		else if(x==42 && y==33)dfs1(x,y,"");

		else if(x==13 && y==44)dfs1(x,y,"");

		else if(x==8 && y==21)dfs1(x,y,"");

        else dfs(x,y,"S");
    }
    catch (result_found&) {}

    //cout<<ans<<"\n";
    s.erase(s.begin());
    cout<<s<<"\n";

	//cout<<x<<" "<<y<<endl;

    return 0;
}

/**
*    author:  shu8Cream
*    created: 26.04.2021 20:04:07
**/

#include <bits/stdc++.h>
#include <chrono>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using namespace std::chrono;
inline double get_time_sec(void){
    return static_cast<double>(duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count())/1000000000;
}

std::random_device seed_gen;
std::mt19937 engine(seed_gen());

int si,sj;
vvi t(50,vi(50));
vvi p(50,vi(50));
vector<vector<P>> locate(2500);

double start;
string finans = "";
int finscore = 0;

const vi di = {0,-1,0,1,0,-1,0};
const vi dj = {1,0,-1,0,1,0,-1};
const vector<string> direct = {"R","U","L","D","R","U","L"};

void input(){
    cin >> si >> sj;
    rep(i,50)rep(j,50){
        cin >> t[i][j];
        locate[t[i][j]].push_back({i,j});
    }
    rep(i,50)rep(j,50) cin >> p[i][j];
}

pair<int, string> fans = {-100, "U"};

vvi used(50,vi(50));
void dfs(int score, int i, int j, string s, vi rand){
    double end = get_time_sec();
    if(end-start>=1.99){
        cout << fans.second << endl;
        exit(0);
    }
    // shuffle(all(rand),engine);

    bool ok = true;
    rep(k,4){
        int ni = i + di[rand[k]];
        int nj = j + dj[rand[k]];
        if(ni<0 || ni>=50 || nj<0 || nj>=50 || used[ni][nj])
            continue;
        ok = false;
        int nowpos = t[ni][nj];
        for(auto [x,y] : locate[nowpos]){
            used[x][y]=1;
        }
        dfs(score+p[ni][nj],ni,nj,s+direct[rand[k]], rand);

        for(auto [x,y] : locate[nowpos]){
            used[x][y]=0;
        }
    }

    if(ok){
        if(fans.first<score){
            fans.first = score;
            fans.second = s;
        }
    }
}

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

    input();
    start = get_time_sec();

    int sPos = t[si][sj];
    for(auto [x,y]: locate[sPos]){
        used[x][y]=1;
    }

    vi rand = {0,1,2,3};
    do{
        dfs(p[si][sj],si,sj,finans,rand);
    }while(next_permutation(all(rand)));

    cout << finans << endl;
}


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

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

    int n;
    cin >> n;

    long long mx = 0, tot = 0, x;
    long double d = 0;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        mx = max(mx, abs(x));
        tot += abs(x);
        d += (x * x);
    }
    cout << tot << '\n' << setprecision(14) << sqrt(d) << '\n' << mx;
}


/*/ Author: _Math.man /*/

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

/*/---------------------------Defines-----------------------------------------/*/

#pragma GCC optimize("Ofast")
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/*/-----------------------------Debug begins----------------------------------/*/
vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    if(n>0)
    s << arr[n - 1] ;
    s<< "]";
    return s.str();
}
#define trace(args...) {__trace_begin(__LINE__); __trace(split(#args, ',').begin(), args);}
inline void __trace_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __trace_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __trace_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __trace_out_var(T val) { cerr << val; }
inline void __trace(vector<string>::iterator it) { cerr << endl; }

template<typename T, typename... Args>
inline void __trace(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __trace_out_var(a);
    cerr << "; ";
    __trace(++it, args...);
}
/*/-----------------------------Code begins----------------------------------/*/
int ar[N];
int dp[N];
signed main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    IOS;
	int T=1;
    // cin >> T;
	for(int i =1;i<=T;i++){
		int x,y,a,b;
		cin>>x>>y>>a>>b;
		int ans = 0;
		while(x < 2*INF/a && x<y/a && x*a <= x+ b)++ans,x*=a;
		ans+=(y-x-1)/b;
		cout <<ans;

	}
    return 0;
}

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

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

    ll x, y, a, b;
    cin >> x >> y >> a >> b;
    ll ans = 0;

    while (true)
    {
        if (y / a < x)
            break;
        if (a * x >= y)
            break;
        if (a * x > x + b)
            break;
        x *= a;
        ans++;
    }
    // yになったらダメなので-1させる
    ans += (y - x - 1) / b;

    cout << ans << endl;
}


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

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

  long long a = sqrt(1.75 + 2 * n) - 0.5;
  a--;
  while ((a + 1) * (a + 2) / 2 <= n + 1) a++;
  cout << n + 1 - a;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define long long int;
typedef std::vector<ll> vi;
typedef pair<ll, ll> pi;
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define boht_tez ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define MAXN ll(1e5 + 123)
#define MAXINP ll (1e3 + 123)
#define MAX_SIZE 100000000
#define    DOD(i)  cout<<setprecision(i)<<fixed<<
#define MOD 1000000007ll
#define pi 3.1415926536

typedef pair<int, int> ii;
typedef vector<ii> vii;

ll n;

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.tx
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif

	ll t = 1 ;
	//cin >> t;
	while (t--) {
		ll a, b;
		cin >> a >> b;
		ll x = a - b;
		double ans = (x * 100.00) / a;
		cout << ans;

	}
}


#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n'
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()

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

void solve()
{
    int m, n, k;
    cin >> n >> m >> k;

    int x[n], y[n];

    bool damS = false;
    f (i, n)
    {
        cin >> x[i] >> y[i];
        if ((x[i] < m) && (y[i] > k)) damS = true;
    }
    if (damS) cout << "Yes";
    else cout << "No";
}

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

    while (T--) solve();

    return 0;
}

#include<bits/stdc++.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define SORT(v) sort(all(v))
#define int long long
#define ff first
#define ss second
#define mod 1000000007
#define endl "\n"

using namespace std;

void oj()
{
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
}

void solve()
{
  int n, s, d;
  cin>>n>>s>>d;
  bool ok = false;
  for(int i = 0; i <n; i++)
  {
    int x, y; cin>>x>>y;
    if(x < s && y > d)
      ok = true;
  }
  (ok?cout<<"Yes":cout<<"No");
}
signed main()
{
  oj();
  // int t; cin>>t;
  // while(t--)
    solve();

  return 0;
}


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

const int N=100;
const ll Inf=1e18;
ll n,m,p,fib[N];
queue<int> q;
vector<int> a;

int main()
{
	fib[1]=1;
	for (m=2;fib[m-1]<=Inf;m++)
		fib[m]=fib[m-1]+fib[m-2];
	cin>>n; p=n;
	for (int i=m;i>=1;i--)
		if (fib[i]<=p) p-=fib[i],a.push_back(i);
	a.push_back(2);
	ll v=(!(a[0]&1))+3;
	for (int i=1;i<a.size()-1;i++)
	{
		if (v==3) q.push(2);
		if (v==4) q.push(1);
		for (int j=a[i];j>a[i+1];j--)
			q.push(v),v=7-v;
	}
	q.push(3);
	cout<<q.size()<<"\n";
	ll x=0,y=0;
	while (q.size())
	{
		int z=q.front();
		cout<<z<<"\n"; q.pop();
		if (z==1) x++;
		if (z==2) y++;
		if (z==3) x+=y;
		if (z==4) y+=x;
	}
	//cerr<<x<<' '<<y;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const double SQUP=0.618033992;
const double SQLO=0.618033982;

bool Deal(long long x,long long y,int dep)
{
	if(dep>129)return false;
	if(x<5 && y<5)
	{
		int tot=dep+x+y+1;
		if(tot>129)return false;
		printf("%d\n",tot);
		for(int i=1;i<=x;i++)puts("1");
		for(int i=1;i<=y;i++)puts("2");
		return true;
	}
//	printf("%lld %lld %d %.10lf\n",x,y,dep,1.0*x/y);
	if(rand()%25==0)
	{
		bool ret=Deal(x,y-1,dep+1);
		if(ret)puts("2");
		return ret;
	}
	if(rand()%25==0)
	{
		bool ret=Deal(x-1,y,dep+1);
		if(ret)puts("1");
		return ret;
	}
	if(x>y)
	{
//		if(y>x*SQUP && rand()%6)Deal(x,y-1,dep+1);
//		else if(x<200 && y<200 && x%y<y/16)Deal(x,y-1,dep+1);
//		else
		bool ret=Deal(x-y,y,dep+1);
		if(ret)puts("3");
		return ret;
	}
	else
	{
//		if(x>y*SQUP && rand()%6)Deal(x-1,y,dep+1);
//		else if(x<200 && y<200 && y%x<x/16)Deal(x-1,y,dep+1);
//		else
		bool ret=Deal(x,y-x,dep+1);
		if(ret)puts("4");
		return ret;
	}
}

int main()
{
	long long tar;scanf("%lld",&tar);
	long long x=tar*(sqrt(5)-1)/2,y=tar-x;
	while(!Deal(x,y,0));
	puts("3");
	return 0;
}


#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 400005
#define MOD 1000000007
#define SMOD 998244353
#define ROOT 512
#define GMAX 20
#define INF 2000000000000000
#define EPS 0.000000001
#define NIL 0
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
int arr[MAX];
vector<pair<int,int> > V;
priority_queue<int> pq;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,i;
    scanf("%d",&n);
    long long ans=0;
    for(i=1;i<=n*2;i++)
    {
        scanf("%d",&arr[i]);
        ans=ans+arr[i];
    }
    for(i=n;i>0;i--)
    {
        V.push_back(make_pair(-arr[i],-arr[n*2-i+1]));
    }
    for(i=0;i<V.size();i++)
    {
        pq.push(V[i].first);
        pq.push(V[i].second);
        ans=ans+pq.top();
        pq.pop();
    }
    printf("%lld",ans);
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define ft first
#define sec second
#define pr pair<int,int>
#define ISCC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int t ,n ,m;
ll a[100005] ,k ,sum[100005];
vector<ll> vec;
int sol()
{
	int l = 0 ,r = n+1 ,mid;
	while(l<r)
	{
		mid = (l+r)>>1;
		//cout << sum[mid] << ' ' << l <<'\n';
		if(sum[mid] >= k) r = mid;
		else l = mid+1;
	}
	return l;
}
int main()
{
	ISCC;
	cin >> n >> m;
	for(int i=1 ;i<=n ;i++)
	{
		cin >> a[i];
		sum[i] = sum[i-1] + (a[i]-a[i-1]-1);
	}sum[n+1] = sum[n] + (1e18-a[n]-1);
	for(int i=1 ,now ;i<=m ;i++)
	{
		cin >> k;  now = sol()-1;
		cout << a[now] + abs(k-sum[now]) << '\n';
	}

	return 0;
}


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

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

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

const double eps = 1e-10;

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

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

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

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

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

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, X;
	cin >> N >> X;
	vector<int64> A(N);
	REP(i, N) cin >> A[i];
	// dp[i][j] := i個使っていて、Xとの差をiで割ったあまりがjのものの中で最大
  int64 res = 2*INF_LL;
	FOR(k, 1, N+1) {
	  auto dp = make_v<int64>(k + 1, k + 1);
	  fill_v<int64>(dp, -INF_LL);
	  dp[0][0] = 0;

	  REP(s, N) {
      for (int64 i = k-1; i >= 0; i--) {
        REP(j, k) {
            assert(i < dp.size() && j < dp[0].size());
	        if (dp[i][j] != -INF_LL)
  	        chmax(dp[i + 1][(j + A[s]) % k], dp[i][j] + A[s]);
	      }
	    }
	  }
//	  cout << k << " " << dp[k][X%k] << " " << (X - dp[k][X%k]) % k << endl;
	  if(dp[k][X%k]!=-INF_LL)chmin(res, (X - dp[k][X % k]) / k);
  }
	cout << res << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = std::pair<ll, ll>;
template <class T> using vec = std::vector<T>;
template <class T> using vec2 = std::vector<vec<T>>;
template <class T> using vec3 = std::vector<vec2<T>>;
#define debug(var) std::cerr << #var << " : " << var << std::endl;
#define rep(i, N) for (ll i = 0, i##_len=(N); i < i##_len; i++)
#define rrep(i, N) for (ll i = (N) - 1; i >= 0; i--)
#define range(i, A, B) for (ll i = (A), i##_len = (B); i < i##_len; i++)
constexpr int MOD = 1000000007;
constexpr ll INFL = std::numeric_limits<ll>::max();
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; }

void solve()
{
    ll N, M;
    cin >> N >> M;
    vec2<ll> A(M, vec<ll>(2));
    rep(i, M) {
        cin >> A[i][0] >> A[i][1];
    }
    ll K;
    cin >> K;
    vec2<ll> C(K, vec<ll>(2));
    rep(i, K) {
        cin >> C[i][0] >> C[i][1];
    }

    ll ret = 0;
    rep(i, 1 << K) {
        // debug(i);
        vec<bool> P(N + 10);
        rep(j, K) {
            if ((i & (1 << j)) == 0)
                P[C[j][0]] = true;
            else
                P[C[j][1]] = true;
        }

        // rep(i, N + 1) {
        //     cerr << (ll)P[i] << " ";
        // }
        // cerr << endl;

        ll max = 0;
        rep(j, M) {
            if (P[A[j][0]] && P[A[j][1]]) {
                max++;
            }
        }
        chmax(ret, max);
    }
    cout << ret << endl;
}

int main()
{
    std::cout << std::fixed << std::setprecision(10);
    solve();
    std::cout << std::flush;
    return 0;
}


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

#define N 3010
#define MOD 998244353
#define ll long long
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define rep3(i, a, b) for(int 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 pii pair<int,int>
#define pll pair<ll,ll>

int main() {
	int n, k;
	int x;
	ll dp[N][N];
	ll s[2 * N];
	rep(i, N) {
		rep(j, N) {
			dp[i][j] = 0;
		}
	}
	rep(i, 2 * N)s[i] = 0;
  dp[0][0]=1;
  s[0]=1;
	cin >> n >> k;
	rep2(i, 1, n) {
		rep3(j, i, 1) {
			x = (2 * i) - (2 * j);
			dp[i][j] = s[x];
			x = (2 * i) - j;
			s[x] = (s[x] + dp[i][j]) % MOD;
		}
	}
	cout << dp[n][k] << endl;

	return 0;
}

#include <bits/stdc++.h>

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a,v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 3002;
const int MOD = 998244353;

int n, k;
int dp[N][N];

void fillDP() {
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j > 0; j--) {
			dp[i][j] = (dp[i-1][j-1] + dp[i][min(N-1, 2*j)]) % MOD;
		}
	}
}

int main() {
	scanf("%d %d", &n, &k);
	fillDP();
	printf("%d\n", dp[n][k]);
	return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long power(long long a, long long b,long long mod) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %mod;
        a = a * a %mod;
        b >>= 1;
    }
    return res;
}

pair<int,int>p[105];
int mm1[205];
int mm2[205];
int dp[205][105];
int n;
int over[205];

int solve(int x,int len)
{
    int tot=0;
    for(int i=x;i<x+len;i++)
    {
        if(mm1[i])
        {
            int z=mm1[i];
            if(p[z].second!=-1)
            {
                if(p[z].second-p[z].first!=len)
                {
                    return -1;
                }
            }
            else if(mm2[i+len])
            {
                return -1;
            }
        }
        else if(!mm2[i+len])
        {
            tot++;
        }
    }
    return tot;
}

signed main()
{

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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif

    cin>>n;
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i].first>>p[i].second;
        if(p[i].first!=-1)
        {
            over[p[i].first]++;
            mm1[p[i].first]=i;
        }
        if(p[i].second!=-1)
        {
            over[p[i].second]++;
            mm2[p[i].second]=i;
        }
        if(p[i].first==-1 && p[i].second==-1)
            cnt++;
    }
    for(int i=1;i<=2*n;i++)
    {
        if(over[i]>1)
        {
            cout<<"No";
            return 0;
        }
    }

    dp[0][cnt]=1;
    for(int i=0;i<=2*n;i++)
    {
        for(int j=cnt;j>=0;j--)
        {
            if(dp[i][j])
            {
                for(int k=1;k<=n;k++)
                {
                    if(i+2*k<=2*n)
                    {
                        int kad=solve(i+1,k);
                        if(kad!=-1)
                        if(j-kad>=0)
                            dp[i+2*k][j-kad]|=1;
                    }
                }
            }
        }
    }

    if(dp[2*n][0])
        cout<<"Yes";
    else
        cout<<"No";

}

/*
Author: QAQAutomaton
Lang: C++
Code: C.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cp;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T,class T2>int chkmin(T &a,T2 b){return a>b?a=b,1:0;}
template<class T,class T2>int chkmax(T &a,T2 b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T,class T2>T mmin(T a,T2 b){return a<b?a:b;}
template<class T,class T2>T mmax(T a,T2 b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		fill((unsigned char *)(&inf),(unsigned char *)(&inf)+sizeof(inf),0x3f);
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'||*x==EOF))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
int s[1<<8|5],atl[1<<8|5];
pii e[100005];
int g[9][9];
int dis[9][9],p[9];
int n,m;
signed main(){
#ifdef QAQAutoMaton
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
#endif
	read(n,m);
	int mx=0;
	for(int i=0;i<n;++i){
		read(s[1<<i]);
		chkmax(mx,s[1<<i]);
	}
	for(int i=1;i<(1<<n);++i)if(i&(i-1))s[i]=s[i&(i-1)]+s[i&(-i)];
	for(int i=1;i<=m;++i){
		read(e[i].y,e[i].x);
		if(mx>e[i].x)return write("-1\n");
	}
	sort(e+1,e+m+1);
	for(int i=1;i<=m;++i)chkmax(e[i].y,e[i-1].y);
	for(int i=0;i<(1<<n);++i){
		atl[i]=(lower_bound(e+1,e+m+1,make_pair(s[i],-1))-1)->y;
	}
	for(int i=1;i<=n;++i)p[i]=i-1;
	int ans=inf;
	do{
		for(int i=1;i<=n;++i){
			int w=0;
			for(int j=i;j;--j){
				w|=1<<p[j];
				dis[j][i]=-atl[w];
			}
			for(int j=i+1;j<=n;++j)dis[j][i]=inf;
		}
		for(int k=1;k<=n;++k)
			for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)chkmin(dis[i][j],dis[i][k]+dis[k][j]);
		chkmin(ans,-dis[1][n]);
	}while(next_permutation(p+1,p+n+1));
	write(ans,'\n');
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int H,W,ans;
char s[110][110];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main(){
    cin >> H >> W;
    for(int i=0;i<H;i++){
        for (int j=0; j<W; j++) {
            cin >> s[i][j];
        }
    }
    ans=0;
    for(int i=0;i<H;i++)for(int j=0;j<W;j++){
        if(s[i][j]=='#')continue;
        for(int l=0;l<4;l++){
            int x=i+dx[l],y=j+dy[l];
            if(0<=x && x<H && 0<=y && y<W && s[x][y]=='.')ans++;
        }
    }
    cout << ans/2 << endl;
}