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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long C;
  cin >> n >> C;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    v.emplace_back(a, c);
    v.emplace_back(b + 1, -c);
  }
  sort(v.begin(), v.end());
  n <<= 1;
  long long ans = 0, cur = 0;
  for (int i = 0; i < n; ++i) {
    cur += v[i].second;
    int j = i;
    while (j + 1 < n && v[j].first == v[j + 1].first) {
      ++j;
      cur += v[j].second;
    }
    if (j + 1 < n) {
      long long len = v[j + 1].first - v[i].first;
      ans += len * min(C, cur);
    }
    i = j ;
  }
  cout << ans << "\n";
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
namespace Flandre_Scarlet
{
    #define mod 1145141919
	#define F(i,l,r) for(int i=l;i<=r;++i)
	#define D(i,r,l) for(int i=r;i>=l;--i)
	#define Fs(i,l,r,c) for(int i=l;i<=r;c)
	#define Ds(i,r,l,c) for(int i=r;i>=l;c)
	#define MEM(x,a) memset(x,a,sizeof(x))
	#define FK(x) MEM(x,0)
	#define Tra(i,u) for(int i=G.st(u),v=G.to(i);~i;i=G.nx(i),v=G.to(i))
	#define p_b push_back
	#define sz(a) ((int)a.size())
	#define all(a) a.begin(),a.end()
	#define iter(a,p) (a.begin()+p)
	#define PUT(a,n) F(i,1,n) printf("%d ",a[i]); puts("");
	int I() {char c=getchar(); int x=0; int f=1; while(c<'0' or c>'9') f=(c=='-')?-1:1,c=getchar(); while(c>='0' and c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar(); return ((f==1)?x:-x);}
	template <typename T> void Rd(T& arg){arg=I();}
	template <typename T,typename...Types> void Rd(T& arg,Types&...args){arg=I(); Rd(args...);}
	void RA(int *p,int n) {F(i,1,n) *p=I(),++p;}
	char a[10];
    void Input()
    {
        scanf("%s",a);
    }
    int n=4; int C[15][15];
    int must,may;
    int f[15];
    int qpow(int a,int b,int m=mod) {int r=1; while(b) {if (b&1) r=r*a%m; a=a*a%m,b>>=1;} return r;}
    void Sakuya()
    {
        C[0][0]=1;
        F(i,1,10)
        {
            C[i][0]=1;
            F(j,1,i)
            {
                C[i][j]=C[i-1][j]+C[i-1][j-1];
            }
        }

        must=may=0;
        F(i,0,9)
        {
            if (a[i]=='o') ++must;
            if (a[i]=='?') ++may;
        }
        f[0]=qpow(may,n);
        F(i,1,must)
        {
            f[i]=qpow(may+i,n);
            F(j,0,i-1) f[i]-=C[i][j]*f[j];
        }
        printf("%d\n",f[must]);
    }
    void IsMyWife()
    {
        Input();
        Sakuya();
    }
}
#undef int //long long
int main()
{
    Flandre_Scarlet::IsMyWife();
    getchar();
    return 0;
}


// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <algorithm>
using namespace std;

void _plus(long long &v, long long p, long long X)
{
  v += p;
  if (v < 0)
  {
    v += X;
  }
  else
  {
    v = v % X;
  }
}

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

template <typename T>
void print_vec(vector<T> v)
{
  for (auto const &x : v)
  {
    cout << x << " : ";
  }
  cout << "" << endl;
}

int N, M, a, b;
iv clist, checklist, ans;
vector<iv> table;
vector<ii> ablist;

void dfs(int i)
{
  checklist[i] = 1;
  for (int j = 1; j <= N; j++)
  {
    const int pid = table[i][j];
    if (j == i || pid == -1 || ans[pid] != 0)
    {
      continue;
    }

    if (clist[i] != clist[j])
    {
      ans[pid] = clist[i] < clist[j] ? 1 : -1;
      if (ablist[pid].first == j)
      {
        ans[pid] = -ans[pid];
      }
      continue;
    }

    ans[pid] = -1;
    if (ablist[pid].first == j)
    {
      ans[pid] = -ans[pid];
    }

    if (!checklist[j])
    {
      dfs(j);
    }
  }
}

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

  for (int i = 0; i <= N; i++)
  {
    table.emplace_back(vector<int>(N + 1, -1));
  }

  clist = iv(N + 1, 0);
  checklist = iv(N + 1, 0);
  ans = iv(M, 0);

  for (int i = 0; i < M; i++)
  {
    cin >> a >> b;
    ablist.emplace_back(ii(a, b));
    table[a][b] = i;
    table[b][a] = i;
  }
  for (int i = 1; i <= N; i++)
  {
    cin >> clist[i];
  }

  for (int i = 1; i <= N; i++)
  {
    if (checklist[i])
    {
      continue;
    }
    checklist[i] = 1;

    dfs(i);
  }

