#include<bits/stdc++.h>

#define x first
#define y second
#define PII pair<int,int>
#define LL long long

using namespace std;

const int N=2010;

int n,m;
int h[N],e[N],ne[N],idx;
int ans;
bool st[N];

void add(int a,int b){
   e[idx]=b,ne[idx]=h[a],h[a]=idx++;
}

void dfs(int u) {
    st[u]=true;
	for (int i=h[u];~i;i=ne[i]){
        if (!st[e[i]]) {
        	ans++;
            dfs(e[i]);
		}
    }
}

int main(){

	memset(h,-1,sizeof h);

	scanf("%d%d",&n,&m);

	if(m==0){
		printf("%d\n",n);
		return 0;
	}
	ans=n;

	while(m--){
		int a,b;
		scanf("%d%d",&a,&b);
		add(a,b);
	}

	for(int i=1;i<=n;i++){
		memset(st,0,sizeof st);
		dfs(i);
	}

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

	return 0;
}

#include<bits/stdc++.h>
// no of bits to store no 2e5 is 19
// 2e5 ka 5 times square root lene se 2 or 3 ke pass pahunch jate hai
using namespace std;

#define int               long long
#define mod               1000000007
#define MOD               1000000007
#define MAX               1000000000
#define inf               2e18
#define ff                first
#define ss                second
#define mp                make_pair
#define pb                push_back
#define pii               pair<int,int>
#define mii               map<int, int>
#define all(x)            (x).begin(), (x).end()
#define fill(a,b)         memset(a, b, sizeof(a))
#define sp(x,y)           fixed<<setprecision(y)<<x
#define setbits(x)        __builtin_popcount(x)
#define fast_in_out       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define ll                long long
#define endl              '\n'

//   powermod(a,b,m) ==  powermod(a,b%(m-1),m)  when m is prime fermat's theorem a^(p-1) %p=1 p is prime
int powermod(int a,int b,int c) //  gives (a^b)%c
{
    int ans = 1,tempans=a%c;
    while(b>0)
    {
        if((b&1)==1)
        {
            ans=(ans*tempans)%c;
        }
             tempans=(tempans*tempans)%c;
             b=b>>1;
    }
    return ans;
}

int modinverse(int a,int m)   // gives a inverse wrt m and m is prime
{
    return powermod(a,m-2,m);
}

ll add(ll x, ll y) {
   x += y;
   if (x >= mod) return x - mod;
   return x;
}
ll sub(ll x, ll y) {
   x -= y;
   if (x < 0) return x + mod;
   return x;
}
ll mult(ll x, ll y) {
   return (x * y) % mod;
}
ll inv(ll x)
{
    return powermod(x, MOD - 2,mod);
}

ll divide(ll x, ll y)
{
    return mult(x, inv(y));
}

// my template                                              m
// prime factorization                                      pf
// ncr and factorials                                       ncr
// matrix exponentiation of fibonacci series in log(n)      matexpofib
// cycles in a graph                                        cycle
// prime factorization in log(n)                            spf
// disjoint set union                                       dsu

vector<int> topo;int n,m;
vector<int> edges[2005];
int vis[2005];
int y=0;
void dfs(int i)
{
   vis[i]=1;
   y++;
   for(auto ch:edges[i])
   {
      if(!vis[ch])
      {
         dfs(ch);
      }
   }

}

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

   while(m--)
   {
      int x,y;
      cin>>x>>y;
      edges[x-1].pb(y-1);
   }

  int ans =0;
  for(int i=0;i<n;i++)
  {
     for(int j=0;j<n;j++)
      vis[j]=0;
      y=0;
     dfs(i);
     //cout<<y<<endl;
     ans+=(y);

  }
  cout<<ans;
}

int32_t main()
{
  fast_in_out;

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

   while(t--)
   {
       count++;
       solve();
   }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> pipii;
typedef priority_queue<pii, vector<pii>, greater<pii>> minpq;
typedef priority_queue<int> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;

// ----------------------DEBUG TEMPLATE--------------------------
void __print(int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

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

void tc()
{
    int n,c;
    cin>>n>>c;

    vi a(n+1),b(n+1),cost(n+1);
    map<int,int>m;
    map<int,int>r;
    vi arr;
    fo(i,n){
        cin>>a[i+1]>>b[i+1]>>cost[i+1];
        arr.pb(a[i+1]);
        arr.pb(b[i+1]);
        arr.pb(b[i+1]+1);
    }
    sort(all(arr));
    int id = 1;
    fo(i,arr.size()){
        m[arr[i]] = id;
        r[id] = arr[i];
        id++;
    }
    id--;
    vi pref(id+1,0);
    fo(i,n){
        pref[m[a[i+1]]]+=cost[i+1];
        if(m[b[i+1]] +1 <=id){
            pref[m[b[i+1]] + 1] -= cost[i+1];
        }
    }

    for(int i =1;i<=id;i++){
        pref[i] += pref[i-1];
    }

    int ans = 0;

    Fo(i,1,id){

        int tod = r[i];
        int nxt = r[i+1];

        int dur = nxt - tod;

        ans += min(pref[i],c)*dur;
    }

    ans += min(c,pref[id]);

    cout<<ans<<endl;

}

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

    int t = 1;
    // cin >> t;
    while (t--)
    {
        tc();
    }
}

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//#include <atcoder/all>
using namespace std;
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a; i > -1; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a; i > b; --i)
#define repl(i, a) for (ll i = (ll)0; i < (ll)a; ++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll
#define fi first
#define se second
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll mod_998244353 = 998244353;
constexpr ll INF = 1LL << 60;

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

// using lll=boost::multiprecision::cpp_int;
// using
// Double=boost::multiprecision::number<boost::multiprecision::cpp_dec_float<128>>;//仮数部が1024桁
template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}

ll mypow(ll x, ll n, const ll &p = -1)
{ // x^nをmodで割った余り

  if (p != -1)
  {
    x = (x % p + p) % p;
  }
  ll ret = 1;
  while (n > 0)
  {
    if (n & 1)
    {
      if (p != -1)
        ret = (ret * x) % p;
      else
        ret *= x;
    }
    if (p != -1)
      x = (x * x) % p;
    else
      x *= x;
    n >>= 1;
  }
  return ret;
}

struct myrand{
  random_device seed;
  mt19937 mt;
  myrand():mt(seed()){}
  int operator()(int a,int b){//[a,b)
    uniform_int_distribution<int>dist(a,b-1);
    return dist(mt);
  }
};

// using namespace atcoder;

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

void solve()
{
  int n;
  cin>>n;
  multiset<ll>r,g,b;
  rep(i,n*2){
    ll a;
    char c;
    cin>>a>>c;
    if(c=='R')r.emplace(a);
    else if(c=='B')b.emplace(a);
    else g.emplace(a);
  }
  if(r.size()%2==0&&g.size()%2==0&&b.size()%2==0){
    cout<<0<<"\n";
  }else{
    if(r.size()%2==1){
      if(g.size()%2==0)swap(r,g);
      else swap(r,b);
    }
    ll ans=INF;
    ll G=INF,B=INF;
    for(auto x:g){
      auto itr=r.lower_bound(x);
      if(itr!=r.end())chmin(G,*itr-x);
      if(itr!=r.begin())chmin(G,x-*prev(itr));
    }
    for(auto x:b){
      auto itr=r.lower_bound(x);
      if(itr!=r.end())chmin(B,*itr-x);
      if(itr!=r.begin())chmin(B,x-*prev(itr));
    }
    chmin(ans,G+B);
    for(auto x:g){
      auto itr=b.lower_bound(x);
      if(itr!=b.end())chmin(ans,*itr-x);
      if(itr!=b.begin())chmin(ans,x-*prev(itr));
    }
    cout<<ans<<"\n";
  }
}

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


// Problem: C - Swaps 2
// Contest: AtCoder - AtCoder Regular Contest 120
// URL: https://atcoder.jp/contests/arc120/tasks/arc120_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcc,abm,mmx,avx,avx2,tune=native")
#include <stdio.h>
#include <string.h>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#define od(x) printf("%d",x)
#define odb(x) printf("%d ",x)
#define odl(x) printf("%d\n",x)
#define odp(x,y) printf("%d %d\n",x,y)
#define ol(x) puts("")
#define old(x) printf("%lld",x)
#define oldb(x) printf("%lld ",x)
#define oldl(x) printf("%lld\n",x)
#define oldp(x,y) printf("%lld %lld\n",x,y)
#define int long long
inline int read()
{
	int num=0,f=1;char c=getchar();
	while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
	while(c>47&&c<58)num=num*10+(c^48),c=getchar();
	return num*f;
}
inline int re1d()
{
	char c=getchar();
	while(c<48||c>49)c=getchar();
	return c&1;
}
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
int n;std::map<int,int>m;std::set<int>x[200005],y[500005];
int a[200005],b[200005],c[200005];
namespace szsz{
	int a[200005];
	inline int lowbit(int x){return x&-x;}
	inline void add(int x,int p){while(x<=n)a[x]+=p,x+=lowbit(x);}
	inline int query(int x){int res=0;while(x)res+=a[x],x-=lowbit(x);return res;}
}using szsz::add;using szsz::query;
signed main()
{
	n=read();
	int A=0,B=0;
	for(int i=1;i<=n;i++)A+=a[i]=read()+i;
	for(int i=1;i<=n;i++)B+=b[i]=read()+i;
	if(A!=B)return puts("-1")&0;
	int cc=0;
	for(int i=1;i<=n;i++)
	{
		if(m.count(a[i]));else m[a[i]]=++cc;
		x[m[a[i]]].insert(i);
	}
	for(int i=1;i<=n;i++)
	{
		if(m.count(b[i]))y[m[b[i]]].insert(i);
		else return puts("-1")&0;
	}
	int ans=0;
	for(int i=1;i<=cc;i++)
	{
		if(x[i].size()==y[i].size())
		{
			std::set<int>::iterator A=x[i].begin(),B=y[i].begin();
			for(;A!=x[i].end();A++,B++)c[*B]=*A;
		}
		else return puts("1")&0;
	}
	A=0;
	for(int i=1;i<=n;i++)A+=(i-1)-query(c[i]),add(c[i],1);
	oldl(A);
	return 0;
}

/*
*   C. ORXOR.cpp
*   Created : 28/03/21 10.54.57
*/

#include <bits/stdc++.h>

using namespace std;

void run_case(){
   int n;
   cin >> n;
   vector<long long> v(n);
   for(long long &i : v){
       cin >> i;
   }
   long long res = LLONG_MAX;
   for(int i = 0; i < (1 << (n - 1)); i++){
       long long Or = 0;
       long long Xor = 0;
       for(int j = 0; j < n; j++){
            Or |= v[j];
           if(i >> j & 1){
               Xor ^= Or;
               Or = 0;
           }
       }
       Xor ^= Or;
       res = min(res, Xor);
   }
   cout << res;
}

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

   int tt = 1;
//    cin >> tt;
   while(tt--){
      run_case();
   }
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define pi pair<int,int>
#define pll pair<lli,lli>
#define vi vector<int>
#define vll vector<lli>
#define vpi vector<pair<int,int> >
#define vpll vector<pair<lli,lli> >
#define vvi vector<vector<int> >
#define vvll vector<vector<lli> >
#define vvpi vector<vector<pair<int,int> > >
#define vvpll vector<vector<pair<lli,lli> > >
#define inf 1000000000
#define maxn 200005
lli mod=998244353;

vi par(maxn),sz(maxn);

int rep(int v) {
    if (v == par[v])
        return v;
    return par[v] = rep(par[v]);
}

void unite(int a, int b) {
    a = rep(a);
    b = rep(b);
    if (a != b) {
        if (sz[a] < sz[b])
            swap(a, b);
        par[b] = a;
        sz[a] += sz[b];
    }
}

void pre(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        sz[i]=0;
    }
}

int main(){
    fastio;
    int n;
    cin>>n;
    vll a(n);
    pre(maxn);
    map<pair<lli,lli> ,lli > mp;
    lli ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n/2;i++){
        if(a[i]!=a[n-1-i]){
            mp[{min(a[i],a[n-1-i]),max(a[i],a[n-1-i])}]++;
        }
    }
    for(auto it : mp){
        if(rep(it.f.f)!=rep(it.f.s)){
            ans++;
            unite(it.f.f,it.f.s);
        }
    }
    cout<<ans<<"\n";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define pqueue priority_queue
#define umap unordered_map
#define uset unordered_set
#define bits(x) __builtin_popcount((x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x) / gcd(x, y) * (y))
#define inf 4557430888798830399LL
#define mst(dp, val) memset(dp, val, sizeof(dp))
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repd(i, a, b, d) for (int i = a; i <= b; i += d)
#define rep_(i, a, b) for (int i = a; i >= b; --i)
#define repd_(i, a, b) for (int i = a; i >= b; i -= d)
#define mxm(a, b) a = max(a, b)
#define mnm(a, b) a = min(a, b)
#define pb push_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << "=" << x << endl
#define readArr(a, n) for (int i = 1; i <= n; i++) cin >> a[i];
#define printArr(a, n) for (int i = 1; i <= n; i++) cout << a[i] << " "; cout << endl;
#define mod 1000000007
#define Add(x, d) x = (x + (d)) % mod
#define print(e) cout << (e) << endl
// #define MULTI_CASES
// #define PRE
const int N = 2e5 + 5;
int a[N];
int f[N], sz[N];

int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}

void join(int x, int y) {
    int fx = find(x), fy = find(y);
    if (fx != fy) {
        f[fx] = fy;
        sz[fy] += sz[fx];
    }
}

void solve() {
    int n; cin >> n;
    readArr(a, n);
    rep(i, 1, N - 1) {
        f[i] = i;
        sz[i] = 1;
    }
    for (int i = 1, j = n; i < j; i++, j--) {
        if (a[i] != a[j]) join(a[i], a[j]);
    }

    int res = 0;
    int cnt = 0;
    rep(i, 1, N - 1) {
        if (find(i) == i) cnt += sz[i], res += sz[i] - 1;
    }
    print(res);
}