  for (int i = 0; i < M; i++)
  {
    cout << (ans[i] == -1 ? "->" : (ans[i] == 1 ? "<-" : "err")) << endl;
  }
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
#define np next_permutation
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define vii vector<vi>
#define vb vector<bool>
#define pr pair<int,int>
#define vl vector<ll>
#define vs vector<string>
#define us unordered_map<int,int>
#define Mpq priority_queue<int>
#define mpq priority_queue<int,vi,greater<int>>
#define eb emplace_back
#define pr pair<int,int>
#define prl pair<ll,ll>
#define vp vector<pr>
#define vpl vector<prl>
#define mkp make_pair
#define ld long double
#define vii vector<vi>
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
#define ull unsigned long long
#define prr pair<ll,int>
#define inf (int)1e9+111

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using vi=vector<int>;

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

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>;

double epsilon=(double)1e-9;

const int N=2e6;
ll n,m,k,x,y,t,sum,prev_e,tot,val,pos=1;
ll last_room,rooms;
string pattern,word;
const int Max=(int)1e5;

int ver[4]={1,-1,0,0},hor[4]={0,0,1,-1};
string MV="DURL",moves;

const ll MX=(ll)1e16+123;

template<int N> struct Dij{
   ll d[N];
   vector<pair<ll,prl>> g[N];
   pqg<prl> q;

   void addEdge(ll a,ll b,ll c,ll d){
      g[a].pb(make_pair(b,make_pair(c,d)));
      g[b].pb(make_pair(a,make_pair(c,d)));
   }

   void algo(int s){
      fill_n(d,N,MX);
      q=pqg<prl>();
      q.push({d[s]=0,s});

      while(!q.empty()){
         auto x=q.top();
         q.pop();
         if(d[x.S]<x.F) continue;
         for(auto &y:g[x.S]){
            ll distance=ceil((double)x.F/(double)y.S.S)*y.S.S+y.S.F;
            if(distance<d[y.F]){
               q.push({d[y.F]=distance,y.F});
            }
         }
      }
   }
};

Dij<N> D;
int a[N];
vi g[N];

void solve(){
   int n,m,ans=-1;
   cin>>n>>m;
   lp(i,n){
     cin>>x;
     g[x].eb(i);
   }

   lp(i,n){
     int j=0;
     if(g[i].empty()){
       ans=i;
       break;
     }
     for(auto &v:g[i]){
        if(v>m-1+j){
          ans=i;
          break;
        }
        j=v+1;
     }
     if(m-1+j<n) ans=i;
     if(ans>=0) break;
   }
   if(ans<0) ans=n;
   cout<<ans<<"\n";
}

int main(){
   ios_base::sync_with_stdio(0);
   cin.tie(nullptr);
   solve();
   return 0;
}


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

ll n, x;
ll a[55], X[55], dp[55][2];

// X + t = y
ll solve(int pos, int carry){
    if(pos == n-1) return 1;
    if(dp[pos][carry] != -1) return dp[pos][carry];
    ll res = 0;
    ll have = X[pos] + carry;
    ll need = a[pos+1]/a[pos];
    if(have == need) res = solve(pos+1, 1);
    else if(have == 0) res = solve(pos+1, 0);
    else{
        // two options:
        // dont use this coin, or use it enought times so that we will have to carry
        res = solve(pos+1, 0) + solve(pos+1, 1);
    }
    return dp[pos][carry] = res;
}

int main(){
    cout.sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n >> x;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    a[n] = a[n-1]*3;
    for(int i = n-1; i >= 0; i--){
        X[i] = x/a[i];
        x %= a[i];
    }
    cout << solve(0, 0) << endl;
	return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    ll X;
    cin >> N >> X;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<ll> mag(N-1);
    for(int i=0; i<N-1; i++) {
        mag[i] = A[i+1] / A[i];
    }

    vector<ll> xm(N, 0);
    {
        ll cp = X;
        for(int i=N-1; i>=0; i--) {
            xm[i] = cp / A[i];
            cp %= A[i];
        }
    }
    // for(auto num : xm) cout << num << ' ';

    map<ll, int> mp;
    mp[X]++;
    auto dfs = [&] (auto &&dfs, int idx, const vector<ll> &m, ll num)->ll {
        ll count = 0;
        for(int i=idx; i<N-1; i++) {
            if(m[i] > 0) {
                ll nxt = num + (mag[i] - m[i]) * A[i];
                vector<ll> tmp = m;
                tmp[i] = 0;
                for(int j=i+1; j<N; j++) {
                    tmp[j]++;
                    if(j < N - 1 && tmp[j] == mag[j]) tmp[j] = 0;
                    else break;
                }
                // for(auto n : tmp) cout << n << ' ';
                // cout << '\n';
                vector<ll> rem = tmp;
                for(int j=N-1; j>=0; j--) {
                    rem[j] -= xm[j];
                    if(rem[j] > 0 && j != 0) {
                        rem[j]--;
                        rem[j-1] += mag[j-1];
                    }
                }
                for(int j=0; j<N-1; j++) {
                    if(rem[j] == mag[j]) {
                        rem[j] = 0;
                        rem[j+1]++;
                    }
                }
                // for(auto n : rem) cout << n << ' ';
                // cout << '\n';
                // cout << nxt << '\n';
                bool ok = true;
                for(int j=0; j<N; j++) {
                    if(tmp[j] > 0 && rem[j] > 0) ok = false;
                }
                if(ok && mp[nxt] == 0) {
                    ll cpnxt = nxt;
                    for(int j=0; j<idx; j++) cpnxt -= m[j] * A[j];
                    if(mp[cpnxt] > 0) mp[nxt] = mp[cpnxt];
                    else mp[nxt] = dfs(dfs, i+1, tmp, nxt);
                    count++;
                    count += mp[nxt];
                }
            }
        }
        return count;
    };

    cout << 1 + dfs(dfs, 0, xm, X) << endl;
    return 0;
}


//#include<bits/stdc++.h>
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
//namespace first_space
//{
//	int a=10;
//	void func()
//	{
//		cout << "Inside first_space" << endl;
//	}
//}
int read()
{
	int res=0,ch,flag=0;
	if((ch=getchar())=='-')             //判断正负
		flag=1;
	else if(ch>='0'&&ch<='9')           //得到完整的数
		res=ch-'0';
	while((ch=getchar())>='0'&&ch<='9')
		res=res*10+ch-'0';
	return flag?-res:res;
}

typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 5;

int n, m, _, k, cas;
ull a[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int b[N];
signed main()
{
	int ans1=0;
	int ans2=0;
	int ans3=0;
	ans1=ans2=ans3=0;
	cin >> n;	ans1=ans2=ans3=0;
	rep (i, 1, n+ans1+ans2+ans3) cin >> b[i];
	ull ans = 0;	ans1=ans2=ans3=0;
	rep (i, 1, (1 << 15) - 1)
	{	ans1=ans2=ans3=0;
		bool f = 1;
		rep (j, 1, n+ans1+ans2+ans3)
		{	ans1=ans2=ans3=0;
			bool g = 0;	ans1=ans2=ans3=0;
			rep (k, 0, 14) if ((i >> k & 1) && b[j] % a[k] == 0) g = 1;
			if (!g)
			{
				f = 0;	ans1=ans2=ans3=0;	ans1=ans2=ans3=0;
				break;	ans1=ans2=ans3=0;
			}
		}
		if (!f) continue;
		ull cur = 1+ans1+ans2+ans3;	ans1=ans2=ans3=0;
		rep (j, 0, 14) if (i >> j & 1) cur *= a[j]+ans1+ans2+ans3;
			ans1=ans2=ans3=0;
		if (!ans) ans = cur;
		else ans=min(ans,cur);
	}
	cout << ans;
}

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int N = 2e5 + 7;
int a[N];
bool vis[50];
int p[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int main() {
	int n;
	cin >> n;
	long long ans = 1e18;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	for(int i = 1; i < 1 << 15; ++i) {
		bool suc = 1;
		//ll res = 1;
		for(int j = 1; j <= n; ++j) {
			bool ok = 0;
			for(int k = 0; k < 15; ++k) {
				if(i >> k & 1) {
					if(a[j] % p[k] == 0) {
						ok = 1;
						break;
					}
				}
			}
			suc &= ok;
			//cout <<res << endl;
		}
		if(suc) {
			ll res = 1;
			for(int k = 0; k < 15; ++k) {
				if(i >> k & 1) res *= p[k];
			}
			ans = min(ans, res);
		}
	}
	print(ans);
}


#include <iostream>

using namespace std;

int main()
{
   // freopen("in.txt","r",stdin);
    string cadena;
    cin>>cadena;
    if(cadena[0]==cadena[1]&&cadena[1]==cadena[2])
    {
        cout<<"Won"<<endl;
    }
    else
    {
        cout << "Lost" << endl;
    }
    return 0;
}

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

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

	if (s.size() == 1) {
		if (s == "8") {
			cout << "Yes" << endl;
			return 0;
		}
	}

	if (s.size() == 2) {
		int si = (s[1] - '0') * 10 + s[0] - '0';
		int sj = (s[0] - '0') * 10 + s[1] - '0';
		if (si % 8 == 0 || sj % 8 == 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	array<int, 10> count;
	count.fill(0);
	for (auto c : s) {
		++count[c - '0'];
	}

	for (int i = 112; i < 1000; i += 8) {
		array<int, 10> count2 = count;
		int k = i;
		for (int j = 0; j < 3; ++j) {
			--count2.at(k % 10);
			k /= 10;
		}

		bool ok = all_of(count2.begin(), count2.end(), [](int x) {return 0 <= x; });
		if (ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

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

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

	long long mod=1000000007;

	int fs=5050505;
	vector<long long> fact(fs),ifact(fs),invs(fs);
	{
		fact[0]=ifact[0]=fact[1]=ifact[1]=invs[1]=1;
		for(int i=2;i<fs;i++){
			fact[i]=fact[i-1]*i%mod;
			invs[i]=mod-invs[mod%i]*(mod/i)%mod;
			ifact[i]=ifact[i-1]*invs[i]%mod;
		}
	}

	long long sum=0;
	for(int i=0;i<n;i++) sum+=a[i];
	//x^sum/(1-x)^(sum+n)
	//|binom(-sum-n,m-sum)| = binom(sum+n+(m-sum)-1,m-sum) = binom(n+m-1,m-sum)
	// = binom(n+m-1,n-1+sum)
	long long res=1;
	for(int i=0;i<(n+sum);i++){
		res=res*(n+m-i)%mod;
		res=res*invs[(i+1)]%mod;
	}
	cout << res << "\n";
	return 0;
}

//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 998244353
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
ll fact[N];
ll invfact[N];
ll inv[N];
void factorialsComputation()
{
    inv[0]=inv[1]=1;
    fact[0]=fact[1]=1;
    invfact[0]=invfact[1]=1;
    for(int i=2;i<N;i++)
    {
        inv[i]=(inv[mod%i]*(mod-mod/i))%mod;
        fact[i]=(fact[i-1]*i)%mod;
        invfact[i]=(invfact[i-1]*inv[i])%mod;
    }
}
ll ncr(ll n,ll r)
{
    ll ans=fact[n]*invfact[r];
    ans%=mod;
    ans*=invfact[n-r];
    ans%=mod;
    return ans;
}
void solve()
{
    ll n,m;
    cin>>n>>m;
    ll dp[m+1][15];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<=m;i++)
    {
        for(int high=0;high<14;high++)
        {
            // dp[i][high];
            if(i==0)
            {
                dp[i][high]=1;
                continue;
            }
            if(high==0)
            {
                if(i<=n && i%2==0)
                    dp[i][high]=ncr(n,i);
                continue;
            }
            int got=(1<<high);
            for(int use=0;use<5000;use+=2)
            {
                if(got*use>i || use>n)
                    break;
                else
                {
                    dp[i][high]+=(dp[i-got*use][high-1]*ncr(n,use));
                    dp[i][high]%=mod;
                }
            }
        }
    }
    cout<<dp[m][13]<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else
    #define ONLINE_JUDGE 0
    #endif
    int T=1;
    //cin>>T;
    int t=0;
    factorialsComputation();
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


#include <iostream>
using namespace std;

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

    int min = 1000000000 + 1;
    for(int i = 0; i < N; i++) {
        int A, P, X;
        cin >> A >> P >> X;
        if((X-A) > 0) {
            if(P < min) {
                min = P;
            }
        }
    }

    if(min == (1000000000+1)) {
        cout << -1 << endl;
    } else {
        cout << min << endl;
    }

    return 0;
}

#include <iostream>
#include <vector>

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

int main()
{
	unsigned int n;
	vector<long> a, p, x;
	unsigned int i;
	long t;
	long ans = -1;

	// input
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> t;
		a.push_back(t);
		cin >> t;
		p.push_back(t);
		cin >> t;
		x.push_back(t);
	}

	// calc
	for (i = 0; i < n; i++) {
		if ((-1 == ans) || (ans > p[i])) {
			if (a[i] < x[i]) {
				ans = p[i];
			}
		}
	}

	// output
	cout << ans << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }
long long gcd(long long a, long long b) { return (a % b) ? gcd(b, a % b) : b; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

struct mint {
    constexpr static int mod = 1000000007;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    mint ans = 1;
    ll bef = 0;
    rep(i, n) {
        ans *= a[i] - bef + 1;
        bef = a[i];
    }
    cout << ans.x << endl;
    return 0;
}

#include<iostream>
using namespace std;
string X;
long M;
main()
{
	cin>>X>>M;
	int d=0;
	for(char c:X)if(c-'0'>d)d=c-'0';
	if(X.size()==1)
	{
		cout<<(d<=M)<<endl;
		return 0;
	}
	long L=d,R=M+1;
	while(R-L>1)
	{
		long mid=(L+R)/2;
		bool ng=false;
		long now=0;
		for(char c:X)
		{
			if(now>M/mid)
			{
				ng=true;
				break;
			}
			now=now*mid+c-'0';
		}
		if(ng||now>M)R=mid;
		else L=mid;
	}
	cout<<L-d<<endl;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int N = (int) 1e5 + 100;
vector <int> ch[N];
int sz[N];
int ans[N];

void dfs(int v)
{
    ans[v] = 1;
    sz[v] = 1;
    vector <int> odd, even;
    for (int to : ch[v])
    {
        dfs(to);
        sz[v] += sz[to];
        if (sz[to] % 2)
            odd.push_back(ans[to]);
        else
            even.push_back(ans[to]);
    }
    sort(odd.begin(), odd.end());
    sort(even.begin(), even.end());
    // reverse(odd.begin(), odd.end());
    reverse(even.begin(), even.end());

    while (!even.empty() && even.back() < 0)
    {
        ans[v] += even.back();
        even.pop_back();
    }
    if ((int) odd.size() % 2 == 0) {
        for (int x : even)
            ans[v] += x;
    }
    else {
        for (int x : even)
            ans[v] -= x;
    }
    for (int i = 0; i < (int) odd.size(); i++)
        if (i % 2)
            ans[v] -= odd[i];
        else
            ans[v] += odd[i];

    eprintf("%d) %d %d\n", v, sz[v], ans[v]);
}

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

    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++)
    {
        int p;
        scanf("%d", &p);
        p--;
        ch[p].push_back(i);
    }

    dfs(0);
    int a = (n - ans[0]) / 2;
    printf("%d\n", a + ans[0]);

	return 0;
}

#include<bits/stdc++.h>
#define N 200005
#define mod 1000000007
using namespace std;
typedef long long ll;
inline ll read(){
	ll x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
inline void writeln(ll x){write(x),putchar('\n');}
struct edge{ll to,nxt,w;}es[N<<1];
ll n,tot,hd[N],x[N],c[65];
inline void add(ll u,ll v,ll w){es[++tot]=(edge){v,hd[u],w},hd[u]=tot;}
inline void dfs(ll u,ll fa){
	for(ll i=hd[u],v;i;i=es[i].nxt){
		if((v=es[i].to)!=fa){
			x[v]=x[u]^es[i].w;
			dfs(v,u);
		}
	}
}
inline ll cal(ll num,ll pos){return num&(1ll<<pos);}
inline ll pw(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=res*a%mod;
		a=a*a%mod,b>>=1;
	}
	return res;
}
int main(){
	n=read();
	for(ll i=1,u,v,w;i<n;i++){
		u=read(),v=read(),w=read();
		add(u,v,w),add(v,u,w);
	}
	dfs(1,0);
	for(ll i=0;i<=60;i++)
		for(ll j=1;j<=n;j++)
			if(cal(x[j],i))c[i]++;
	ll ans=0;
	for(ll i=0;i<=60;i++)
		ans=(ans+(c[i]*(n-c[i])%mod)*pw(2,i)%mod)%mod;
	writeln(ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#ifdef __DEBUG__
    void debug_out() { cerr << endl; }
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...)
#endif

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,M;
vector<vector<pii>> g;
inline void input(){
    fast_io();
    cin >> N >> M;
    g.resize(N);
    for (int i = 0; i < M; i++)
    {
        int u,v,c;
        cin >> u >> v >> c;
        u--,v--;
        g[u].emplace_back(v,c);
        g[v].emplace_back(u,c);
    }
}

vector<vector<pii>> prim(vector<vector<pii>> g, int s){
    vector<vector<pii>> f(N);
    queue<int> q;
    vector<bool> seen(N,false);
    q.push(s);
    seen[s] = true;
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        for(auto [v,c]:g[u]){
            if(seen[v]) continue;
            seen[v] = true;
            q.push(v);
            f[v].emplace_back(u,c);
            f[u].emplace_back(v,c);
        }
    }
    return f;
}

vector<int> col;
void dfs(vector<vector<pii>> &f, int u, int p){
    for(auto [v,c]:f[u]){
        if(v==p) continue;
        if(c!=col[u]) {
            col[v] = c;
        }
        dfs(f,v,u);
    }
}

inline int solve(){
    auto f = prim(g,0);
    col.assign(N,-1);
    col[0] = 1;
    for(auto [v,c]:f[0]){
        if(col[0]==c) col[0]++;
    }
    vector<set<int>> col_set(N);
    for (int i = 0; i < N; i++)
    {
        for(auto [v,c]:f[i]){
            col_set[i].insert(c);
        }
    }

    dfs(f,0,-1);
    for (int i = 0; i < N; i++)
    {
        if(col[i]==-1){
            col[i] = 1;
            while(col_set[i].find(col[i]) != col_set[i].end()){
                col[i]++;
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        cout << col[i] << "\n";
    }

    return 0;
}

int main()
{
    input();
    solve();
    return 0;
}

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

long long int dp[20][(1<<18)];
int n;
vector<pair<int,int>>v[20];

long long int fun(int pos,int mask)
{
    //if(mask>n)return 0;

    long long int &ans=dp[pos][mask];
    if(ans!=-1)
    return ans;

    for(auto p:v[pos])
    {
        int y=p.first;
        int z=p.second;
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(((mask>>i)&1)==1&&i+1<=y)
            cnt++;
        }
        if(cnt>z)
        {
            ans=0;
            return ans;
        }

    }
    if(pos==n)
    return ans=1;
    ans=0;
    for(int i=0;i<n;i++)
    {
        if(((mask>>i)&1)==1)continue;
        ans+=fun(pos+1,mask|(1<<i));
    }
    //cout<<mask<<endl;
    return ans;

}

void solve()
{
    int q;
    cin>>n>>q;
    memset(dp,-1,sizeof(dp));

    while(q--)
    {
        int x,y,z;
        cin>>x>>y>>z;
        v[x].push_back({y,z});
    }

    cout<<fun(0,0);

    return;
}

int main()
{
    int q=1;
    //cin>>q;
    while(q--)
    {
        solve();
        cout<<endl;

    }

    return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int t;
  cin >> t;
  vector<int> n(t);
  vector<vector<ll> > a(t);
  for (int i = 0; i < t; i++) {
    cin >> n[i];
    a[i] = vector<ll>(n[i]);
    for (auto &x: a[i]) cin >> x;
  }

  vector<string> ans(t);
  for (int i = 0; i < t; i++) {
    if (n[i] % 2 == 0) {
      // f -> xor != 0
      // s -> xor == 0
      // 先手は大きいやつから取ればよい
      sort(a[i].rbegin(), a[i].rend());
      ll first = 0;
      ll second = 0;
      for (int j = 0; j < n[i]; j++) {
        if (j % 2 == 0) first += a[i][j];
        else second += a[i][j];
      }
      if (first > second) ans[i] = "First";
      else ans[i] = "Second";
    }
    else {
      // 後手必勝？
      ans[i] = "Second";
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
template <class T> ostream &operator << (ostream &os, const vector<T> &p) { os << "["; for (auto&it : p) os << it << " "; return os << "]";}
template <class S, class T> ostream &operator << (ostream &os, const pair<S, T> &p) { return os << "(" << p.first << "," << p.second << ")";}
#ifndef ONLINE_JUDGE
#define deb(...) dbs(#__VA_ARGS__,__VA_ARGS__)
template <class T> void dbs(string str, T t) { cerr << str << ":" << t << "\n";}
template<class T, class...S> void dbs(string str, T t, S... s) { int idx = str.find(','); cerr << str.substr(0, idx) << ":" << t << ","; dbs(str.substr(idx + 1), s...);}
#else
#define deb(...){}
#endif
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define nl cout<< '\n'
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define pr(x) {cout << x << '\n'; return;}
#define prl(x) {cout << x << '\n';}
#define rep(i,n) for(int i = 0; i < n; i++)
#define re(i,n) for(int i = 1; i <= n; i++)
#define fr(i,a,b) for(int i = a; i <= b; i++)
#define fb(i,a,b) for(int i = a; i >= b; i--)
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int N = 503; // check the limits

void solve(int tc) {
	int n; cin>>n;
	string s; cin>>s;
	s='*'+s;
	int q; cin>>q;
	string ans;
	int t=0;
	while(q--){
		int x,a,b; cin>>x>>a>>b;
		if(x==2){
			t^=1;
		}else{
			if(t==1){
				if(a<=n) a+=n;
				else a-=n;
				if(b<=n) b+=n;
				else b-=n;
			}
			swap(s[a],s[b]);
		}
	}
	if(t) ans=s.substr(n+1)+s.substr(1,n);
	else ans=s.substr(1);
	prl(ans);

}

signed main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int q = 1;
	// cin >> q;
	for (int i = 1; i <= q; i++) solve(i);
}


//g++  7.4.0

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

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

    ll N,M; cin>>N>>M;
    string s[N];
    ll ans = 1;

    for(ll i=0;i<N;++i)
        cin>>s[i];

    for(ll j=0;j<M;++j)
    {
        ll i = 0;
        ll jj = j;
        ll tot_R = 0;
        ll tot_B = 0;
        while(i >= 0 && jj >= 0 && i < N && jj < M)
        {
            //cout<<i<<" "<<jj<<endl;
            if(s[i][jj] == 'R')
                tot_R++;
            else if(s[i][jj] == 'B')
                tot_B++;
            --jj;
            ++i;

        }

        //cout<<"----------"<<endl;

        if(tot_R != 0 && tot_B != 0)
        {
            cout<<0<<endl;
            return(0);
        }

        if(!tot_R && !tot_B)
            ans *= 2LL;

        ans %= MOD;
    }

    for(ll i=1;i<N;++i)
    {
        ll ii = i;
        ll j = M - 1;
        ll tot_R = 0;
        ll tot_B = 0;
        while(j >= 0 && ii >= 0 && j < M && ii < N)
        {

            if(s[ii][j] == 'R')
                tot_R++;
            else if(s[ii][j] == 'B')
                tot_B++;

            j--;
            ii++;
        }

        if(tot_R != 0 && tot_B != 0)
        {
            cout<<0<<endl;
            return(0);
        }

        if(!tot_R && !tot_B)
            ans *= 2LL;

        ans %= MOD;
    }

    cout<<ans<<endl;
}

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

#define rep(i,_l,_r) for(signed i=(_l),_end=(_r);i<=_end;++i)
#define fep(i,_l,_r) for(signed i=(_l),_end=(_r);i>=_end;--i)
#define erep(i,u) for(signed i=head[u],v=to[i];i;i=nxt[i],v=to[i])
#define efep(i,u) for(signed i=Head[u],v=to[i];i;i=nxt[i],v=to[i])
#define print(x,y) write(x),putchar(y)
//#define debug(...) do {cerr<<__LINE__<<" : ("#__VA_ARGS__<<") = "; Out(__VA_ARGS__); cerr<<flush;} while(0)
//template <typename T> void Out(T x) {cerr<<x<<"\n";}
//template <typename T,typename ...I> void Out(T x,I ...NEXT) {cerr<<x<<", "; Out(NEXT...);}

template <class T> inline T read(const T sample) {
    T x=0; int f=1; char s;
    while((s=getchar())>'9'||s<'0') if(s=='-') f=-1;
    while(s>='0'&&s<='9') x=(x<<1)+(x<<3)+(s^48),s=getchar();
    return x*f;
}
template <class T> inline void write(const T x) {
    if(x<0) return (void) (putchar('-'),write(-x));
    if(x>9) write(x/10);
    putchar(x%10^48);
}
template <class T> inline T Max(const T x,const T y) {if(x>y) return x; return y;}
template <class T> inline T Min(const T x,const T y) {if(x<y) return x; return y;}
template <class T> inline T fab(const T x) {return x>0?x:-x;}
template <class T> inline T gcd(const T x,const T y) {return y?gcd(y,x%y):x;}
template <class T> inline T lcm(const T x,const T y) {return x/gcd(x,y)*y;}
template <class T> inline T Swap(T &x,T &y) {x^=y^=x^=y;}

#define int long long

const int mod=998244353;

int n,m,be[100000];
char s[1000][1005];

int qkpow(int x,int y) {
	int r=1;
	rep(i,1,y) r=1ll*r*2%mod;
	return r;
}

signed main() {
	n=read(9),m=read(9);
	rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n) rep(j,1,m) {
		int d=0;
		if(s[i][j]=='R') d=1;
		else if(s[i][j]=='B') d=2;
		//int d=(s[i][j]=='R'?1:(s[i][j]=='B'?2:0));
		if(be[i+j]==0) be[i+j]=d;
		else if(d && (be[i+j]^d)) return puts("0"),0;
	}
	int ans=0;
	rep(i,2,n+m) ans+=(be[i]==0);
	print(qkpow(2,ans),'\n');
	return 0;
}


#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector< vector<int> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

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

    double n;
    cin >> n;

    double res = 0.0;

    REP(i,1, n) {
        res += n / i;
    }

    cout << fixed << setprecision(10) << res << endl;

    return 0;
}

#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vii = vector<vector<int>>;
using vll = vector<vector<ll>>;
using vcc = vector<vector<char>>;
using vs = vector<string>;
using Pi = pair<int , int>;
using Pl = pair<ll, ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;
void scan(int& a){ scanf("%d", &a); }
void scan(unsigned& a){ scanf("%u", &a); }
void scan(long& a){ scanf("%ld", &a); }
void scan(long long& a){ scanf("%lld", &a); }
void scan(unsigned long long& a){ scanf("%llu", &a); }
void scan(char& a){ do{ a = getchar(); }while(a == ' ' || a == '\n'); }
void scan(float& a){ scanf("%f", &a); }
void scan(double& a){ scanf("%lf", &a); }
void scan(long double& a){ scanf("%Lf", &a); }
void scan(vector<bool>& a){ for(unsigned i = 0; i < a.size(); i++){ int b; scan(b); a[i] = b; } }
void scan(char a[]){ scanf("%s", a); }
void scan(int& a,int& b){scan(a);scan(b);}
void scan(int& a,int& b,int& c){scan(a);scan(b);scan(c);}
void scan(int& a,int& b,int& c,int& d){scan(a,b);scan(c,d);}
void scan(ll& a,ll& b){scan(a);scan(b);}
void scan(ll& a,ll& b,ll& c){scan(a);scan(b);scan(c);}
void scan(ll& a,ll& b,ll& c,ll& d){scan(a,b);scan(c,d);}
void print(){ putchar(' '); }
void print(bool a){ printf("%d", a); }
void print(int a){ printf("%d", a); }
void print(unsigned a){ printf("%u", a); }
void print(long a){ printf("%ld", a); }
void print(long long a){ printf("%lld", a); }
void print(unsigned long long a){ printf("%llu", a); }
void print(char a){ printf("%c", a); }
void print(char a[]){ printf("%s", a); }
void print(const char a[]){ printf("%s", a); }
void print(float a){ printf("%.15f", a); }
void print(double a){ printf("%.15f", a); }
void print(long double a){ printf("%.15Lf", a); }
void print(const string& a){ for(auto&& i : a) print(i); }
void print(int a,int b){print(a);print();print(b);}
void print(ll a,ll b){print(a);print();print(b);}
void print(int a,int b,int c){print(a,b);print();print(c);}
void print(ll a,ll b,ll c){print(a,b);print();print(c);}
void print(int a,int b,int d,int c){print(a,b,d);print();print(c);}
void print(ll a,ll b,ll d,ll c){print(a,b,d);print();print(c);}
void printe(){printf("\n");}
void printe(int a){ print(a);printe(); }
void printe(ll a){ print(a);printe(); }
void printe(char a){ print(a);printe(); }
void printe(char a[]){ printf("%s", a);printe(); }
void printe(long double a){ print(a);printe(); }
void printe(string a){ print(a);printe(); }
void printe(ll a,ll b){ print(a,b);printe(); }
void printe(ll a,ll b,ll c){ print(a,b,c);printe(); }
void printe(ll a,ll b,ll c,ll d){ print(a,b,c,d);printe(); }
void printe(int a,int b){ print(a,b);printe(); }
void printe(int a,int b,int c){ print(a,b,c);printe(); }
void printe(int a,int b,int c,int d){ print(a,b,c,d);printe(); }
#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(n) for (ll i = 0; i < n; i++)
#define repint(i, n) for (int i = 0; i < n; i++)
#define repld(i, n) for (long double i = 0; i < n; i++)
#define rep2(i, s, n) for (int i = (s); i < n; i++)
#define REP2(s, n) for (int i = (s); i < n; i++)
#define rep3(i ,j, n, m) rep(i,n)rep(j,m)
#define REP3(n, m) rep(i,n)rep(j,m)
#define sort(A) sort(A.begin(),A.end());
#define reverse(A) reverse(A.begin(),A.end());
#define k(s) cout << fixed << setprecision(s);
#define test cout<<"OK"<<endl
#define Yes print("Yes")
#define No print("No")
#define YES print("YES")
#define NO print("NO")
const long double pi=3.14159265358979323846;
const ll INF=1e18;
const int INF32=1e9;
const long long MOD=1000000007;
//const long long MOD=998244353;

int main(){
  int N;
  scan(N);
  long double ans=0;
  repld(i,N) ans+=1.0/(i+1);
  printe(ans*N-1);
}


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

int main() {
  cin.tie(nullptr); // Do not flush "cout" when processing "cin".

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

  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s.at(i);
  }

  int ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (i < h - 1 && s.at(i).at(j) == '.' && s.at(i + 1).at(j) == '.') {
        ans++;
      }
      if (j < w - 1 && s.at(i).at(j) == '.' && s.at(i).at(j + 1) == '.') {
        ans++;
      }
    }
  }

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

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

int main() {
  int n,ct=0;
  string s;
  cin >> n >> s;
  vector<char> t;
  for(int i=0; i<n; i++){
    t.push_back(s[i]);
    if(t.size()>=3&&t[t.size()-3]=='f'&&t[t.size()-2]=='o'&&t[t.size()-1]=='x'){
      t.pop_back();
      t.pop_back();
      t.pop_back();
      ct+=3;
    }
  }
  cout << n-ct;
  return 0;
}


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

#define prc(n) fixed<<setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define endl "\n"
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(v) v.rbegin(),v.rend()
#define siz(x) (int)x.size()
#define ll long long
#define pii pair<int, int>
const int mod = 998244353;
#define int long long

main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	vector<int>a(n), b(n);
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i];
	int ans=0;
	for(int i=0;i<n;i++){
		int a1 = ((a[i]-1)*a[i] / 2), b1 = (b[i] *(b[i]+1) / 2);
		ans+=(b1 - a1);
	}
	cout<<ans<<"\n";
	return 0;

}

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
long long modPow(long long x, long long a) {
  if (a == 1) return x;
  if (a % 2) return (x * modPow(x, a - 1)) % MOD;
  long long t = modPow(x, a / 2);
  return (t * t) % MOD;
}
long long modInv(long long x) {
  return modPow(x, MOD - 2);
  }
  void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {
  int indexes[n];
  for (int i = 0; i < n; i++) indexes[i] = i;
  do {
    f(indexes);
  } while (std::next_permutation(indexes, indexes + n));
}

// nPkの順列に対して処理を実行する
void foreach_permutation(int n, int k, std::function<void(int *)> f) {
  foreach_comb(n, k, [&](int *c_indexes) {
    foreach_permutation(k, [&](int *p_indexes) {
      int indexes[k];
      for (int i = 0; i < k; i++) {
        indexes[i] = c_indexes[p_indexes[i]];
      }
      f(indexes);
    });
  });
}
int main() {
  ll n,q,a,b,c,ans;
  q = 1;
  b = 0;
  cin >> n;
  ans = n;
  while (n >q)
  {
    a = n/q;
    c = n%q;
    if(a+b+c < ans ){
      ans = a+b+c;
    }
    q *= 2;
    b++;
  }

  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
#define rrep(i, n) for(int i=(n); i>=0; i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    double a, b; cin >> a >> b;
    cout << fixed << setprecision(12);
    cout << (a-b) / a * 100 << ln;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

tuple<ll, ll, ll> egcd(ll a, ll b) {
  if (!b) return {a, 1, 0};
  ll g, x, y;
  tie(g, x, y) = egcd(b, a%b);
  return {g, y, x-a/b*y};
}

ll rem(ll a, ll b) {
  if (a < 0) return a % b + b;
  return a % b;
}

int main() {
  ll t; cin >> t;

  rep(q,t) {
    ll n, s, k; cin >> n >> s >> k;

    k %= n;

    ll g, x, y;
    tie(g, x, y) = egcd(n,k);

    if (s % g) {
      cout << -1 << endl;
      continue;
    }

    n /= g;
    s /= g;
    k /= g;

    cout << rem(-y * s, n) << endl;

  }

}


//
// Created by yamunaku on 2020/12/26.
//

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

using namespace std;
//using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    int n;
    cin >> n;
    int m = (1 << 11) - 1;
    rep(i, n) {
        int a = (i * 2) & m, b = (i * 2 + 1) & m;
        if (a >= n) {
            per(j, 11) {
                if (a & (1 << j)) {
                    a ^= (1 << j);
                }
                if (a < n) break;
            }
        }
        if (b >= n) {
            per(j, 11) {
                if (b & (1 << j)) {
                    b ^= (1 << j);
                }
                if (b < n) break;
            }
        }
        cout << a + 1 SP b + 1 << endl;
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
#include<algorithm>
#define it register int
#define ct const int
#define il inline
typedef long long ll;
#define rll register ll
#define cll const ll
#define mkp make_pair
using namespace std;
const int N=1000005;
int n,a,b;
ll ans1,ans2,ans3;
int main(){
	scanf("%d",&n);
	while(n--) scanf("%d",&a),a=(a<0?-a:a),ans1+=a,ans2+=(0ll+a)*a,ans3=(ans3>a?ans3:a);
	printf("%lld\n%.10lf\n%lld\n",ans1,sqrt(1.0*ans2),ans3);
	return 0;
}


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

int main()
{
  // int t;
  // cin >> t;
  // while (t--)
  // {
      ll n;
      cin>>n;
      cout<<n-1;

  // }
}

#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	cout << n - 1 << endl;
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define ll long long
#define F(type, i, a, b, incr) for (type i = a; i <= (type)(b); i += (type)(incr))
#define RF(type, i, a, b, decr) for (type i = a; i >= (type)(b); i -= (type)(decr))
#define sz(a) sizeof(a)
#define deb(a) cerr << " [" << #a << "->" << a << "] "
#define next_line cerr << '\n'
#define all(a) a.begin(), a.end()
#define iter(it, s) for (auto it = s.begin(); it != s.end(); it++)
#define setbits(x) __builtin_popcountll(x)
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

/*
1. If you cannot approach a problem
directly in the way it is proposed
then try to think from backwards
2. Have you checked the implementation
before starting to write the code?
3. Have you read the question carefully ?
4. Keep the names of variable descriptive.
5. Check the types and range of the values properly
6. Erase a iterator in the set or map only after using its value.
7. 1 bitset of 1e9 size only takes 256 mb.
8. Try to use global variables in case of recursion
9. Short and precise exectutes faster
*/

void solve()
{
    int n, su = 0;
    cin >> n;
    vector<pii> vo(n);
    F(int, i, 0, n - 1, 1){
        cin >> vo[i].first >> vo[i].second;
        su += vo[i].first;
    }
    sort(all(vo), [](pii a, pii b){
        return make_pair(2LL*a.first + a.second, a.first) < make_pair(2LL*b.first + b.second, b.first);
    });
    int ans = 0, sc = 0;
    RF(int, i, n - 1, 0, 1){
        if(sc > su){
            break;
        }else{
            ans ++;
            sc += (vo[i].first + vo[i].second);
            su -= (vo[i].first);
        }
    }
    cout << ans << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        // freopen("Debug.txt", "w", stderr);
    #else
    #endif
    // cout << fixed << setprecision(10);
    // int _t;
    // cin>>_t;
    // while(_t --)
        solve();
}

# include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int count=0;
    cin>>N;
    int A[N];
    int B[N];

     for(int i=0;i<N;i++){
        cin>>A[i];
     }
     for(int i=0;i<N;i++){
        cin>>B[i];
     }

         int maxi=*max_element(A,A+N);
       int mini=*min_element(B,B+N);
        if(mini>maxi){
         for(int k=maxi;k<=mini;k++){
         count++;
         }
        }
        if(mini==maxi){
          count++;
        }

          cout<<count;

}


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

tuple<long long, long long, long long> ext_gcd(long long a, long long b) {
  if (b == 0) return {a, 1, 0};
  auto [gcd, y, x] = ext_gcd(b, a%b);
  y -= a/b * x;
  return {gcd, x, y}; // a*x + b*y = gcd
}

pair<long long,long long> crt(const vector<long long> &r, const vector<long long> &m) {
  /* return x that satisfies x = a mod b, for a in r, for b in m */
  /* O(n log lcm(m[i]))*/
  assert(r.size() == m.size());
  auto mod=[&](long long a,long long k){return (a%k+k)%k;}; // a mod k for negative a
  long long y = 0, lcm = 1; int n = r.size();
  for(int i=0; i<n; ++i) {
    assert(m[i] > 0);
    auto [g, p, q] = ext_gcd(lcm, m[i]);
    if(y % g != r[i] % g) return make_pair(0,0);
    long long s = (mod(r[i],m[i]) - y) / g * p % (m[i]/g);
    y = mod(y + lcm*s, lcm*(m[i]/g));
    lcm *= m[i] / g;
  }
  return make_pair(y, lcm); // x = y mod lcm
}

void solve() {
  int x,y,p,q; cin >> x >> y >> p >> q;
  const long long INF = 2e18;
  long long ans = INF;
  for(int a=x; a<x+y; ++a) for(int b=p; b<p+q; ++b) {
    // t = a mod (2x+2y)
    // t = b mod (p+q)
    vector<long long> r(2),m(2);
    r[0] = a, r[1] = b, m[0]=2*(x+y), m[1] = p+q;
    auto [t,lcm] = crt(r,m);
    if(lcm) ans = min(ans,t);
  }
  if (ans == INF) cout << "infinity" << endl;
  else cout << ans << endl;
}

int main() {
  int t; cin >> t;
  while(t--) solve();
}

/*
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma")
//*/
#include <bits/stdc++.h>

using namespace std;

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

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) cout << x , exit(0)
#define migmig ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(x , y) memset(x , y , sizeof x)
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;
char aa , ab , ba , bb;