void solve5() {
    int l, r;
    cin >> l >> r;

    //[1~lim]区间有多少个数具有因子f
    auto cal = [&](int f, int lim, int y) {
        int cnt = 0;
        repd(x, f, lim, f) {
            if (gcd(x, y) != x) cnt++;
        }
        return cnt;
    };

    int res = 0;
    rep(y, l, r) {
        //枚举y的因子
        for (int f = 2; f * f <= y; f++) {
            if (y % f) continue;
            res += cal(f, y - 1, y) - cal(f, l-1, y);
            if (y / f != f)
            res += cal(y / f, y - 1, y) - cal(y / f, l-1, y);
        }
    }
    print(2*res);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #ifdef MULTI_CASES
        #ifdef PRE
            pre();
        #endif
        int t; cin >> t;
        while (t--) solve();
    #else
        solve();
    #endif
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define L long long

int main() {
	int m; cin >> m;
	static const int n = m;
	vector<vector<L>> v(n);
	rep(i, n) {
		L x, c; cin >> x >> c;
		c--;
		v[c].push_back(x);
	}
	L p1 = 0, p2 = 0, t1 = 0, t2 = 0;
	rep(i, n) {
		if (v[i].size() == 0) continue;
		sor(v[i]);
		L xmin = v[i][0], xmax = v[i][v[i].size() - 1];
		L d = xmax - xmin;
		L t1_ = min(t1 + abs(xmax - p1) + d, t2 + abs(xmax - p2) + d);
		L t2_ = min(t1 + abs(xmin - p1) + d, t2 + abs(xmin - p2) + d);
		p1 = xmin;
		p2 = xmax;
		t1 = t1_; t2 = t2_;
	}
	L ans = min(t1 + abs(p1), t2 + abs(p2));
	cout << ans << endl;

}

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

#define ll long long
#define ar array

const int mxN=1.5e6;
int n, m, a[mxN], cnt[mxN];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for (int i=0; i<n; ++i)
		cin >> a[i];
	for (int i=0; i<m; ++i)
		++cnt[a[i]];
	int cur=0;
	while(cur<n&&cnt[cur])
		++cur;
	int ans=cur;
	for (int i=m; i<n; ++i) {
		++cnt[a[i]];
		if (--cnt[a[i-m]]==0)
			ans=min(ans, a[i-m]);
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool isPrime(ll n)
{
	//Corner case:
	if(n<=1)
	return false;
	if(n<=3)
	return true;

	//This optimizes the complexity:
	if(n%2==0||n%3==0)
	return false;
	for(ll i=5;i*i<=n;i=i+6)
	{
		if(n%i==0||n%(i+2)==0)
		return false;
	}
	return true;
}
int main()
{
	ll n,m;
	cin>>n>>m;
	ll a[n],b[m];
	for(ll i=0;i<n;i++)cin>>a[i];
	for(ll i=0;i<m;i++)cin>>b[i];
	sort(a,a+n);
	sort(b,b+m);
	ll i=0,j=0;
	while(i<n&&j<m)
	{
		if(a[i]>b[j])
		{
			cout<<b[j]<<" ";
			j++;
		}
		else if(a[i]<b[j])
		{
			cout<<a[i]<<" ";
			i++;
		}
		else
		{
			i++;
			j++;
		}
	}
	while(i<n)
	cout<<a[i++]<<" ";
	while(j<m)
	cout<<b[j++]<<" ";
	cout<<endl;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
//#define ll int
#define all(a) a.begin(),a.end()
#define rev(a) a.rbegin(),a.rend()
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; //less_equal for multiset
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
const double pi=acosl(-1);

void solve()
{
	int s,p;
	cin>>s>>p;
	for(int i=1;i*i<=p;i++)
	{
		if(p%i==0)
		{
			if(i+p/i==s)
			{
				cout<<"Yes\n";
				return ;
			}
		}
	}
	cout<<"No\n";

}

signed main()
{
	FAST;
	//seive();
	int tt=1;
	// cin>>tt;
	while(tt--)
	{
		solve();
	}
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define ppb             pop_back
#define mp              make_pair
#define all(x)             (x).begin(), (x).end()
#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 mod1            998244353
#define inf             1e18
#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());

int gcd(int a, int b){if (b == 0)return a;return gcd(b, a % b);}
int lcm(int a, int b){return (a / gcd(a, b)) * b;}
int power(long long x, unsigned int y, int p){int res = 1;x = x % p;if (x == 0) return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
int mod_inverse(int a, int p){return power(a, p - 2, p);}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
int mod_add(int a, int b, int m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
int mod_mul(int a, int b, int m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
int mod_sub(int a, int b, int m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
int mod_div(int a, int b, int m) {a = a % m; b = b % m; return (mod_mul(a, mod_inverse(b,m), m) + m) % m;}  //only for prime m
int modfact(int n, int p){if (p <= n)return 0;int res = (p - 1);for (int i = n + 1; i < p; i++)res = (res * mod_inverse(i, p)) % p;return res;}
int fact(int n){if (n == 0)return 1;return n * fact(n - 1);}

int32_t main(){
    FIO;

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

    //a=mod_mul(a,a+1,mod1);
    //b=mod_mul(b,b+1,mod1);
    //c=mod_mul(c,c+1,mod1);

    a*=a+1;
    b*=b+1;
    c*=c+1;
    a/=2;
    b/=2;
    c/=2;
    a=mod_mul(a,b,mod1);
    a=mod_mul(a,c,mod1);
    cout<<a<<endl;

    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	long long  a,b,c,mod=998244353;
	cin>>a>>b>>c;
	a=(a+1)*a/2%mod;
	b=(b+1)*b/2%mod;
	c=(c+1)*c/2%mod;
	cout<<a*b%mod*c%mod;
	return 0;
}


#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#include <cctype>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
using vv = vector<vector<ll>>;
using vec = vector<ll>;
using P = pair<ll, ll>;

int main()
{
	string s; cin >> s;
	map<char, ll> mp;
	rep(i, s.size()) {
		mp[s[i]] += 1;
	}
	ll now = 0;

	string ansl = "No";
	rep(i, 200) {
		bool ok = true;
		map<char, ll> copy = mp;
		now += 8;
		if (now >= 1000)
		{
			break;
		}
		string st = to_string(now);
		if (s.size() >= 3 && st.size() <= 2) {
			continue;
		}
		if (s.size() >= 2 && st.size() <= 1) {
			continue;
		}
		rep(j, st.size()) {
			if (copy[st[j]] >= 1) {
				copy[st[j]]--;
			}
			else {
				ok = false;
				break;
			}
		}
		if (ok)
		{
			ansl = "Yes";
			break;
		}
	}
	cout << ansl << endl;
	system("Pause");
}

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

int main(){
    string s;
    cin >> s;
    vvi eight(125, vi(10));
    eight[0][0] = 3;
    for(int i = 1; i<=124; i++){
        int hyaku = i*8/100;
        int ten = (i*8-hyaku*100)/10;
        int one = i*8-hyaku*100-ten*10;
        eight[i][hyaku] ++;
        eight[i][ten] ++;
        eight[i][one] ++;
    }
    vi sv(10);
    if(s.size() == 1) sv[0] += 2;
    else if (s.size() == 2) sv[0] ++;
    rep(i,s.size()) {
        int mozi = s[i] - '0';
        sv[mozi] ++;
    }
    if(s.size() <= 2){
        if(s.size() == 1){
            if(stoi(s)%8 == 0) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
        else{
            if(stoi(s)%8 == 0) cout << "Yes" << endl;
            else{
                reverse(s.begin(),s.end());
                if(stoi(s)%8 == 0) cout << "Yes" << endl;
                else cout << "No" << endl;
            }
        }
        return 0;
    }
    bool ok = false;
    rep(i,125){
        bool tasika = true;
        rep(j,10){
            if(eight[i][j] <= sv[j]) continue;
            else tasika = false;
        }
        if (tasika) ok = true;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}


#include<bits/stdc++.h>
#define REP(i,n) for (int i = 1; i <= n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
#define endl '\n'
using namespace std;
typedef long long ll;

struct fhash {
	ll operator() (ll x) const { return 7; }
};

ll fun(vector<ll> a,vector<ll> b){
    int n=a.size();
    int m=b.size();

    ll mn=LLONG_MAX;
    for(int i=0;i<n;i++){
        int j = lower_bound(b.begin(), b.end(), a[i])- b.begin();

        if(j<m){
            mn=min(mn,abs(a[i]-b[j]));
        }
        if(j-1>=0){
            mn=min(mn,abs(a[i]-b[j-1]));
        }
        if(j+1<m){
            mn=min(mn,abs(a[i]-b[j+1]));
        }
    }

    return mn;
}

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

    vector<ll> r,g,b;
    int r1=0,g1=0,b1=0;
    for(int i=0;i<2*n;i++){
        ll u;
        char v;
        cin>>u;
        cin>>v;
        if(v=='R'){
            r1++;
           r.pb(u);
        }else if(v=='G'){
            g1++;
            g.pb(u);
        }else{
            b1++;
            b.pb(u);
        }
    }

    sort(r.begin(),r.end());
    sort(g.begin(),g.end());
    sort(b.begin(),b.end());

     ll ans=LLONG_MAX;

    if(r1%2==0&&g1%2==0){
        ans=0;
    }else if(r1%2==g1%2){
        if(b1>0){
            ans=fun(r,b)+fun(g,b);
        }
        ans=min(ans,fun(r,g));
    }else if(r1%2==b1%2){
       if(g1>0){
            ans=fun(r,g)+fun(b,g);
        }
        ans=min(ans,fun(r,b));
    }else{
        if(r1>0){
            ans=fun(b,r)+fun(g,r);
        }
        ans=min(ans,fun(b,g));
    }

    cout<<ans<<"\n";

  return 0;
}

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

class UnionFind {
private:
  int N;
  vector<int> PS;

public:
  UnionFind() : N(0) {}
  UnionFind(int n) : N(n), PS(n, -1) {}
  bool unite(int a, int b) {
    int x = root(a), y = root(b);
    if (x == y) return false;
    if (-PS.at(x) < -PS.at(y)) swap(x, y);
    PS.at(x) += PS.at(y);
    PS.at(y) = x;
    return true;
  }
  bool same(int a, int b) { return root(a) == root(b); }
  int root(int a) {
    if (PS.at(a) < 0) return a;
    return PS.at(a) = root(PS.at(a));
  }
  int size(int a) { return -PS.at(root(a)); }
  vector<vector<int>> groups() {
    vector<int> B(N), S(N);
    for (int i = 0; i < N; i++) {
      B.at(i) = root(i);
      S.at(B.at(i))++;
    }
    vector<vector<int>> ret(N);
    for (int i = 0; i < N; i++) {
      ret.at(i).reserve(S.at(i));
    }
    for (int i = 0; i < N; i++) {
      ret.at(B.at(i)).push_back(i);
    }
    auto f = [&](const vector<int> &v) { return v.empty(); };
    ret.erase(remove_if(ret.begin(), ret.end(), f), ret.end());
    return ret;
  }
};

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> V(N);
  for (int i = 0; i < N; i++) cin >> V.at(i).first >> V.at(i).second;

  auto f = [&](double mid) {
    UnionFind UF(N + 2);
    for (int i = 0; i < N; i++) {
      auto [a, b] = V.at(i);
      if (100 - b < mid) UF.unite(i, N);
      if (b - -100 < mid) UF.unite(i, N + 1);
      for (int j = 0; j < i; j++) {
        auto [c, d] = V.at(j);
        if (hypot(a - c, b - d) < mid) UF.unite(i, j);
      }
    }
    return (UF.same(N, N + 1)) ? false : true;
  };
  double ok = 0, ng = 200;
  for (int cnt = 100; cnt; cnt--) {
    double mid = (ok + ng) / 2;
    (f(mid)) ? ok = mid : ng = mid;
  }
  cout << fixed << setprecision(4) << ok / 2 << "\n";
}


#include<iostream>
#include<iterator>
#include<algorithm>
#include<climits>
#include<map>
#include<set>
#include<numeric>
#include<string>
#include<sstream>
#define ll long long
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    multiset<int> s;
    for (int i = 0; i < h*w; ++i){
        int x;
        cin >> x;
        s.insert(x);
    }
    int min = *s.begin();
    int sum = 0;
    for (auto i = s.begin(); i != s.end(); ++i){
        sum += *i - min;
    }
    cout << sum;

}

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

typedef long long ll;
using namespace std;
//using namespace atcoder;

#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define _reps(i, s, n) for(ll i = (ll)(s); i < (ll)n; i++)
#define REP(...) _overload(__VA_ARGS__, _reps, _rep,)(__VA_ARGS__)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

int main(){
	ll n, x;
	cin >> n >> x;
	x *= 100;

	ll v[n], p[n];
	REP(i, n){
		cin >> v[i] >> p[i];
	}

	ll sum = 0;
	REP(i, n){
		sum += v[i] * p[i];
		if( sum > x ){
			cout << i+1 << endl;
			return 0;
		}
	}

	cout << -1 << endl;

	return 0;
}


#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
template <class T>
int upb(V<T> &v, const T &x) { return upper_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&...tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 60) - 1LL;
constexpr ll MOD = 998244353LL;
//////////////////////////////////////////////INSERT ABOVE HERE
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    V<int> x(m), y(m), z(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }
    V<ll> dp(1 << n);
    dp[0] = 1;
    for (int i = 0; i < (1 << n); i++) {
        for (int j = 0; j < m; j++) {
            if (x[j] != popcount(i)) continue;
            if (popcount(i & mask(y[j])) > z[j]) dp[i] = 0;
        }
        for (int j = 0; j < n; j++) {
            if (kbit(i, j)) continue;
            dp[i | (1 << j)] += dp[i];
        }
        //  dump(i, dp[i]);
    }
    cout << dp[(1 << n) - 1] << newl;
}

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define popcount(v) __builtin_popcount(v)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=1LL<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T,class U,class V>void scan(tuple<T,U,V>& p){scan(get<0>(p));scan(get<1>(p));scan(get<2>(p));}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll modinv(ll a, ll m) {ll b = m, u = 1, v = 0;while (b) {ll t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

int main(){
    INT(n,m);
    vector<vector<pair<int,int>>> vec(n+1);
    int x,y,z;
    rep(i,m){
        in(x,y,z);
        vec[x].emplace_back(y,z);
    }
    vector<ll> dp(1<<n,0);
    vector<int> mask(n+1,0);
    dp[0]=1;
    for(int i=1;i<n+1;i++)mask[i]=(1<<i)-1;
    rep(i,1<<n){
        x=popcount(i);
        rep(j,vec[x].size()){
            if(popcount(i&mask[vec[x][j].first])>vec[x][j].second){
                dp[i]=0;
            }
        }
        rep(j,n){
            if(~i>>j&1){
                dp[i|1<<j]+=dp[i];
            }
        }
    }
    out(dp.back());
}


//https://atcoder.jp/contests/abc186/tasks/abc186_e
//E - Throne
#include <bits/stdc++.h>

using namespace std;

//如果提交到OJ，不要定义 __LOCAL
#define __LOCAL

typedef long long ll;

ll reduce(ll a, ll mod) {
    return (a%=mod)<0?a+mod:a;
}

//finds x, y such that ax + by = gcd(a, b)
ll euclidEx(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d=euclidEx(b, a%b, y, x);
        y-=a/b*x;
        return d;
    } else {
        x=1;
        y=0;
        return a;
    }
}

int main() {
#ifndef __LOCAL
    //这部分代码需要提交到OJ，本地调试不使用
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    int t;
    cin>>t;

    while (t--) {
        ll n,s,k;
        cin>>n>>s>>k;

        s=n-s;
        ll g=__gcd(n, k);
        if (0!=s%g) {
            cout<<"-1\n";
            continue;
        }

        //找到最小的正整数x，满足 kx=s mod n
        ll x,y;
        euclidEx(k, n, x, y);
        //kx+ny=g
        x *= (s/g);
        y *= (s/g);
        //ans is x%(n/g)
        x = reduce(x, n/g);
        cout<<x<<"\n";
    }

#ifdef __LOCAL
    //这部分代码不需要提交到OJ，本地调试使用
    system("pause");
#endif
    return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
int n,a[50],ans = 2147483645;
inline int read()
{
    int s = 0,w = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-') w = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9'){s = s * 10 + ch - '0'; ch = getchar();}
    return s * w;
}
void dfs(int x,int sum)
{
	if(x == n+1)
	{
		ans = min(ans,sum);
		return;
	}
	int res = 0;
	for(int i = x; i <= n; i++)
	{
		res = res | a[i];
		dfs(i+1,sum^res);
	}
}
signed main()
{
	n = read();
	for(int i = 1; i <= n; i++) a[i] = read();
	dfs(1,0);
	printf("%d\n",ans);
    return 0;
}


#include <iostream>

int main()
{
  int X, Y, Z;
  std::cin >> X >> Y >> Z;
  auto ans = (Z * Y - 1) / X;

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

#pragma region templates
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using PQ = priority_queue<T>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
constexpr ll dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
inline void Yes() { cout << "Yes" << ENDL; }
inline void No() { cout << "No" << ENDL; }
inline void YES() { cout << "YES" << ENDL; }
inline void NO() { cout << "NO" << ENDL; }

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T>
vector<T> finddivisor(T x) {  //整数xの約数(xを含む)
  vector<T> divisor;
  for(T i = 1; (i * i) <= x; i++) {
    if(x % i == 0) {
      divisor.push_back(i);
      if(i * i != x) { divisor.push_back(x / i);}
    }
  }
  sort(divisor.begin(), divisor.end());
  return divisor;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
T rand(T l,T r){
  static random_device rd;
  static mt19937 g(rd());
  return uniform_int_distribution<T>(l,r)(g);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}
#pragma endregion templates

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll x,y,z;cin>>x>>y>>z;
  cout<<(z*y-1)/x<<ENDL;
}
//(・_・)(・_・)(・_・)(・_・)
//CHECK overflow,what to output?
//any other simpler approach?


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

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

  if( n%3==0 ){
    cout << 0 << endl;
    return 0;
  }

  vector<int> a;
  do {
    a.push_back(n%10);
    n /= 10;
  } while (n!=0);

  if(a.size() == 1){
    cout << -1 << endl;
    return 0;
  }

  for(auto x : a){
    if( (accumulate(a.begin(), a.end(),0) - x)%3==0 ){
      cout << 1 << endl;
      return 0;
    }
  }

  if(a.size() < 3){
    cout << -1 << endl;
    return 0;
  }

  cout << 2 << endl;
  return 0;
}

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long long ll;
#define G getchar()
int read()
{
	int x=0; bool flg=false; char ch=G;
	for (;!isdigit(ch);ch=G) if (ch=='-') flg=true;
	for (;isdigit(ch);ch=G) x=(x<<3)+(x<<1)+(ch^48);
	return flg?-x:x;
}
#undef G
#define fi first
#define se second
/*
const int mod=;
inline int upd(const int &x){return x+(x>>31&mod);}
inline void add(int &x,const int &y){x=upd(x+y-mod);}
inline void iadd(int &x,const int &y){x=upd(x-y);}
int qpow(int x,int y){
	int res=1;
	for (;y;y>>=1,x=1LL*x*x%mod)
		if (y&1) res=1LL*res*x%mod;
	return res;
}
*/
//typedef pair<int,int> P;
#define rep(i,l,r) for (int i(l);i<=int(r);i++)
#define per(i,l,r) for (int i(r);i>=int(l);i--)
#define all(x) (x).begin(),(x).end()

int n,w[64];
ll check(int c){
	ll z=c;
	rep(i,1,n){
		if (__gcd(c,w[i])>1) continue;
		int t=w[i]/__gcd(0LL+w[i],32LL*27*25*49);
		if (t==1) return ll(1e18);
		z*=t;
	}
	return z;
}
void solve(){
	n=read();
	rep(i,1,n) w[i]=read();
	ll z=1e18;
	int prm[8]={2,3,5,7};
	rep(i,0,15){
		int c=1;
		rep(j,0,3) if (i>>j&1) c*=prm[j];
		z=min(z,check(c));
	}
	printf("%lld\n",z);
}
int main()
{
	for (int T=1;T--;) solve();
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
using ll=int64_t;
using ld=long double;
using ull=unsigned long long;
template <class T>
using grid=vector<vector<T>>;
#define ALL(x) x.begin(),x.end()
#define rep(iter,from,to) for(ll iter=from;iter<to;++iter)

const ll MOD=1e9+7;
const ll INF=1e17;
//#######################################################################
vector<vector<ll>> input(ll N, ll width){
    string str;
    vector<vector<ll>> vec(N,vector<ll>(width));
    for(ll i=0;i<N;++i){
        cin>>str;
        reverse(ALL(str));
        for(ll j=0;j<width;++j){
            vec[i][j]=str.back();
            str.pop_back();
        }
    }
    return vec;
}
void op(vector<ll> vec){
    ll size=(ll)vec.size();
    for(ll i=0;i<size-1;++i) cout<<vec[i]<<" ";
    cout<<vec.back()<<endl;
}

void op(vector<vector<ll>> vec){
    ll height=(ll)vec.size();
    ll width=(ll)vec[0].size();
    for(ll i=0;i<height;++i) {
        for(ll j=0;j<width-1;++j) cout<<vec[i][j]<<" ";
        cout<<vec[i].back()<<endl;
    }
}
//########################################################################

struct position{
    ll x;
    ll y;
};

void solve(){
    ll N;
    cin>>N;
    vector<position> cd(N);
    vector<ld> slope(N);
    rep(i,0,N) {
        cin>>cd[i].x>>cd[i].y;
    }
    rep(i,0,N-2) rep(j,i+1,N-1) rep(k,j+1,N){
        position a,b,c;
        a=cd[i]; b=cd[j]; c=cd[k];
        ll s1=(c.y-a.y)*(b.x-a.x);
        ll s2=(b.y-a.y)*(c.x-a.x);
        if(s1==s2) {
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
}

int main(void){
    std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	solve();
}

// 2020-10-17 20:19:18
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
const ll inf = 1e18;
int n;
vector<ll> x, y, z;
vector<vector<ll> > dp;
ll dist(int i, int j) {
  return abs(x[i] - x[j]) + abs(y[i] - y[j]) + max(0ll, z[j] - z[i]);
}
ll rec(int i, int S) {
  if (dp[i][S] >= 0) return dp[i][S];
  if (__builtin_popcount(S) == 1) {
    return dp[i][S] = dist(0, i);
  }
  ll cur = inf;
  int T = S & (~(1 << i));
  rep(j, n) if (i != j && (S >> j) & 1) chmin(cur, rec(j, T) + dist(j, i));
  return dp[i][S] = cur;
}
void answer() {
  cin >> n;
  x.resize(n);
  y.resize(n);
  z.resize(n);
  rep(i, n) cin >> x[i] >> y[i] >> z[i];
  dp.resize(n, vector<ll>(1 << n, -1));
  rec(0, (1 << n) - 1);
  cout << dp[0][(1 << n) - 1] << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define maxn 10006
using namespace std;
ll read() {
    ll x = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) x = 10 * x + ch - '0';
    return x * f;
}
void print(ll x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) print(x / 10);
    putchar(x % 10 + '0');
}
string s;
int n;
int x[4][5010];
int main() {
    cin >> n >> s;
    s = "." + s;
    memset(x, 0, sizeof(x));
    for (int i = 1; i <= n; ++i) {
        if (s[i] == 'A')
            x[0][i]++;
        else if (s[i] == 'T')
            x[1][i]++;
        else if (s[i] == 'G')
            x[2][i]++;
        else
            x[3][i]++;
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < 4; ++j) {
            x[j][i] += x[j][i - 1];
        }
    }
    int res = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            int a = x[0][j] - x[0][i - 1];
            int b = x[1][j] - x[1][i - 1];
            int c = x[2][j] - x[2][i - 1];
            int d = x[3][j] - x[3][i - 1];
            if (a == b && c == d) res++;
        }
    }
    cout << res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define vi vector<int>
#define vll vector<lli>
#define vpi vector<pair<int,int> >
#define vpll vector<pair<lli,lli> >
#define vvi vector<vector<int> >
#define vvll vector<vector<lli> >
#define maxn 100005

int main(){
    fastio;
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int fra=0,frt=0,frc=0,frg=0;
        for(int j=i;j<n;j++){
            if(s[j]=='A') fra++;
            if(s[j]=='T') frt++;
            if(s[j]=='C') frc++;
            if(s[j]=='G') frg++;
            if(fra==frt and frc==frg)
            ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


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

const int INF = 2e9;

int main(){
    int n;
  	cin >> n;
    vector<bool> flag(n+1);
    int num = 0;
    rep(i,n){
        int a;
        cin >> a;
        flag[a] = true;
        while(true){
            if(flag[num] == false){
                cout << num << endl;
                break;
            }
          	else num++;
        }
    }
}

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

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

  int ans;
  ans = (N - 1) / 100 + 1;

  cout << ans << endl;
}


#include<bits/stdc++.h>
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define ick cout << "ickbmi32.9\n"
using namespace std;
struct edge{
    double w = 1;
    int t = 0;
};

edge r[30][30], d[30][30];
int dx[]{0, 0, 1, -1};
int dy[]{1, -1, 0, 0};
char mv[]{'R', 'L', 'D', 'U'};

int getDist(int x, int y, int dir) {
    if(min(x + dx[dir], y + dy[dir]) < 0) return -1;
    if(max(x + dx[dir], y + dy[dir]) >= 30) return -1;
    if(dir == 0) return d[x][y].w;
    if(dir == 1) return d[x][y - 1].w;
    if(dir == 2) return r[x][y].w;
    if(dir == 3) return r[x - 1][y].w;
    return -1;
}

pair<string, vector<pair<int, int>>> path(int x1, int y1, int x2, int y2) {
    double dist[30][30];
    for(int i = 0; i < 30; i++) for(int j = 0; j < 30; j++) dist[i][j] = -1;
    priority_queue<pair<double, pair<int, int>>, vector<pair<double, pair<int, int>>>, greater<>>dij;
    dij.push(mp(0, mp(x1, y1)));
    while(!dij.empty()) {
        pair<double, pair<int, int>> now = dij.top();
        dij.pop();
        if(abs(dist[now.se.fi][now.se.se] + 1) > 1e-5) continue;
        dist[now.se.fi][now.se.se] = now.fi;
        for(int i = 0; i < 4; i++) {
            int di = getDist(now.se.fi, now.se.se, i);
            if(di == -1) continue;
            dij.push(mp(now.fi + di, mp(now.se.fi + dx[i], now.se.se + dy[i])));
        }
    }
    pair<int, int> now = mp(x2, y2);
    vector<pair<int, int>> pa;
    string pam;
    while(now != mp(x1, y1)) {
        //cout << now.fi << ' ' << now.se << endl;
        for(int i = 0; i < 4; i++) {
            int di = getDist(now.fi, now.se, i);
            if(di == -1) continue;
            if(abs(dist[now.fi][now.se] - di - dist[now.fi + dx[i]][now.se + dy[i]]) < 1e-5) {
                pam += mv[i ^ 1];
                now.fi += dx[i];
                now.se += dy[i];
                break;
            }
        }
        pa.pb(now);
    }
    reverse(pa.begin(), pa.end());
    reverse(pam.begin(), pam.end());
    return mp(pam, pa);
}

void upd(string ah, vector<pair<int, int>> ps, double avg) {
    for(int i = 0; i < ah.length(); i++) {
        if(ah[i] == 'R') {
            d[ps[i].fi][ps[i].se].w = (d[ps[i].fi][ps[i].se].w * d[ps[i].fi][ps[i].se].t + avg) / (d[ps[i].fi][ps[i].se].t + 1);
            d[ps[i].fi][ps[i].se].t++;
        }
        if(ah[i] == 'L') {
            d[ps[i].fi][ps[i].se - 1].w = (d[ps[i].fi][ps[i].se - 1].w * d[ps[i].fi][ps[i].se - 1].t + avg) / (d[ps[i].fi][ps[i].se - 1].t + 1);
            d[ps[i].fi][ps[i].se - 1].t++;
        }
        if(ah[i] == 'D') {
            r[ps[i].fi][ps[i].se].w = (r[ps[i].fi][ps[i].se].w * r[ps[i].fi][ps[i].se].t + avg) / (r[ps[i].fi][ps[i].se].t + 1);
            r[ps[i].fi][ps[i].se].t++;
        }
        if(ah[i] == 'U') {
            r[ps[i].fi - 1][ps[i].se].w = (r[ps[i].fi - 1][ps[i].se].w * r[ps[i].fi - 1][ps[i].se].t + avg) / (r[ps[i].fi - 1][ps[i].se].t + 1);
            r[ps[i].fi - 1][ps[i].se].t++;
        }
    }
}
void solve() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    pair<string, vector<pair<int, int>>> go = path(x1, y1, x2, y2);
    double in;
    cout << go.fi << '\n';
    fflush(stdout);
    cin >> in;
    upd(go.fi, go.se, in / go.fi.length());
}
int main() {
    for(int _ = 0; _ < 1000; _++) solve();
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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(){

    lli k;
    k = 1000;
    //cin>>k;

    lli si,sj,ti,tj;
    REP(_,0,k){
        cin>>si>>sj>>ti>>tj;

        while(si < ti){
            si++;
            cout<<"D";
        }
        while(si > ti){
            si--;
            cout<<"U";
        }

        while(sj < tj){
            sj++;
            cout<<"R";
        }
        while(sj > tj){
            sj--;
            cout<<"L";
        }
        cout<<endl;
        lli test;
        cin>>test;
    }

    return 0;
}


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

template <typename T>
void rVec(vector<T> &vec, const int &n){
    vec.resize(n);
    T temp;
    for(T &i: vec){
        cin >> i;
    }
}
template <typename T>
void printVec(vector<T> &vec){
    for(T &i: vec){
        cout << i << " ";
    }
    cout << endl;
}

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

    int a,b,c;
    cin >> a >> b >> c;
    int m = min(a,b);
    a = a-m;
    b = b-m;

    if(c==0){
        if(a==0) cout << "Aoki";
        else cout << "Takahashi";
    }
    if(c==1){
        if(b==0) cout << "Takahashi";
        else cout << "Aoki";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll  A, B, C;
  cin >> A >> B >> C;

  ll ans;
  vector<string> S = {"Takahashi", "Aoki"};

  if (C == 0)
  {
    if (A > B)
      ans = 0;
    else
      ans = 1;
  }
  else
  {
    if (A >= B)
      ans = 0;
    else
      ans = 1;
  }

  cout << S.at(ans) << endl;
}


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

#define rep(i, n) for (long long i = 0; i < (n); i++)
#define REP(i, s, n) for (long long i = (s); i <= (n); i++)
#define repr(i, n) for (long long i = (n - 1); i >= 0; i--)
#define REPR(i, s, n) for (long long i = (s); i >= (n); i--)
#define all(v) (v).begin(), (v).end() //biginからendへ
#define rall(v) (v).rbegin(), (v).rend()
#define sumvec(v) accumulate(all(v), 0LL)
#define DOUBLE fixed << setprecision(15)
#define OK cerr << "OK\n"
#define OK1 cerr << "OK1\n"
#define OK2 cerr << "OK2\n"
#define sz(s) (long long)s.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
typedef pair<ll, ll> P;
typedef vector<P> vP;

//vectorの末尾参照は .back()を使おう。
//if(chmax(ans, i))

#define INT(...)     \
    int __VA_ARGS__; \
    IN(__VA_ARGS__)
#define LL(...)            \
    long long __VA_ARGS__; \
    IN(__VA_ARGS__)
#define CHR(...)      \
    char __VA_ARGS__; \
    IN(__VA_ARGS__)
#define DBL(...)        \
    double __VA_ARGS__; \
    IN(__VA_ARGS__)
#define STR(...)        \
    string __VA_ARGS__; \
    IN(__VA_ARGS__)
#define LD(...)              \
    long double __VA_ARGS__; \
    IN(__VA_ARGS__)

void scan(int &a)
{
    cin >> a;
}
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
void scan(long double &a) { cin >> a; }

void IN() {}
template <class Head, class... Tail>
void IN(Head &head, Tail &...tail)
{
    scan(head);
    IN(tail...);
}

//INT(a,b)とか使う

void YES(bool b) { cout << ((b) ? "YES\n" : "NO\n"); }
void Yes(bool b) { cout << ((b) ? "Yes\n" : "No\n"); }
void yes(bool b) { cout << ((b) ? "yes\n" : "no\n"); }
void Yay(bool b) { cout << ((b) ? "Yay!\n" : ":(\n"); }
void posible(bool b) { cout << ((b) ? "posible\n" : "imposible\n"); }
void Posible(bool b) { cout << ((b) ? "Posible\n" : "Imposible\n"); }
void POsIBLE(bool b) { cout << ((b) ? "POsIBLE\n" : "IMPOsIBLE\n"); }

//出力の形式に合わせて関数をキャスとする

const int inf = 1001001001;
const long long INF = ((1LL << 62) - (1LL << 31));
const long double pi = acos(-1.0);

int main(){

    LL(a,b,c,d);
    // if(b > c){
    //     cout << -1;
    //     return 0;
    // }
    ll i = 1;
    ll ans = 1;
    while(1){
        if(a + b * i <= d * (c * i)){
            cout << ans;
            return 0;
        }
        i++;
        ans++;
        if(i == 100000000){
            cout << -1;
            return 0;
        }
    }

}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
// --------------------------------------------------------
template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; }
#define FOR(i,l,r) for (ll i = (l); i < (r); ++i)
#define RFOR(i,l,r) for (ll i = (r)-1; (l) <= i; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define COUNT(c,v) count(ALL(c),(v))
#define SZ(c) ((ll)(c).size())
#define BIT(b,i) (((b)>>(i)) & 1)
#define PCNT(b) __builtin_popcountll(b)
#define CIN(c) cin >> (c)
#define COUT(c) cout << (c) << '\n'
#define debug(x) cerr << "l." << __LINE__ << " : " << #x << " = " << (x) << '\n'
ll llceil(ll a, ll b) { return (a + b - 1) / b; }
ll bitlen(ll b) { if (b <= 0) { return 0; } return (64LL - __builtin_clzll(b)); }
string toupper(const string& S) { string T(S); REP(i,SZ(T)) T[i] = toupper(T[i]); return T; }
string tolower(const string& S) { string T(S); REP(i,SZ(T)) T[i] = tolower(T[i]); return T; }
using P = pair<ll,ll>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VVS = vector<VS>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VVVLL = vector<VVLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VVVB = vector<VVB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VVVD = vector<VVD>;
using VLD = vector<ld>;
using VVLD = vector<VLD>;
using VVVLD = vector<VVLD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const ll INF = (1LL << 62) - 1;  // 4611686018427387904 - 1
// --------------------------------------------------------
// #include <atcoder/all>
// using namespace atcoder;

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

    ll N; cin >> N;
    string S; cin >> S;
    VLL A(N+1); REP(i,N+1) cin >> A[i];

    ll K = INF;
    REP(i,N) chmin(K, llabs(A[i] - A[i+1]));
    assert(K > 0);

    VVLL ans(K,VLL(N+1));
    REP(i,N+1) {
        ll q = A[i] / K;
        ll r = A[i] % K;
        REP(k,K) {
            ans[k][i] = q;
            if (r > 0 && K-r <= k) ans[k][i]++;
        }
    }

    COUT(K);
    REP(k,K) {
        REP(i,N+1) {
            if (i) cout << " ";
            cout << ans[k][i];
        }
        cout << '\n';
    }

    return 0;
}


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

int main() {
	cin.tie(nullptr); ios_base::sync_with_stdio(false);
	int n; cin >> n;
	vector<vector<ll>> p(n, vector<ll>(5));
	for (int i = 0; i < n; ++i) {
		cin >> p[i][0];
		cin >> p[i][1];
		cin >> p[i][2];
		cin >> p[i][3];
		cin >> p[i][4];
	}
	ll ok = 1, ng = 1000000001;
	while (ng - ok > 1) {
		ll x = (ng + ok) / 2;
		vector<bool> can(32, false);
		for (int i = 0; i < n; ++i) {
			int bit = 0;
			for (int k = 0; k < 5; ++k) {
				if (p[i][k] >= x) bit |= (1 << k);
			}
			for (int k = 0; k < 32; ++k) {
				if ((bit & k) == k) can[k] = true;
			}
		}
		bool flg = false;
		for (int i = 0; i < n; ++i) {
			for (int j = i+1; j < n; ++j) {
				int bit = 0;
				for (int k = 0; k < 5; ++k) {
					if (p[i][k] >= x || p[j][k] >= x) bit |= (1 << k);
				}
				if (can[31 ^ bit] == true) {
					flg = true;
					break;
				}
			}
			if (flg) break;
		}
		if (flg) ok = x;
		else ng = x;
	}
	cout << ok << endl;
	return 0;
}

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
#define mod 998244353
using namespace std;

bool isPrime(ll n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (ll i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
ll power(ll x,ll n)
{ll x1=0;
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
       //  if(result>=1000000001) return 0;
        x=(x*x);
      //   if(x>=1000000001) return 0;
        n=n/2;
    }
    return result;
}
int main(){
   IOS;
ll t;t=1;

while(t--){
ll n,s,d;
cin>>n>>s>>d;
ll ans=0;
for(ll i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    if(a<s&&b>d) ans=1;
}
if(ans) cout<<"Yes\n";
else cout<<"No\n";

}

return 0;
}


/*
 * @Author: LetMeFly
 * @Date: 2021-03-20 20:07:22
 * @LastEditors: LetMeFly
 * @LastEditTime: 2021-03-20 20:19:10
 */
#include <bits/stdc++.h>
using namespace std;
#define mem(a) memset(a, 0, sizeof(a))
#define dbg(x) cout << #x << " = " << x << endl
#define fi(i, l, r) for (int i = l; i < r; i++)
#define cd(a) scanf("%d", &a)
typedef long long ll;
ll ten[20];
int len(ll n)
{
    int ans = 0;
    while (n)
    {
        n /= 10;
        ans++;
    }
    return ans;
}
int main()
{
    for (int i = 0; i < 13; i++)
    {
        ten[i] = pow(10, i);
    }
    ll n;
    cin >> n;
    int l = len(n);
    if (l % 2)
    {
        int s = l / 2;
        if (!s)
            putchar('0');
        for (int i = 0; i < s; i++)
            putchar('9');
        puts("");
    }
    else
    {
        int s = l / 2;
        ll hou = n % ten[s];
        ll qian = n / ten[s];
        // printf("%lld, %lld\n", qian, hou); //**********
        if (qian > hou)
        {
            printf("%lld\n", qian - 1);
        }
        else
        {
            printf("%lld\n", qian);
        }
    }

    return 0;
}

#pragma warning (disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

#define ll long long

#define REP(i, n) for(int i = 0; i < n; i++)
#define SET(a) ll a = 0; (void)scanf("%lld", &a);

#define NMAX 100000	//提出前に変更 100000
#define MMAX 20

//int countDifference(char*, char*, int);
bool judgeAns(char*, char*, int);

int main() {
	SET(N); SET(M);
	char S[NMAX][MMAX];
	REP(i, N)(void)scanf("%s", S[i]);
	/*
	REP(i, N) {
		(void)scanf("\n");
		REP(j, M)(void)scanf("%c", &S[i][j]);
	}
	*/
	//printf("Hello, world!");

	//int ex = countDifference(S[0], S[1], M);
	/*
	int ans = 0;
	REP(i, N) {
		for (int j = i + 1; j < N; j++) {
			int dif = countDifference(S[i], S[j], M);
			if (dif % 2 == 1)ans++;
		}
	}
	printf("%d", ans);
	*/
	/*
	int ans = 0;
	REP(i, N)for (int j = i + 1; j < N; j++)if (judgeAns(S[i], S[j], M))ans++;
	printf("%d", ans);
	*/

	ll ans = 0;
	for (int i = 1; i < N; i++)if (judgeAns(S[0], S[i], M))ans++;
	printf("%lld", ans * (N - ans));
	return 0;
}

/*
int countDifference(char* s, char* t, int m) {
	int count = 0;
	REP(i, m)if (s[i] != t[i])count++;
	return count;
}
*/

bool judgeAns(char* s, char* t, int m) {
	int count = 0;
	REP(i, m)if (s[i] != t[i])count++;
	return (count % 2);
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
int x[10000];
int main()
{
	int n;
	int cnt=1;
	int i,j;
	int lowest=1000000000;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
		lowest=min(x[i],lowest);
	}
	unordered_map<int,int> memo;
	for(i=0;i<n;i++)
	{
		for(j=1;j*j<=x[i]&&j<lowest;j++)
		{
			if(x[i]%j==0)
			{
				memo[j]=__gcd(x[i],memo[j]);
				if(x[i]/j<lowest)
				{
					memo[x[i]/j]=__gcd(memo[x[i]/j],x[i]);
				}
			}
		}
	}
	for(auto tmp:memo)
	{
		if(tmp.first==tmp.second)
		{
			cnt++;
		}
	}
	printf("%d",cnt);
	return 0;
}

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

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 400010

ll i, i1, j, k, k1, t, n, m, res, flag[10], a[maxn], b;
priority_queue<ll> pq;

void add(ll x) {
    pq.push(-x); res += x;
}

ll rm() {
    ll x = pq.top(); pq.pop(); res += x; return -x;
}

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

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n;
    for (i = 1; i <= 2 * n; i++) {
        cin >> a[i];
    }

    for (i = n; i >= 1; i--) {
        add(max(a[i], a[2 * n - i + 1]));
        add(max(rm(), min(a[i], a[2 * n - i + 1])));
        // cout << res << nl;
    }

    cout << res << nl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define _rep(i, x, y) for(int i = (int)x; i < (int)y; ++i)
#define _dep(i,x,y) for(int i = (int)x; i > (int)y; i--)
#define PII pair<int,int>
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define PQ priority_queue
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<ll> VL;
typedef vector<vector<ll>> VLL;
constexpr int mod = 1e9 + 7;
constexpr int KINF = 0x3f3f3f3f;
constexpr double eps = 1e-7;
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n, m;
	cin >> n >> m;
	VI a(m), b(m);
	_rep(i, 0, m) cin >> a[i] >> b[i], -- a[i], -- b[i];
	VI c(n);
	_rep(i, 0, n) cin >> c[i];
	VII edge(n, VI(n));
	VII g(n);
	_rep(i, 0, m){
		if(c[a[i]] > c[b[i]])
			edge[a[i]][b[i]] = 1;
		else if(c[b[i]] > c[a[i]])
			edge[b[i]][a[i]] = 1;
		else{
			g[a[i]].eb(b[i]);
			g[b[i]].eb(a[i]);
		}
	}
	VI vis(n), dfn(n);
	int rk = 0;
	function<void(int, int)> dfs = [&](int u, int fa){
		dfn[u] = rk ++;
		vis[u] = 1;
		for(int& v : g[u]){
			if(!vis[v]){
				dfs(v, u);
				edge[u][v] = 1;
			}
			else{
				if(v == fa) continue;
				if(dfn[v] < dfn[u]) edge[u][v] = 1;
			}
		}
	};
	_rep(i, 0, n)
		if(!vis[i]) dfs(i, -1);
	_rep(i, 0, m){
		if(edge[a[i]][b[i]]) cout << "->" << endl;
		else cout << "<-" << endl;
	}
	return 0;
}
// 注意int转long long会溢出

#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i = (l); i <= (r); ++i)
typedef long long ll;
void fast() {
	ios::sync_with_stdio (0);
	cin.tie (0); cout.tie (0);
}

int a[2];
int main() {
	fast();
	cin >> a[0] >> a[1];
	int c;
	cin >> c; int p = c;
	while (a[p] >= 0) {
		--a[p];
		p ^= 1;
	}
	cout << ((p == 0) ? ("Aoki") : ("Takahashi ")) << '\n';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[202020],b[202020],c[202020];
int tr[202020];
void gx(int x)
{
	while(x<=n)
	{
		tr[x]++;
		x+=(x&(-x));
	}
}
int gt(int x)
{
	int ans=0;
	while(x>0)
	{
		ans+=tr[x];
		x-=(x&(-x));
	}
	return ans;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]+=i;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		b[i]+=i;
	}
	vector<pair<int,int> >v1,v2;
	for(int i=1;i<=n;i++)
	{
		v1.push_back(make_pair(a[i],i));
		v2.push_back(make_pair(b[i],i));
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	bool ok=true;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		if(v1[i].first!=v2[i].first)
		{
			ok=false;
			break;
		}
	}
	if(!ok)
	{
		cout<<-1<<endl;
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		c[v2[i].second]=v1[i].second;
	}
	for(int i=1;i<=n;i++)
	{
//		cout<<c[i]<<endl;
		gx(c[i]);
		ans+=(i-gt(c[i]));
//		cout<<gt(c[i])<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=(a),(i##i)=(b);i<=(i##i);++i)
#define rep(i,n) for(int i=0,(i##i)=(n);i<(i##i);++i)
#define Fodn(i,a,b) for(int i=(a),(i##i)=(b);i>=(i##i);--i)
#define pln puts("")
#define il inline
#define pb push_back()
#define ff first
#define ss second
using LL=long long;
using U32=unsigned int;
using U64=unsigned LL;
using LD=long double;
template<typename T>
using pii=pair<T,T>;
template<typename T>
il bool read(T&x){
    x=0;char c=getchar();int f=1;
    while(!isdigit(c)&&(c!='-')&&(c!=EOF))c=getchar();
    if(c==EOF)return 0;if(c=='-')f=-1,c=getchar();
    while(isdigit(c)){x=(x<<1)+(x<<3)+(c&15);c=getchar();}
    x*=f;return 1;
}
template<typename T,typename...Args>
il bool read(T&x,Args&...args){bool res=1;res&=read(x);res&=read(args...);return res;}
const double EPS=1e-6;
const int M=1000000007,INF=0x3f3f3f3f;
const LL INFLL=0x3f3f3f3f3f3f3f3fLL;
const int N=500010;

int fa[N],d[N],s[N];
int f(int x){
    if(fa[x]==x)return x;
    return fa[x]=f(fa[x]);
}
int n,a[N],b[N];
bool h[N];
il void init(){
    read(n);For(i,1,n)read(a[i],b[i]);
    For(i,1,400000)fa[i]=i,s[i]=1;
}
int ans;
il void solve(){
    For(i,1,n){
        int u=f(a[i]),v=f(b[i]);
        if(u==v)++d[u];
        else{
            fa[u]=v;
            d[v]+=d[u]+1;
            s[v]+=s[u];
        }
    }
    For(i,1,400000){
        int u=f(i);
        if(h[u])continue;
        h[u]=1;
        if(d[u]+1==s[u])ans+=d[u];else ans+=s[u];
    }
    printf("%d\n",ans);
}

signed main(){
    init();solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) begin(v), end(v)
#define sz(v) v.size()
#define INF 1e18+999999
#define EPSILON 1e-14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll 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(ll t) const {
  if (!t) return 1;
  mint a = pow(t>>1);
  a *= a;
  if (t&1) a *= *this;
  return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);
    vector<vector<ll>> acc(N+1, vector<ll>(N+1, 0));
    rep(i, N){
        rep2(j, 1, N+1){
            acc.at(i+1).at(j) = (acc.at(i).at(j) + A.at(i)) % j;
        }
    }
    vector<vector<mint>> dp(N+1, vector<mint>(N+1, 0));
    //dp.at(i).at(j)はi番目までの部分列をj個に分割する方法の数
    dp.at(0).at(0) = 1;
    vector<vector<mint>> memo(N+1, vector<mint>(N+1, 0));
    //memo.at(i).at(j)はacc.at(k).at(i)==jとなる全てのkにおけるdp.at(k).at(i-1)の総和;
    memo.at(1).at(0) = 1;
    rep(i, N){
        rep2(j, 1, N+1){
            dp.at(i+1).at(j) = memo.at(j).at(acc.at(i+1).at(j));
            //右辺はacc.at(k).at(j)==acc.at(i+1).at(j)となる全てのkにおけるdp.at(k).at(j-1)の総和
            //cout << i+1 << " " << j << " " << dp.at(i+1).at(j) << endl;
        }
        rep2(j, 2, N+1){
            memo.at(j).at(acc.at(i+1).at(j)) += dp.at(i+1).at(j-1);
        }
    }
    mint ans = 0;
    rep(i, N){
        ans += dp.at(N).at(i+1);
    }
    cout << ans << '\n';
}

#include<bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

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

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

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

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

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

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

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

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

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int64 > A(N), B(N);
  cin >> A >> B;
  vector< int64 > ans;
  int64 x = 0, y = 0;
  for(int i = 0; i < N; i++) {
    chmax(x, A[i]);
    chmax(y, x * B[i]);
    cout << y << "\n";
  }
}


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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define pb push_back
#define pob pop_back
#define S second
#define F first
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vll vector<long long int>
#define pll pair<long long int,long long int>
/* unordered_map<int,int>mp; mp.reserve(1024); mp.max_load_factor(0.25); */
#define mod 1000000007
#define mod2 998244353
#define ll long long int
#define ld long double
#define pi 3.141592653589793238
#define Endl endl
#define endl "\n"
const int N = 1e6 + 15;
const ll inf = 1e18;

void solve()
{
        ll l , r;
        cin >> l >> r;
        vll a(N);
        for(ll i = 2 ; i <= 1e6 ; i++ )
        {
                ll k = (r/i) - (l-1)/i;
                a[i] = (k*(k-1))/2;
        }
        for(ll i = 1e6 ; i >= 2 ; i-- )
        {
                for(ll j = 2*i ; j <= 1e6 ; j += i)
                        a[i] -= a[j];
        }
        ll ans = 0;
        for(ll i = 2 ; i <= 1e6 ; i++ )
        {
                if(i >= l and i <= r)
                {
                        a[i] -= ((r/i - (l-1)/i) - 1);
                }
                // if(i >= 2 and i <= 8)
                //         cout << i << " " << a[i] << endl;
        }
        for(ll i = 2 ; i <= 1e6 ; i++ )
                ans += a[i];
        cout << ans*2;
}

void debug(ll tt) {}

signed main()
{
        FAST;
        int t = 1;
        // cin >> t;
        while(t--)
        {
                solve();
        }
}
// freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define mod 998244353
#define MOD 1000000007
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
// aのn乗を求める(modp)
int modPow(ll a, ll n, ll p) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  ll t = modPow(a, n / 2, p);
  return (t * t) % p;
}

int main(){
  ll n, m;
  cin >> n >> m;

  ll ans;
  ans = modPow(10, n, m*m);
  ans = ans / m;
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <long long> vll;
typedef vector <pair<ll,ll>> vpll;
#define f(i,a,b) for(ll i=a ; i<b ; i++)

ll a[140000];
void arr(){
    a[1]=1;
    f(i,1,17){
        ll l=(1L<<i),r=(1L<<(i+1));
        f(j,l,r) a[j]=i+1;
    }
}
int main(){
    ll n; cin >> n;
    arr();
    f(i,1,n+1) cout << a[i] << " ";
    return 0;
}

#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
#include <string>
#include <map>
#include <cmath>
#include <random>
#include <tuple>
#define ll long long
using namespace std;

int main(){
  ll b;
  cin >> b;
  ll n = 100000;
  vector<int> pri = {2};
  for(int i = 3;i < 100000;i ++){
    int j = 0;
    bool jud = true;
    while(pri[j]*pri[j] <= i){
      if(i % pri[j] == 0){
        jud = false;
        break;
      }
      j ++;
    }
    if(jud){
      pri.push_back(i);
    }
  }
  vector<int> ans(n,0);
  ans[1-1] = 1;
  for(int i:pri){
    ans[i-1] = 2;
  }
  for(int i = 1;i <= n;i ++){
    if(ans[i-1] == 0){
      int p = i;
      int j = 0;
      int nu = 0;
      int need = 0;
      while(p != 1){
        if(p % pri[j] == 0){
          p = p/pri[j];
          need ++;
        }else{
          j ++;
        }
      }
      ans[i-1] = need+1;
    }
  }

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

  return 0;
}


#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int calcPow(int x, int y) {
    int z = 1;
    while (y > 0) {
        if (y & 1) {
            z = (z * x) % 7;;
        }
        x = (x * x) % 7;
        y /= 2;
    }
    return z;
}

int memo(const string& S, const string& X, vector<vector<int>>& dp, int idx, int mod, int pow) {
    if (idx == S.size()) {
        return mod == 0;
    }
    if (dp[idx][mod] >= 0) {
        return dp[idx][mod];
    }
    int nxt_pow = (pow * calcPow(10, 5)) % 7;
    if (X[idx] == 'A') {
        return dp[idx][mod] = memo(S, X, dp, idx + 1, (mod + (S[idx] - '0') * pow) % 7, nxt_pow) & memo(S, X, dp, idx + 1, mod, nxt_pow);
    } else {
        return dp[idx][mod] = memo(S, X, dp, idx + 1, (mod + (S[idx] - '0') * pow) % 7, nxt_pow) | memo(S, X, dp, idx + 1, mod, nxt_pow);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S, X;
    cin >> N >> S >> X;
    int pow = 1;
    rep(i, 0, N - 1) {
        pow = (pow * 10) % 7;
    }
    vector<vector<int>> dp(N, vector<int>(7, -1));
    if (memo(S, X, dp, 0, 0, pow)) {
        cout << "Takahashi" << endl;
    } else {
        cout << "Aoki" << endl;
    }
    return 0;
}

//I still luve you Kashish <3
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define pb                  push_back
#define F                   first
#define S                   second
#define P                   push
#define nl                  "\n"
#define vvi                 vector<vector<int>>
#define vi                  vector<int>
#define vc                  vector<char>
#define pii                 vector<pair<int, int>>
#define sz(a)               (int)a.size()
#define all(a)              a.begin(),a.end()
#define sort(v)             sort(all(v))
#define sortr(v)            sort(v); reverse(all(v));
#define yes                 cout << "YES"
#define no                  cout << "NO"
#define PeeleMera           ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int binpow(int a, int b)    { int res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res;}
const int N = 1e9 + 7 , N1 = 1e7 + 5 , N2 = 1e6 + 3, N3 = 1e5 + 3;
#define IM -1e18
#define IX 1e18

// int binpowmod(int n,int p,int c)
// {
//     if (p==0)
//     {
//         return 1%c;
//     }
//     int m=binpowmod(n,p/2,c);
//     m*=m;
//     m%=c;
//     if (p%2)
//     {
//         m*=n%c;
//         m%=c;
//     }
//     return m;
// }

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

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    a=a%10;
    vi va;
    set<int> ss;

    for(int i=1;i<=4;i++)
    {
        int x=binpow(a,i);
        if(ss.count(x%10)==1)
        break;

        va.pb(x%10);
        ss.insert(x%10);
    }
    int mod=sz(va);
    int x=binpowmod(b,c,mod);
    if(x==0) x=sz(va);
    cout<<binpow(a,x)%10;
}

signed main(){
    PeeleMera;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    // cout<<fixed<<setprecision(9);
    while(t--)
    {
        solve();
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  vector<int> v;
  vector<bool> vis;

  cin >> n;
  vis.assign(n , false);
  v.assign(n, 0);

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

  long long int count = 0;

  for(int i = 0; i < n; i++)
  {
    if(vis[i] == true){
      continue;
    }

    vis[i] = true;
    long long int temp = 1;
    for(int j = i + 1; j < n; j++){

      if(vis[j] == true){
        continue;
      }

      int diff = abs(v[i] - v[j]);
      if(diff % 200 == 0){
        temp++;
        vis[j] = true;
      }
    }

    count += (temp * (temp - 1)) / 2;
  }

  cout << count;
}

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

int main() {
    int N;
    cin >> N;
    int ans = 0;

    for (int i = 0; i<N; i++) {
        int A=0;
        cin >> A;
        if (A > 10) {
            ans = ans + A - 10;
        }
    }

    cout << ans << endl;
}


#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>

using namespace std;

using ll = long long;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define f first
#define s second
#define pb push_back
const char el = '\n';

// clang-format off
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T_vector>void output_vector(const T_vector &v, bool add_one = false, int start = -1, int end = -1) {if (start < 0) start = 0; if (end < 0) end = int(v.size()); for (int i = start; i < end; i++) cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n');}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << "(" << v.first << ":" << v.second << ")" << ","; os << "}"; return os; }

auto random_address = [] {char *p = new char; delete p;return uint64_t(p);};
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1);
mt19937_64 rng(SEED);
// clang-format on
ll max_pair(int N) {
     ll a = 0, b = 0;
     ll possible = 0;
     for (int i = 2; i <= N; i++) {
          a += b;
          b += 1;
          possible += b;
     }
     return possible;
}
ll max_pair2(ll N) { return (N * (N - 1)) / 2; }

void solve() {
     int N;
     cin >> N;
     vector<int> A(N), B(N);
     for (auto &x : A) cin >> x;
     rep(i, 0, N) B[i] = A[i] % 200;
     sort(B.begin(), B.end());

     ll mx = max_pair2(N);
     ll ans = mx;
     vector<int> freq(N + 1);
     for (int i = 0; i < N - 1; i++) {
          if (B[i] == B[i + 1]) {
               freq[i + 1] = freq[i] + 1;
          }
     }
     // cout << freq << endl;
     for (int i = 0; i < sz(freq); i++) {
          if (freq[i] > 0) {
               mx -= freq[i];
          }
     }
     cout << ans - mx << el;
}

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

     // int tests;
     // cin >> tests;
     // while (tests-- > 0)
     solve();
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=1e5;
const int inf=1e9;
int main(){
	int N; cin>>N;
	int a; long cnt[200] = {};
	rep(i,0,N){
		cin>>a;
		cnt[a%200]++;
	}
	long ans = 0;
	rep(i,0,200) ans += cnt[i] * (cnt[i] - 1) / 2;
	cout<<ans<<endl;
}


# include <iostream>
# include <utility>
# include <iterator>
# include <string>
# include <stdio.h>
# include <map>
# include <unordered_map>
# include <algorithm>
# include <queue>
# include <vector>
# include <climits>
# include <cstring>
# include <set>
# include <unordered_set>
# include <sstream>
# include <deque>
# include <bitset>
# include <functional>
# include <numeric>
# include <stack>
# include <limits>
# include <time.h>
# include <math.h>
# include <stdlib.h>
# include <assert.h>

using namespace std;

# define SAMRAT ios::sync_with_stdio(0);cin.tie(0);
# define LL long long
# define FOR(i,x,y) for(LL i=x;i<y;i++)
# define RFOR(i,x,y) for(LL i=x;i>=y;i--)
# define DEBUG_VAR(x) cout<<x<<endl;
# define DEBUG_1D(x,a,b) FOR(i,a,b){cout<<x[i]<<" ";}cout<<endl;
# define DEBUG_2D(x,a1,b1,a2,b2) FOR(i,a1,b1){FOR(j,a2,b2){cout<<x[i][j]<<" ";}cout<<endl;}
# define ALL(x) x.begin(), x.end()
# define MOD (LL)(1e9+7)
# define INF8 (LL)(1e17+5)

typedef vector<LL> VI;
typedef vector<string> VS;
typedef vector<vector<LL> > VVI;
typedef pair<LL, LL> PI;
typedef pair<LL, PI > PPI;
typedef vector<PI > VP;
typedef vector<PPI > VPP;

inline LL mod(LL x) {
  return (x%MOD + MOD)%MOD;
}

LL POWER(LL x, LL y) {
  LL res = 1;
  x = x%MOD;
  if (x == 0) return 0;
  while (y > 0) {
    if (y&1) res = mod(res * x);
    y >>= 1; x = mod(x * x);
  }
  return res;
}

int main() {

  SAMRAT

  int t = 1;
  // cin >> t;
  while (t--) {
    int n; cin >> n;
    vector<pair<int, string> > arr;
    FOR (i, 0, n) {
      string s;
      int x;
      cin >> s >> x;
      arr.push_back({x, s});
    }
    sort(ALL(arr));
    cout << arr[n - 2].second << endl;
  }

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mod  1000000007
#define int long long
vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int ans = 1000000000000000000ll;
int N;
int arr[100];

void fun(int cur, int val) {

    bool flag = true;
    for( int i=0; i<N; i++ ) {
        if( __gcd(arr[i], val ) == 1 ) {
            flag = false;
            break;
        }

    }

    if( flag ) ans = min(ans, val);

    if( cur == primes.size() ) return;

    fun(cur + 1, val);
    fun(cur + 1, val*primes[cur]);
}

void solve() {
    cin >> N;

    unordered_map<int,int> mark;

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

    }

    fun(0, 1);
    cout << ans;
}

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

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

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

// Tarun IIITA
// "2021-03-14T17:21:19.000-05:00"


#include <bits/stdc++.h>

using namespace std;

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

typedef vector<ll> vl;
typedef pair<ll, ll> pll;

#define St first
#define Nd second
#define Pb push_back
#define print_pair(p) "{" << (p).St << ", " << (p).Nd << "} "
#define list_format(i, n) (i!=n? " ":"\n")
#define endl "\n"
#define sz(a) (int)a.size()

#define REP(i,a,b) for(int i = a; i <= b; i++)
#define REV(i,a,b) for(int i = a; i >= b; i--)

#define AritSum(a,d,n) ((n)*(2*(a)+((n)-1)*(d)))/2
#define Log(base, num) log2(num)/log2(base)

#define MOD 1000000007
#define INF 1e9 + 7

// ******************** Add-on *****************************

// ******************** Add-on *****************************

// ************* MAIN *******************

ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1) {
        // q is quotient
        ll q = a / m;
        ll t = m;

        // m is remainder now, process same as
        // Euclid's algo
        m = a % m, a = t;
        t = y;

        // Update y and x
        y = x - q * y;
        x = t;
    }

    // Make x positive
    if (x < 0)
        x += m0;

    return x;
}

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

void solve() {
    ll n, s, k; cin >> n >> s >> k;

    ll d = gcd(n, gcd(s, k));
    n /= d;
    s /= d;
    k /= d;

    if (gcd(n, k) != 1) {
        cout << -1 << endl;
        return;
    }

    ll inv = modInverse(k, n);

    cout << (inv * (n - s)) % n << endl;
}

/*
g++ -std=c++14 -Wall -Wextra -O2 Test.cpp -o Test
./Test < in.txt

*/
int main() {
    int _=1;
    cin>>_;
    REP(t,1,_) {
        // cout << "Case #" << t << ": ";
        solve();
        // cout << ((solve())? "YES" : "NO") << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fr(i,t) for(i=0;i<t;i++)
#define fr1(i,r,t) for(i=r;i<t;i++)
typedef long long int lli;
typedef unsigned long long int ulli;
#define inf LONG_MAX
#define ff first
#define ss second
double pie=3.14159265358979323846;
#define dbug(x) cout<<#x<<"="<<x<<endl;
#define dbug2(x,y)
// lli M=1e9+7;
lli M=998244353;
#define gg cout<<"Case #"<<i+1<<": "
#define exact(x) cout<<fixed<<setprecision(8)<<x<<endl

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	lli T,n,i,j,k=0,m,j1,co=0,check,mi,l,sum;
	lli ans=0;
    // cin>>T;
    // fr(i,T)
    // {
        cin>>n>>m>>k;
        ans=((k*(k+1))/2)%M;
        ans=(ans*(((m*(m+1))/2)%M))%M;
        ans=(ans*(((n*(n+1))/2)%M))%M;
        cout<<ans<<endl;
    // }
}


/**
*    author:  kuins_air
*    created: 07.05.2021 22:26:12
**/

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

int H, W, A[101][101];

int main() {
    cin >> H >> W;
    rep(h, 0, H) rep(w, 0, W) cin >> A[h][w];
    int m = 101;
    rep(h, 0, H) rep(w, 0, W) {
        m = min(m, A[h][w]);
    }

    int ans = 0;
    rep(h, 0, H) rep(w, 0, W){
        ans += A[h][w] - m;
    }
    cout << ans << endl;

    return 0;
}

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

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

	int h, w;
	cin >> h >> w;
	vector<vector<int>> grid(h, vector<int>(w, 0));
	vector<vector<int>> hor(h, vector<int>(w, 0));
	vector<vector<int>> ver(h, vector<int>(w, 0));
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		hor[a][b] = 1;
		ver[a][b] = 1;
	}
	for (int i = 0; i < m; ++i) {
		int c, d;
		cin >> c >> d;
		c--; d--;
		grid[c][d] = 1;
	}
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (j > 0 && ver[i][j - 1] && !grid[i][j]) ver[i][j] = 1;
		}
		for (int j = w - 2; j >= 0; --j) {
			if (j + 1 < w && ver[i][j + 1] && !grid[i][j]) ver[i][j] = 1;
		}
	}
	for (int j = 0; j < w; ++j) {
		for (int i = 0; i < h; ++i) {
			if (i > 0 && hor[i - 1][j] && !grid[i][j]) hor[i][j] = 1;
		}
		for (int i = h - 2; i >= 0; --i) {
			if (i + 1 < h && hor[i + 1][j] && !grid[i][j]) hor[i][j] = 1;
		}
	}
	int count = 0;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			count += (ver[i][j] || hor[i][j]);
		}
	}
	cout << count << endl;
}


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