ll F[maxn];

ll f(int x){
	if(x <= 1)return(F[x] = 1);
	if(F[x])return(F[x]);
	return( F[x] = (f(x - 1) + f(x - 2))%mod );
}

int32_t main(){
    migmig;
	cin >> n >> aa >> ab >> ba >> bb;
	if(n <= 3)dokme(1);
	if(aa == ab && ab == ba && ba == bb)dokme(1);
	if(ab == 'B'){
		if(bb == 'B')dokme(1);
		if(ba == 'A')dokme(pw(2 , n - 3));
		dokme(f(n - 2));
	}
	if(aa == 'A')dokme(1);
	if(ba == 'B')dokme(pw(2 , n - 3));
	dokme((f(n - 2)));

    return(0);
}


#line 1 "/home/siro53/kyo-pro/compro_library/template/template.cpp"
#include <bits/stdc++.h>
using namespace std;
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 DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define FOR(i, a, b) for(int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
#line 2 "f.cpp"

ll A, B, N;

vector<int> p;

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

void init() {
    for(int i=2;i<=72;i++) {
        if(is_prime(i)) p.push_back(i);
    }
}

int main() {
    init();
    cin >> A >> B;
    N = B - A + 1;
    int n = p.size();

    vector<vector<ll>> dp(N+1, vector<ll>(1 << n, 0));
    dp[0][0] = 1;

    vector<int> pre_bit(N, 0);
    REP(i, N) {
        ll num = A + i;
        REP(j, n) if(num % p[j] == 0) pre_bit[i] |= (1 << j);
    }

    REP(i, N) {
        REP(S, 1 << n) {
            // 追加しない
            dp[i+1][S] += dp[i][S];
            // 追加する
            ll num = i+A;
            if(S & pre_bit[i]) continue;
            int nS = S | pre_bit[i];
            dp[i+1][nS] += dp[i][S];
        }
    }

    ll ans = 0;
    REP(S, 1 << n) ans += dp[N][S];

    cout << ans << endl;
}

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
const int MAXN=2e5+5;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
//inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}
int n;char s[MAXN];
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	for(int t=read();t--;){
		n=read(),scanf("%s%s%s",s+1,s+1,s+1);
		Rep(i,1,n)cout<<'0';Rep(i,1,n)cout<<'1';cout<<'0';puts("");
	}
	return 0;
}


/*debug-------------------------------------------------------------------------------*/
#define _GLIBCXX_DEBUG
#ifdef _DEBUG
#define debug(...) COUT(__VA_ARGS__)
#else
#define debug(...)
#endif
/*include&using-----------------------------------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;
/*typename----------------------------------------------------------------------------*/
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using P = pair<T,T>;
template <class T> using M = map<T,T>;
template <class T> using S = set<T>;
template <class T> using PQ = priority_queue<T>;
template <class T> using PQG = priority_queue<T,V<T>,greater<T>>;
using ll = long long;
using st = string;
using vl = V<ll>;
using vvl = V<V<ll>>;
using vc = V<char>;
using vvc = V<V<char>>;
using vs = V<st>;
using vvs = V<V<st>>;
using vb = V<bool>;
using vvb = V<V<bool>>;
/*constant----------------------------------------------------------------------------*/
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
/*macro-------------------------------------------------------------------------------*/
#define re(n) for(ll _ = 0; _ < (ll) n; _++)
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define repp(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define bitrep(i,n) for(ll i = 0; i < (1<<(ll)n); i++)
#define each(x,A) for(auto &(x): (A))
#define all(A) A.begin(), A.end()
#define len(A) ll(A.size())
#define pb(a) push_back(a)
#define mp make_pair
#define pc cout << setprecision(15) << fixed
/*input-------------------------------------------------------------------------------*/
void CIN(){}
template <class Head,class... Tail>
void CIN(Head&& h,Tail&&... t){cin>>h; CIN(t...);}
#define CINL(...) ll __VA_ARGS__;CIN(__VA_ARGS__)
#define CINS(...) string __VA_ARGS__;CIN(__VA_ARGS__)
#define CIND(...) double __VA_ARGS__;CIN(__VA_ARGS__)
/*output------------------------------------------------------------------------------*/
void COUT(){cout << endl;}
template <class Head, class... Tail>
void COUT(Head h, Tail... t){cout << h << " "; COUT(t...);}
/*function----------------------------------------------------------------------------*/
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
template <class T> T ceil(T a,T b){return (a+b-1)/b;}
template <class T> void chmax(T &a, const T& b){if(a<b){a=b;}}
template <class T> void chmin(T &a, const T& b){if(a>b){a=b;}}
template <class T> T gcd(T a,T b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
template <class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template <class T> T modpow(T x,T n,T mod){T res=1; for(ll i=0;i<n;i++){res=res*x%mod;}return res;}
bool range(ll ny, ll nx, ll H, ll W) {if(ny < 0 || ny >= H || nx < 0 || nx >= W) return false; return true;}
/*------------------------------------------------------------------------------------*/

int main() {
  CINL(h,w,x,y);
  x--;
  y--;
  vs s(h);
  rep(i,h){
    CIN(s[i]);
  }

  ll ans = 1;
  rep(d,4){
    ll nx = x + dx[d];
    ll ny = y + dy[d];
    while(range(ny,nx,w,h)){
      if(s[nx][ny] == '#') {
        break;
      }
      else {
        ans++;
        debug(nx, ny);
      }
      nx += dx[d];
      ny += dy[d];
    }
  }

  COUT(ans);
}

//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cerr << "booga" << endl
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define safai(...) Clearing_out(__VA_ARGS__)

template <typename A, typename B>
	string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
	string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
	string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(char c) {
	string s;
	s += c;
	return s;
}

string to_string(const char* s) {
	return to_string((string) s);
}

string to_string(bool b) {
	return (b ? "1" : "0");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
	if (!first) {
		res += ", ";
	}
	first = false;
	res += to_string(v[i]);
	}
	res += "}";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

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

void Clearing_out() { return; }

template <typename Head, typename... Tail>
void Clearing_out(Head &H, Tail & ... T) {
	H.clear();
	Clearing_out(T...);
}

void testcase(){
	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int> (5));
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 5; j++){
			cin >> a[i][j];
		}
	}
	int low = 1, high = 1000000000;
	int ans = 1;
	while(low <= high){
		int mid = (low+high)/2;
		set<int> all;
		for(int i = 0; i < n; i++){
			int kk = 1;
			int curr = 0;
			for(int j = 0; j < 5; j++){
				if(a[i][j] >= mid) curr += kk;
				kk *= 2;
			}
			all.insert(curr);
		}
		int f = 0;
		//debug(all);
		for(auto i : all) for(auto j : all) for(auto k : all) if((i | j | k) == 31){
			f = 1;
			ans = mid;
		}
		if(f) ans = mid, low = mid+1;
		else high = mid-1;
	}
	cout << ans << '\n';
}

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while(tt--){
		testcase();
	}
	return 0;
}


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