int main(){
    ll N; cin >> N;
    ll v[2*N]; ll sum = 0,loss = 0;
    rep(i,2*N){
        cin >> v[i]; sum += v[i];
    }
    ll k1 = N-1; ll k2 = N;
    multiset<ll> mean;
    rep(i,N){
        mean.insert(v[k1]); mean.insert(v[k2]);
        auto itr = mean.begin();
        loss += *itr; mean.erase(itr);
        k1--; k2++;
    }
    cout << sum-loss << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define test(x) cout << "Line(" << __LINE__ << ") " #x << ' ' << x << endl
#define printv(x) {\
	for (auto i : x) cout << i << ' ';\
	cout << endl;\
}
#define pii pair <int, int>
#define pll pair <lli, lli>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<typename A, typename B>
ostream& operator << (ostream& o, pair<A, B> a){
    return o << a.X << ' ' << a.Y;
}
template<typename A, typename B>
istream& operator >> (istream& o, pair<A, B> &a){
    return o >> a.X >> a.Y;
}
const int mod = 1e9 + 7, abc = 864197532, N = 2008, logN = 17, K = 333;

lli myceil(lli a, lli b) {
    if (a <= 0) {
        return a / b;
    } else {
        return (a + b - 1) / b;
    }
}

lli myfloor(lli a, lli b) {
    if (a >= 0) {
        return a / b;
    } else {
        return (a - b + 1) / b;
    }
}