#define endl            '\n'
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e8
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define range(a,b)        substr(a,b-a+1)
#define w(x)            int x; cin>>x; while(x--)
#define trace(x)         cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(c%2==0)  c=2;
    else c=1;

    int val1,val2;
    val1=(int)pow(a,c);
    val2=(int)pow(b,c);
    char ans;

    if(val1==val2)
    {
        ans='=';
    }
    else if(val1>val2)
    {
        ans='>';
    }

    else
    {
        ans='<';
    }

    cout<<ans;
}

int32_t main()
{
    FIO;
    // w(t)
        solve();
    return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int num[8210];
int kazu[8210];
const int ma = (1 << 13) - 1;
int query(int n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 2 % 8209;
	}
	return 0;
}
void add(int n, int b) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return;
		n2 = n2 * 2 % 8209;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}
int li[300];

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

	int N, M;
	cin >> N >> M;
	int w[8];
	rep(i, N) cin >> w[i];

	pair<int, int> lv[100001];
	rep(i, M) {
		int l, v;
		cin >> l >> v;
		lv[i] = { v, l };
	}
	sort(lv, lv + M);
	lv[M] = { 1e9,1e9 };

	rep(i, 1 << N) {
		rep(j, N) if (i >> j & 1) li[i] += w[j];
	}
	sort(li, li + (1 << N));
	int saidai = 0;
	int k = 0;
	rep(i, 1 << N) {
		while (lv[k].first < li[i]) {
			if (saidai < lv[k].second) saidai = lv[k].second;
			k++;
		}
		add(li[i], saidai);
	}

	rep(i, N) {
		if (w[i] > lv[0].first) {
			printf("-1");
			return 0;
		}
	}
	int P[8];
	rep(i, N) P[i] = i;

	int kotae = 1e9;
	do {
		int tmp[8] = {};
		rep(p, N - 1) {
			int omosa = w[P[p]];
			for (int q = p + 1; q < N; q++) {
				omosa += w[P[q]];
				int kari = tmp[p] + query(omosa);
				if (tmp[q] < kari) tmp[q] = kari;
			}
		}
		if (kotae > tmp[N - 1]) kotae = tmp[N - 1];

	} while (next_permutation(P, P + N));

	printf("%d\n", kotae);

	Would you please return 0;
}


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

int main(){
   string s;
   cin >> s;
   for(int i = 0; i < s.length(); i++){
       if(s.at(i) == '6'){
           s.at(i) = '9';
       }else if(s.at(i) == '9'){
            s.at(i) = '6';
       }
   }
    reverse(s.begin(),s.end());
    cout << s << endl;
}

#include<stdio.h>
#include<string.h>

int main(void){

  char str[100000+1];
  scanf("%s",str);
  for(int i=0;i<strlen(str);i++){
    switch(str[strlen(str)-1-i]){
      case '6':
        printf("%c",str[strlen(str)-1-i]+3);
        break;
      case '9':
        printf("%c",str[strlen(str)-1-i]-3);
        break;
      default:
         printf("%c",str[strlen(str)-1-i]);
        break;
    }
  }

  return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cctype>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
inline int read_int(){
    int t=0;bool sign=false;char c=getchar();
    while(!isdigit(c)){sign|=c=='-';c=getchar();}
    while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
    return sign?-t:t;
}
inline LL read_LL(){
    LL t=0;bool sign=false;char c=getchar();
    while(!isdigit(c)){sign|=c=='-';c=getchar();}
    while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
    return sign?-t:t;
}
inline char get_char(){
    char c=getchar();
    while(c==' '||c=='\n'||c=='\r')c=getchar();
    return c;
}
inline void write(LL x){
    char c[21],len=0;
    if(!x)return putchar('0'),void();
    if(x<0)x=-x,putchar('-');
    while(x)c[++len]=x%10,x/=10;
    while(len)putchar(c[len--]+48);
}
inline void space(LL x){write(x),putchar(' ');}
inline void enter(LL x){write(x),putchar('\n');}
LL cal(LL n,LL p){
	int pos=3;
	LL ans=0;
	while(p>0){
		LL t=n;
		while(t>=p){
			t-=p;
			ans++;
		}
		if(pos==3)pos=4;
		else pos=3;
		n=p;
		p=t;
	}
	return ans+n;
}
int main()
{
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	LL n=read_LL();
	LL v=n*2/(sqrt(5)+1);
	for(LL i=max(v-20,0LL);i<=min(v+20,n);i++){
		if(cal(n,i)<125){
			LL p=i;
			stack<int> s;
			int pos=3;
			while(p>0){
				LL t=n;
				while(t>=p){
					t-=p;
					s.push(pos);
				}
				if(pos==3)pos=4;
				else pos=3;
				n=p;
				p=t;
			}
			enter(s.size()+n);
			LL tn=0,tp=0;
			_for(i,0,n){
				if(pos==3){
					tn++;
				}
				else
				tp++;
				enter(pos-2);
			}
			while(!s.empty()){
				enter(s.top());
				if(s.top()==3)
				tn=tn+tp;
				else
				tp=tn+tp;
				s.pop();
			}
			return 0;
		}
	}
	return 0;
}

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

int main() {
  string a = "";
  int si, sj, x;
  cin >> si >> sj;
  set<int> s;
  map<pair<int, int>, pair<int, int>> m;
  map<int, int> t;
  for (int i = 0; i < 50; i++) {
    for (int j = 0; j < 50; j++) {
      cin >> x;
      m[make_pair(i, j)] = make_pair(x, 0);
      if (t.count(x)) {
        t.at(x)++;
      }
      else {
        t[x] = 1;
      }
    }
  }
  s.insert(m.at(make_pair(si, sj)).first);
  for (int i = 0; i < 50; i++) {
    for (int j = 0; j < 50; j++) {
      cin >> x;
      m.at(make_pair(i, j)).second = x;
    }
  }
  if (si > 24 && sj > 24) {
    for (int i = 0; i < 2499; i++) {
      if (si != 0 && !(s.count(m.at(make_pair(si - 1, sj)).first))) {
      	s.insert(m.at(make_pair(si - 1, sj)).first);
	    a += "U";
	    si--;
      }
      else if (sj != 0 && !(s.count(m.at(make_pair(si, sj - 1)).first))) {
        s.insert(m.at(make_pair(si, sj - 1)).first);
        a += "L";
        sj--;
      }
      else if (si != 49 && !(s.count(m.at(make_pair(si + 1, sj)).first))) {
	    s.insert(m.at(make_pair(si + 1, sj)).first);
        a += "D";
        si++;
      }
      else if (sj != 49 && !(s.count(m.at(make_pair(si, sj + 1)).first))) {
        s.insert(m.at(make_pair(si, sj + 1)).first);
        a += "R";
        sj++;
      }
      else {
        break;
      }
    }
  }
  else if (si > 24 && sj < 25) {
    for (int i = 0; i < 2499; i++) {
      if (si != 0 && !(s.count(m.at(make_pair(si - 1, sj)).first))) {
      	s.insert(m.at(make_pair(si - 1, sj)).first);
	    a += "U";
	    si--;
      }
      else if (sj != 49 && !(s.count(m.at(make_pair(si, sj + 1)).first))) {
        s.insert(m.at(make_pair(si, sj + 1)).first);
        a += "R";
        sj++;
      }
      else if (si != 49 && !(s.count(m.at(make_pair(si + 1, sj)).first))) {
	    s.insert(m.at(make_pair(si + 1, sj)).first);
        a += "D";
        si++;
      }
      else if (sj != 0 && !(s.count(m.at(make_pair(si, sj - 1)).first))) {
        s.insert(m.at(make_pair(si, sj - 1)).first);
        a += "L";
        sj--;
      }
      else {
        break;
      }
    }
  }
  else if (si < 25 && sj < 25) {
    for (int i = 0; i < 2499; i++) {
      if (si != 49 && !(s.count(m.at(make_pair(si + 1, sj)).first))) {
	    s.insert(m.at(make_pair(si + 1, sj)).first);
        a += "D";
        si++;
      }
      else if (sj != 49 && !(s.count(m.at(make_pair(si, sj + 1)).first))) {
        s.insert(m.at(make_pair(si, sj + 1)).first);
        a += "R";
        sj++;
      }
      else if (si != 0 && !(s.count(m.at(make_pair(si - 1, sj)).first))) {
      	s.insert(m.at(make_pair(si - 1, sj)).first);
	    a += "U";
	    si--;
      }
      else if (sj != 0 && !(s.count(m.at(make_pair(si, sj - 1)).first))) {
        s.insert(m.at(make_pair(si, sj - 1)).first);
        a += "L";
        sj--;
      }
      else {
        break;
      }
    }
  }
  else {
    for (int i = 0; i < 2499; i++) {
	  if (si != 49 && !(s.count(m.at(make_pair(si + 1, sj)).first))) {
	    s.insert(m.at(make_pair(si + 1, sj)).first);
        a += "D";
        si++;
      }
      else if (sj != 0 && !(s.count(m.at(make_pair(si, sj - 1)).first))) {
        s.insert(m.at(make_pair(si, sj - 1)).first);
        a += "L";
        sj--;
      }
      else if (si != 0 && !(s.count(m.at(make_pair(si - 1, sj)).first))) {
      	s.insert(m.at(make_pair(si - 1, sj)).first);
	    a += "U";
	    si--;
 	  }
      else if (sj != 49 && !(s.count(m.at(make_pair(si, sj + 1)).first))) {
        s.insert(m.at(make_pair(si, sj + 1)).first);
        a += "R";
        sj++;
      }
      else {
        break;
      }
    }
  }
  cout << a << endl;
}


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

#define f first
#define s second
#define pb push_back
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int) x.size()
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define FOR(i, a, b) for(auto i=(a); i<(b); i++)
#define ROF(i, a, b) for(auto i=(b)-1; i>=(a); i--)
#define F0R(i, n) FOR(i, 0, n)
#define R0F(i, n) ROF(i, 0, n)

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using vi=vector<int>;
using vl=vector<ll>;
using vpii=vector<pii>;

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 b>a?a=b,1:0;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mxN=1e5+10;
const int MOD=1e9+7;
const ll infLL=1e18;
const ld eps=1e-6;

template<int mod> struct mint {
	int v; explicit operator int() const{return v;}
	mint() {v=0;}
	mint(ll _v) { v =int((-mod< _v&&_v<mod)?_v:_v%mod);
		if(v < 0) v+=mod;}
	friend bool operator==(const mint& a, const mint& b){
		return a.v==b.v;}
	friend bool operator!=(const mint& a, const mint& b){
		return !(a==b);}
	friend bool operator<(const mint& a, const mint& b){
		return a.v<b.v;}
	mint& operator+=(const mint& m) {
		if((v+=m.v)>=mod) v-=mod;
		return *this;}
	mint& operator-=(const mint& m) {
		if((v-=m.v)<0) v+=mod;
		return *this;}
	mint& operator*=(const mint& m){
		v=int((ll)v*m.v%mod); return *this;}
	mint& operator/=(const mint& m) {return (*this)*=inv(m);}
	friend mint pow(mint a, ll p) {
		mint ans = 1; assert(p >= 0);
		for (;p;p/=2,a*=a) if(p&1) ans*=a;
		return ans;}
	friend mint inv(const mint& a){assert(a.v!=0);
		return pow(a,mod-2);}
	mint operator-() const{return mint(-v);}
	friend mint operator+(mint a, const mint& b) {return a+=b;}
	friend mint operator-(mint a, const mint& b) {return a-=b;}
	friend mint operator*(mint a, const mint& b) {return a*=b;}
	friend mint operator/(mint a, const mint& b) {return a/=b;}
};

using mi=mint<MOD>;

vector<mi> invs, fac, ifac;
void genFac(int SZ=mxN) {
	invs.resize(SZ), fac.resize(SZ), ifac.resize(SZ); vi Invs(SZ);
	Invs[1]=1; invs[1]=fac[0]=ifac[0]=1;
	FOR(i,2,SZ) Invs[i] = int(MOD-(ll)MOD/i*Invs[MOD%i]%MOD), invs[i]=mi(Invs[i]);
	FOR(i,1,SZ) {
		fac[i]=fac[i-1]*i;
		ifac[i]=ifac[i-1]*invs[i];
	}
}

mi choose(int n, int k){
	if(k>n) return 0;
	return fac[n]*ifac[n-k]*ifac[k];
}

int n;
int a[mxN];

mi dp[mxN][2];

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	F0R(i, n) cin >> a[i];
	dp[0][0]=1;
	FOR(i, 1, n+1){
		dp[i][0]=dp[i-1][0]+dp[i-1][1];
		dp[i][1]=dp[i-1][0];
	}
	mi ans=0;
	F0R(i, n){
		if(i==0){
			ans+=(dp[n-1][0]+dp[n-1][1])*a[i];
		}
		else{
			ans+=(dp[n-1-i][0]+dp[n-1-i][1])*(dp[i-1][0]+dp[i-1][1])*a[i];
			ans-=dp[n-1-i][0]*dp[i-1][0]*a[i];
		}
	}
	cout << ans.v << "\n";
	return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
    return uniform_int_distribution<int>(l, r)(rng);
}

void run_case() {
    ll n;
    cin>>n;
    vector<ll> vec(n);
    for(auto& it : vec) cin>>it;

    ll dp[n+100][2];
    memset(dp, 0, sizeof(dp));
    dp[1][0] = 1;
    dp[1][1] = 1;
    for(int i = 2; i <= n+5; ++i) {
        (dp[i][0] = dp[i-1][0] + dp[i-1][1]) %= mod;
        (dp[i][1] = dp[i-1][0]) %= mod;
    }

    dp[0][0] = dp[0][1] = 0;
    dp[0][0] = 1;

    ll sum = (vec[0] * ((dp[n-1][0] + dp[n-1][1])%mod))%mod;
    for(int i = 1; i < n; ++i) {
        ll cur1 = (dp[i-1][0] + dp[i-1][1])%mod;
        (cur1 *= (dp[n - i - 1][0] + dp[n - i - 1][1])) %= mod;
        (sum += cur1 * vec[i]) %= mod;

        ll cur2 = (dp[i-1][0])%mod;
        (cur2 *= dp[n-i-1][0]) %= mod;
        (sum -= cur2*vec[i]) %= mod;
        (sum += mod) %= mod;
        //cout<<cur1<<" "<<cur2<<" "<<dp[n-i-1][1]<<" "<<sum<<endl;
    }
    cout<<sum%mod<<endl;
}

int32_t main()  {
    fastio
    int t = 1;
    //cin>>t;
    for(int i = 0; i < t; ++i) {
        run_case();
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b)  for(ll i=a;i<=b;i++)
#define FORR(i,a,b) for(ll i=a;i>=b;i--)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define rep(i,n) for(ll i=0;i<n;i++)
#define vl vector<ll>
#define vi vector<int>
#define ld long double
#define vld vector<ld>
#define vvl vector<vector<ll> >
#define vvi vector<vector<int> >
#define vvld vector<vector<ld> >
#define pll pair<ll,ll>
#define vpll vector<pll>
#define fi first
#define se second
#define pb push_back
#define pf push_front //only for deque
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end())
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rsortv(vec) sort(vec.begin(),vec.end(), greater<ll>())
#define mset(a,val) memset(a,val,sizeof(a));
#define PI 3.14159265358979323846264338327950288419716939937510
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define FAST std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const ll N = 2e5 + 5;
const ll INF = 10000000000000;
const ll mod= 1e9 +7;
ll mind(ll x, ll y)
{
    if (x < y) {
        return x;
    }
    else
    {
        return y;
    }
}

ll poww(ll a, ll b) {
  if (b < 0 || a <= 0)return 0;
  ll ans = 1LL;
  while (b) {
    if (b & 1)ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}

ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b,a%b);
}
ll getSum(ll num)
    {
        ll sum = 0;
        while (num != 0) {
            sum = sum + num % 10;
            num = num / 10;
        }
        return sum;
    }
 ll isPrime(ll num){
    if(num<=1)return 0;
    for(ll i=2; i*i<=num; i++){
        if(num%i==0){
            return 0;
        }
    }
    return 1;
}
int retMaxDig(int num){
    string s= to_string(num);
    int max= 0;
    rep(i,s.size()){
        if(s[i]-'0'>max)max=s[i]-'0';
    }
    return max;
}
ll decimalToBinary(ll num)
{

    // To store the binary number
    ll B_Number = 0;
    ll cnt = 0;
    while (num != 0) {
        ll rem = num % 2;
        ll c = poww(10, cnt);
        B_Number += rem * c;
        num /= 2;

        // Count used to store exponent value
        cnt++;
    }

    return B_Number;
}
ll binomialCoeff(ll n, ll k)
{
    ll res = 1;
    if(n<k){
      res= 0;
      return res;
    }
    // Since C(n, k) = C(n, n-k)
    if (k > n - k)
        k = n - k;

    // Calculate value of
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
    for (ll i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
ll isPalindrome(string str){
    ll num= str.size();
    FOR(i,0,(num-1)/2){
        if(str[i]!=str[num-i-1]){
            return 0;
        }
    }
    return 1;
}
 ll factorial(ll n)
{
    if(n == 0)
          return 1;
    ll i = n, fact = 1;
    while (n / i != n) {
        fact = fact * i;
        i--;
    }
    return fact;
}
//////////////////////////////END OF TEMPLATE//////////////////////////////

int main(){

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

  ll a,b,c;cin>>a>>b>>c;
  if(a*a+b*b<c*c)cout<<"Yes";
  else cout<<"No";

return 0;

}

#include<bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define fo(i,n) for (int i = 0; i <n; i++)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t = 1;
  // cin >> t;
    while(t--)
    {
      ll n=0,c1=0,i=0,sum=0,k1=0,j=0,k2=0;
      string s="";
   ll a,b,c;
   cin>>a>>b>>c;a*=a;b*=b;c*=c;
   cout<<((a+b)<c?"Yes":"No");

    cout<<endl;
}}


#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cassert>
#include <random>
#include <chrono>

/* #include <atcoder/all> */
/* using namespace atcoder; */
using namespace std;

void debug_out(){ cout << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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 int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1000000007;
/* const ll MOD = 998244353; */
const ll INF = 1ll<<60;
const double PI = acos(-1);

struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

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

  REP(i, s.size()){
    if(s[i] == '.') break;
    cout << s[i];
  }
  cout << "\n";

  return 0;
}

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

int main() {

    long long n;
    cin >> n;

    vector<int> mod(3, 0);
    int dig=0;
    while(n > 0) {
        mod[n%10ll%3ll]++;
        n /= 10ll;
        dig++;
    }

    int ans=dig;

    for(int i=0; i<=min(mod[1], mod[2]); i++) {
        ans = min(ans, ((mod[1]-i)%3) + ((mod[2]-i)%3));
    }

    cout << (ans==dig ? -1 : ans) << endl;

    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}

int main(){

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

    int a,b;
    cin >> a >> b;
    cout << (a+b)/2 csp (a-b)/2 << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    int a, b;
    cin >> a >> b;
    cout << (a+b)/2 << " " << (a-b)/2 << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
  int a,b; cin >> a >> b;
  int dis = b - a + 1;
  int ans = 0;
  while(dis > 1){
    int tmp = b / dis;
    if(a <= dis * (tmp -1)){
      cout << dis;
      return 0;
    }
    dis--;
  }
  cout << dis;
}

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

int bs(vector<int> &arr, int n)
{
    int left = 0, right = arr.size() - 1;
    while(left <= right) {
        int mid = left + (right - left) / 2;
        if(arr[mid] == n) {
            return mid;
        }
        else if(arr[mid] > n) {
            right = mid - 1;
        }
        else {
            left = mid + 1;
        }
    }
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long int a, b;
    cin >> a >> b;
    long long int ans = abs(a - b);
    if(ans >= 3) {
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }
}


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

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

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

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

    return 0;
}