lli mysqrt(lli x) {
    lli l = 0, r = 2000000000;
    while (r - l > 1) {
        lli mid = (l + r) / 2;
        if (mid * mid <= x) l = mid;
        else r = mid;
    }
    return l;
}

lli get(){
    string t;
    cin >> t;
    string qq;
    int cnt = 0;
    bool tmp = false;
    for(char i : t){
        if(i == '.') tmp = true;
        else{
            qq += i;
            if(tmp) cnt++;
        }
    }
    for(int j = 0; j + cnt < 4; j++) qq += '0';
    return stoll(qq);
}

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    /*
     * (a - x)^2 + (b - y)^2 <= r^2;
     * b^2 - 2by <= r^2 - y^2 - x^2 - a^2 + 2ax
     * b^2 + Bb + C <= 0
     */
    lli x = get(), y = get(), r = get();
    lli ans = 0;

    for (lli a = -200000; a <= 200000; a++) {
        if (x - r > a * 10000 || a * 10000 > x + r) continue;
        lli val = r * r - (a * 10000 - x) * (a * 10000 - x);
        if (val < 0) continue;
        lli sq = mysqrt(val);
        lli L = myceil(y - sq, 10000), R = myfloor(y + sq, 10000);
        // cout << a << ' ' << L << ' ' << R << endl;
        ans += R - L + 1;
    }
    cout << ans << endl;
}