#include<bits/stdc++.h>
#define maxn 1005
using namespace std;
vector<int> edge[1005][26];
int dp[1001][1001][27];
int mp[1001][1001];
int n,m;
int u,v; char c;
struct nod{
	int u,v,c;
	nod() {}
	nod(int x,int y,int z) {u=x; v=y; c=z;}
};
nod q[27000005];
int head,tail;
void bfs()
{
	dp[1][n][26]=1;
	head=tail=1; q[1]=nod(1,n,26);
	while (head<=tail)
	{
		nod tt=q[head++];
		int u,v,c;
		u=tt.u; v=tt.v; c=tt.c;
//		cout<<u<<" "<<v<<" "<<c<<" "<<dp[u][v][c]<<endl;
		if (c!=26)
		{
			int siz=edge[v][c].size();
			for (int j=0;j<siz;j++)
			{
				int temp=edge[v][c][j];
				if (dp[u][temp][26]==0)
				{
					dp[u][temp][26]=dp[u][v][c]+1;
					q[++tail]=nod(u,temp,26);
				}
			}
		}
		else
		{
			for (int o=0;o<=25;o++)
			{
				int siz=edge[u][o].size();
				for (int j=0;j<siz;j++)
				{
					int temp=edge[u][o][j];
					if (dp[temp][v][o]==0)
					{
						dp[temp][v][o]=dp[u][v][c]+1;
						q[++tail]=nod(temp,v,o);
					}
				}
			}
		}
	}
	long long ans=99999999;
	for (int i=1;i<=n;i++)
	if (dp[i][i][26]!=0)
	{
		ans=min(ans,dp[i][i][26]-1ll);
	}
	for (int i=1;i<=n;i++)
	for (int j=1;j<=n;j++)
	if (dp[i][j][26]!=0 && mp[i][j]==1)
	{
		ans=min(ans,dp[i][j][26]+0ll);
	}
	if (ans==99999999) cout<<-1<<endl; else cout<<ans<<endl;
	return;
}

int main()
{
	cin>>n>>m;
	for (int i=1;i<=m;i++)
	{
		cin>>u>>v>>c;
		int C=c-='a';
		edge[u][C].push_back(v);
		edge[v][C].push_back(u);
		mp[u][v]=mp[v][u]=1;
	}
	bfs();
}


/*input
3
0 0
0 1
1 0
2 0
3 0
3 1

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long,null_type,less_equal<long long>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("O2","unroll-loops","no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll=long long;
using ld=long double;
using pii=pair<ld,ld>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()),c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=1e18+1;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-3;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
inline ll mult(ll a,ll b){
    if(a>=MOD) a%=MOD;
    if(b>=MOD) b%=MOD;
    return (a*b)%MOD;
}
inline ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const int maxn=3e3+5;
const int maxlg=__lg(maxn)+2;
ll get(pii a){
    return (a.f*a.f+a.s*a.s);
}

bool cmp(pii a,pii b){
    if(atan2(a.s,a.f)==atan2(b.s,b.f)) return get(a)<get(b);
    return atan2(a.s,a.f)<atan2(b.s,b.f);
}
ld cross(pii a,pii b){
    if(sqrt((a.f*a.f+a.s*a.s)*(b.f*b.f+b.s*b.s))==0) return 1;
    return (a.f*b.f+a.s*b.s)/sqrt((a.f*a.f+a.s*a.s)*(b.f*b.f+b.s*b.s));
}
int n;
void shift(pii a[]){
    int x=0,y=0;
    REP(i,n){
        x+=a[i].f,y+=a[i].s;
        a[i].f*=n,a[i].s*=n;
    }
    REP(i,n) a[i].f-=x,a[i].s-=y;
}
pii a[maxn],b[maxn];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    cin>>n;
    REP(i,n){
        cin>>a[i].f>>a[i].s;
    }
    REP(i,n) cin>>b[i].f>>b[i].s;
    shift(a),shift(b);
    REP(i,n) if(a[i].f or a[i].s){
        swap(a[i],a[0]);
        swap(b[i],b[0]);
        break;
    }
    REP(i,n){
        ld z=atan2(b[i].s,b[i].f)-atan2(a[0].s,a[0].f);
        bool wk=1;
        ld s=sin(z),cc=cos(z);
        REP(j,n){
            pii tmp;
            tmp.f=a[j].f*cc-a[j].s*s;
            tmp.s=a[j].f*s+a[j].s*cc;
            bool ok=0;
            REP(k,n){
                if(abs(tmp.f-b[k].f)<=eps and abs(tmp.s-b[k].s)<=eps) ok=1;
            }
            wk&=ok;
        }
        if(wk){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}

#include <iostream>
#include <vector>
#include  <set>
#include <math.h>
#include <algorithm>
#define MAXA 1000000
#define ll long long
using namespace std;

int GetNorm(int x,int y) {
    return x*x+y*y;
}
int A[111];
int B[111];
int C[111];
int D[111];

bool Check(int N) {
    if (N == 1) return true;
    vector<pair<ll,ll>> right_pts;
    for(int i=1;i<=N;i++) {
        right_pts.push_back({C[i],D[i]});
    }
    sort(right_pts.begin(),right_pts.end());
    int xans, yans, denomans;
    denomans=-1;
    for(int i=1;i<=N;i++) {
        for(int j=1;j<=N;j++) {
            if (i == j) continue;
            ll dA = A[1]-A[2];
            ll dB = B[1]-B[2];
            ll dC = C[i]-C[j];
            ll dD = D[i]-D[j];
            // A[i]-A[j], B[j]-B[j]
            if (GetNorm(dA, dB) != GetNorm(dC, dD)) {
                continue;
            }
            ll x = dC*dA+dD*dB;
            ll y = dA*dD-dC*dB;
            ll denom = GetNorm(dA, dB);

            // x/denom+j*y/denom

            // (A[1]+j*B[1])*(x+j*y) + delta = C[i]+j*D[i]

            ll delta_1 = C[i]*denom-(A[1]*x-y*B[1]);
            ll delta_2 = D[i]*denom-(A[1]*y+x*B[1]);

            vector<pair<ll,ll>> pts;
            bool ok=true;
            for(int k=1;k<=N;k++) {
                // (A[i]+j*B[i])*(x+j*y) + delta
                ll X = A[k]*x-B[k]*y+delta_1;
                ll Y = A[k]*y+B[k]*x+delta_2;
                if (X%denom != 0 || Y%denom != 0) ok=false;
                pts.push_back({X/denom,Y/denom});
            }
            if (!ok) continue;

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

            if (pts==right_pts) return true;
        }
    }
    return false;

}

int main() {
    int N;
    cin>>N;
    for(int i=1;i<=N;i++) {
        cin>>A[i]>>B[i];
    }
    for(int i=1;i<=N;i++) {
        cin>>C[i]>>D[i];
    }
    if (Check(N)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MAXNUM = 1000000000;
const int MaxSize = 1e5*3;
ll A[211000];
ll p[211000];
struct node {
    int x,y;
};
node point[MaxSize];
bool cmp(node a,node b) {
    if(a.x!=b.x) return a.x<b.x;
    return a.y<b.y;
}
vector<int>vec[MaxSize];

int main() {
    ll ans = 0;
    int n; scanf("%d",&n);
//    for(int i=1;i<=n;i++) scanf("%d",&A[i]);
//    for(int i=1;i<=n;i++) {
//        for(int j=1+i;j<=n;j++) {
//            ans += abs(A[i]-A[j]);
//        }
//    }
    for(int i=1;i<=n;i++) scanf("%lld",&A[i]);
    sort(A+1,A+n+1);
    p[1]=0;
    for(int i=2;i<=n;i++) {
        p[i] = (i-1)*(A[i]-A[i-1])+p[i-1];
    }
    for(int i=1;i<=n;i++) ans += p[i];
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define each(e, v) for(auto &e: v)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct io_setup{
    io_setup(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout << fixed << setprecision(15);
    }
} io_setup;

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

    vector<ll> A(2*N);
    rep(i, 2*N) cin >> A[i];

    vector<ll> B(2*N);
    rep(i, N){
        B[2*i] = A[N-1-i], B[2*i+1] = A[N+i];
    }

    priority_queue<ll, vector<ll>, greater<ll>> que;
    ll S = accumulate(all(A), 0LL);

    rep(i, N){
        que.emplace(B[2*i]), que.emplace(B[2*i+1]);
        S -= que.top(); que.pop();
    }

    cout << S << '\n';
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=100002;

int n,m;
int a[maxn];

signed main()
{
	scanf("%lld%lld%lld",&a[1],&a[2],&a[3]);
	sort(a+1,a+4);
	cout<<a[2]+a[3];
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long;
#define INF32 2147483647
const long long INF = 1LL << 60;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;} return 0;}
template<class T> bool chmin(T &a,const T &b){if(b<a){a=b;return 1;} return 0;}

int main(){
    double R,X,Y;
    cin >> R >> X >> Y;
    // // double RR = R * R;
    // // double length = sqrt(X * X + Y * Y);
    ll lengthlength = X * X + Y * Y;
    // // cout << length << endl;
    // if(lengthlength / (R * R) == 1){
    //     cout << 1 << endl;
    //     // cout << sqrt(lengthlength / (R * R)) << endl;
    // }else if(lengthlength <= (R * R) * 4){
    //     cout << 2 << endl;
    // }else{
    //     //cout << sqrt(lengthlength / (R * R))  << endl;
    //     cout << ceil(sqrt(lengthlength / (R * R)))  << endl;
    // }
    // int max = sqrt(X * X + Y * Y) / R + 1;
    // // cout << max << endl;
    // for(int i=1;i<=max;i++){
    //     if(R * i <= length && length < R * (i + 1)){
    //         cout << i << endl;
    //         return 0;
    //     }
    // }
    // cout << "------------------------" << endl;
    int ans = 0;
    double max2 = sqrt(X * X + Y * Y) / R + 1;
    // // cout << max2 << endl;
    for(int i=1;i<=max2;i++){
        if(R * R * i * i == lengthlength){
            ans = i;
            cout << ans << endl;
            return 0;
        }else if(lengthlength < R * R * (i + 1) * (i + 1)){
            ans = i + 1;
            cout << ans << endl;
            return 0;
        }
    }
    cout << ans << endl;

    // double distance = sqrt(X * X + Y * Y);
    // double distancedistance = X * X + Y * Y;
    // if(distancedistance == R * R){
    //     cout << 1 << endl;
    // }else if(distancedistance <= (2 * R) * (2 * R)){
    //     cout << 2 << endl;
    // }else{
    //     cout << ceil(sqrt(distancedistance / (R * R))) << endl;
    // }
    // if(distance == R){
    //     cout << 1 << endl;
    // }else if(distance <= (R + R)){
    //     cout << 2 << endl;
    // }else{
    //     cout << ceil(distance / R) << endl;
    // }
    return 0;
}