#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;

using C = complex<double>;
const double gs = 0.000001;

int main(){
    int n;
    cin >> n;
    vector<double> lx(n), ly(n), rx(n), ry(n);
    rep(i,n) cin >> lx[i] >> ly[i];
    rep(i,n) cin >> rx[i] >> ry[i];
    double ljx, ljy, rjx, rjy;
    ljx = ljy = rjx = rjy = 0;
    rep(i,n){
        ljx += lx[i];
        ljy += ly[i];
        rjx += rx[i];
        rjy += ry[i];
    }
    ljx /= n; ljy /= n; rjx /= n; rjy /= n;
    rep(i,n){
        lx[i] -= ljx;
        ly[i] -= ljy;
        rx[i] -= rjx;
        ry[i] -= rjy;
    }
    string ans = "No";
    rep(i,n){
        rep(j,n){
            double llen = sqrt(lx[i]*lx[i] + ly[i]*ly[i]);
            double rlen = sqrt(rx[j]*rx[j] + ry[j]*ry[j]);
            if(abs(rlen-llen) >= gs) continue;
            double lshi = atan2(ly[i], lx[i]);
            double rshi = atan2(ry[j], rx[j]);
            double shi = lshi - rshi;
            bool allMitukata = true;
            rep(j2, n){
                C tani(cos(shi), sin(shi));
                C r(rx[j2], ry[j2]);
                r = r*tani;
                double rx2 = r.real(); // kaitenn
                double ry2 = r.imag();
                bool mitukata = false;
                rep(i2, n){
                    if(abs(lx[i2]-rx2)>=gs || abs(ly[i2]-ry2)>=gs) continue;
                    mitukata = true;
                }
                if(!mitukata) allMitukata = false;
            }
            if(allMitukata) ans = "Yes";
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

   int n;
   cin >> n;
   bitset<100001> dp;
   dp[0]=1;
   int tot = 0;
   rep(i,n){
       int t;
       cin>>t;
       tot += t;
       dp |= dp<<t;
   }
   int ans = tot;
   rep(i,tot+1)if(dp[i])ans = min(ans,max(tot-i,i));

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


#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; debug_print(__VA_ARGS__); } while(false)
template<typename T, typename... Ts> void debug_print(const T &t, const Ts &...ts) { cerr << t; ((cerr << ", " << ts), ...); cerr << endl; }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
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; }
template<typename T, typename... Ts> void print(const T& t, const Ts&... ts) { cout << t; ((cout << ' ' << ts), ...); cout << '\n'; }
template<typename... Ts> void input(Ts&... ts) { (cin >> ... >> ts); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

using T = tuple<int, int, int>;
using Edge = tuple<ll, int>;
#include <queue>
#include <cmath>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    input(n, m);
    vector<vector<T>> g(n);
    rep(i, 0, m) {
        int a, b, c, d;
        input(a, b, c, d);
        a--;
        b--;
        g[a].emplace_back(b, c, d);
        g[b].emplace_back(a, c, d);
    }
    priority_queue<Edge, vector<Edge>, greater<Edge>> pq;
    pq.emplace(0, 0);
    const ll inf = 1LL << 60;
    vector<ll> cost(n, inf);
    cost[0] = 0;
    while (pq.size()) {
        auto [cst, ver] = pq.top();
        pq.pop();
        if (cost[ver] < cst) continue;
        cost[ver] = cst;
        for (auto [nxt, c, d] : g[ver]) {
            ll ddiv = round(sqrt(d));
            for (ll t = max(ddiv - 2, 0LL); t <= ddiv + 2; t++) {
                ll nxtt = max(cst, t);
                nxtt += c + d / (nxtt + 1);
                if (chmin(cost[nxt], nxtt)) {
                    pq.emplace(nxtt, nxt);
                }
            }
        }
    }
    print(cost[n - 1] == inf ? -1 : cost[n - 1]);

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<ctime>
#include<queue>
#define mp make_pair
#define zjx printf("%d\n",
#define AK ans
#define IOI );
#define maxn 200005
#define lson now<<1
#define rson now<<1|1
using namespace std;
const int mod=998244353;
inline int read()
{
	int x=0;
	char c=getchar();
	while(!isdigit(c))c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	return x;
}
int n,m,p,h[100001];
struct pp
{
	int to,ne,v,w,t;
}a[200001];
void add(int x,int y,int z,int k)
{
	a[++p].to=y;
	a[p].ne=h[x];
	a[p].v=z;
	a[p].w=k;
	a[p].t=(int)(sqrt(k));
	h[x]=p;
}
long long d[100001];
int vis[100001];
struct node
{
	int id;
	long long num;
	node(int x,long long y)
	{
		id=x,num=y;
	}
	bool operator < (const node &x)const
	{
		return num>x.num;
	}
};
priority_queue<node>q;
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read(),z=read(),k=read();
		add(x,y,z,k),add(y,x,z,k);
	}
	memset(d,0x3f,sizeof(d));
	d[1]=0;
	q.push(node(1,0));
	while(!q.empty())
	{
		int x=q.top().id;
		q.pop();
		if(vis[x])continue;
		vis[x]=1;
		for(int i=h[x];i;i=a[i].ne)
		{
			long long v=a[i].v+(d[x]<=a[i].t?(a[i].w/(a[i].t+1)+a[i].t):(a[i].w/(d[x]+1)+d[x]));
			if(d[a[i].to]>v)
			{
				d[a[i].to]=v;
				q.push(node(a[i].to,d[a[i].to]));
			}
		}
	}
	if(d[n]==0x3f3f3f3f3f3f3f3f)
	printf("-1");
	else
	printf("%lld",d[n]);
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    double sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    if (gx < sx) {
        swap(sx, gx);
        swap(sy, gy);
    }
    printf("%.10lf", sx + (gx - sx) * sy / (sy + gy));
    return 0;
}


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

#define SIZE 200000

////////// Mod
#include <iostream>
using namespace std;

class Mod {
public:
  const long MOD = 1000000007;
  //const long MOD = 17;
  const int MaxIntPower = 30;
  Mod(long v = 0) { var = v; }
  void operator = (long r) { var = r; }
  Mod operator + (Mod r) { return (var + r.var) % MOD; }
  Mod operator - (Mod r) { return (var - r.var + MOD) % MOD; }
  Mod operator * (Mod r) { return (var * r.var) % MOD; }
  Mod operator / (Mod r) { return (var * r.Reverse().var) % MOD; }

  void operator += (Mod r) { var = (var + r.var) % MOD; }
  void operator -= (Mod r) { var = (var - r.var + MOD) % MOD; }
  void operator *= (Mod r) { var = (var * r.var) % MOD; }
  void operator /= (Mod r) { var = (var * r.Reverse().var) % MOD; }

  bool operator ==(const Mod& r) { return var == r.var; }
  bool operator <(const Mod& r) { return var < r.var; }
  bool operator !=(const Mod& r) { return var != r.var; }

  Mod Power(int p) {
    if (var == 0 || var == 1) return var;
    while (p < 0) p += MOD - 1;
    p = p % (MOD - 1);
    long bit = 1 << MaxIntPower;
    Mod ans = 1;
    while (bit >= 1) {
      ans *= ans;
      if ((bit & p) != 0)
        ans *= var;
      bit = (bit >> 1);
    }
    return ans;
  }

  Mod Reverse() {
    long a = var;
    long b = MOD;
    long u = 1;
    long v = 0;
    while (b > 0) {
      long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }

    Mod val;
    val.var = (u + MOD) % MOD;
    return val;
  }
  long var;
};

int main()
{
  long n, m;
  long a[2000];
  cin >> n >> m;
  long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sum += n;
  Mod bunbo = 1;
  Mod bunshi = 1;

  for (int i = 0; i < sum; i++) {
    bunshi *= m + n - i;
    bunbo *= i + 1;
  }
  Mod ans = bunshi/bunbo;
  cout << ans.var;
}

/*
Written By mafailure
*/
#define ill
//In the name of God
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#ifdef ill
#define int long long
#endif
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef AATIF_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
//#define int long long
// int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1};
// int dx[]={2,2,-2,-2,1,1,-1,-1}; int dy[]={1,-1,1,-1,2,-2,2,-2};
const long long mod = 1e9 + 7;
const double eps=1e-9;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector< pair< int, int > > vii;
typedef map<int, int> mii;
typedef pair<int, ii> pip;
typedef pair<ii, int> ppi;
#define arrinp(arr,init,final,size,type) type* arr=new type[size];for(int i=init;i<final;i++)cin>>arr[i];
#define cr2d(arr,n,m,t) t**arr=new t*[n];for(int i=0;i<n;i++)arr[i]=new t[m];
#define w(t) int t;cin>>t; while(t--)
#define takeInp(n) int n;cin>>n;
#define fr(i,init,final) for(int i=init;i<final;i++)
#define frr(i,init,final) for(int i=init;i>=final;i--)
#define Fr(i,final) for(int i=0;i<final;i++)
#define Frr(i,first) for(int i=first;i>=0;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;
#define setb __builtin_popcount
#define lsone(n) (n&(-n))
#define rlsone(n) (n&(n-1))
#define clr(a,b) memset(a,b,sizeof(a))
const int inf= INT_MAX;
//struct point_i{int x,y;};
struct point_i{int x,y;
point_i(){ x=0; y=0;}
point_i(int x_,int y_){x=(x_);y=(y_) ;}
};

struct point
{
	float x,y;
	point (){x=y=0.0;}
	point (float x_,float y_){x=(x_); y=(y_);}
	bool operator < (point other) const{
	  if(fabs(x-other.x)>eps)return x<other.x;
	  return y<other.y;

		}
	bool operator == (point other) const {
		return fabs(other.x-x)<=eps&& fabs(other.y-y)<=eps;
		}

} ;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
vi init(string s)
{
	istringstream sin(s);
	int n;
	vi arr;
	while(sin>>n)arr.push_back(n);
	return arr;
}
int power(int x, int y)
{
	if(y==0)return 1;
	int u=power(x,y/2);
	u=(u*u)%mod;
	if(y%2)u=(x*u)%mod;
	return u;

}
int gcd(int a,int b)
{
	if(a<b)return gcd(b,a);
	return (b==0?a:(a%b?gcd(b,a%b):b));
}
int gcd_e(int a,int b,int &x,int &y)
{

	if(b==0){x=1; y=0; return a;}
	int x1,y1;
	int p=gcd_e(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;
	return p;
}

int mul(int a,int b)
{
	return (a*b)%mod;
}
int inv(int n)
{
	return power(n,mod-2);
}

signed main()
{
	IOS
	int n; cin>>n;
	int m; cin>>m;

	vi a(n);
	fr(i,0,n) cin>>a[i];
	int sum=accumulate(all(a),n);
	int num=1;
	int den=1;
	m+=n;
	fr(i,0,sum)
	{
		num=mul(num,m-i);
		den=mul(den,sum-i);
	}
	cout<<mul(num,inv(den))<<endl;
	//fr(i,0,n) sum+=a[i];

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,l,n)for(int i=l;i<n;i++)
#define dloop(i,l,n)for(int i=l;i>=n;i--)
#define read(x) cin>>x
#define print(x) cout<<x
bool compare(pair<int,int>p1,pair<int,int>p2){
  if(p1.first>p2.first)return true;
  else if(p1.first==p2.first){
    if(p1.second<p2.second)return true;
  }
  return false;
}
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
  cin.tie(NULL);
ll a,b;
cin>>a>>b;
if((a+b)>=15 &&(b>=8))cout<<1<<'\n';
else if((a+b)>=10 &&(b>=3))cout<<2<<'\n';
else if((a+b)>=3)cout<<3<<'\n';
else cout<<4<<'\n';
  return 0;

}

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

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

    int type = -1;
    if ((A + B >= 15) && (B >= 8)) {
        type = 1;
    }
    else if ((A + B >= 10) && (B >= 3)) {
        type = 2;
    }
    else if ((A + B >= 3)) {
        type = 3;
    }
    else {
        type = 4;
    }

    cout << type << endl;
}


#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define maxn 51
#define ll long long
#define mo 998244353
using namespace std;

int n,m,i,j,k,a[maxn][maxn],fa[maxn],g[maxn];
int father(int x){return (fa[x]==x)?x:fa[x]=father(fa[x]);}
void link(int x,int y){x=father(x),y=father(y);if (x!=y) g[y]+=g[x],fa[x]=y; }
ll fct[maxn];

int main(){
	scanf("%d%d",&n,&m);
	fct[0]=1;for(i=1;i<=n;i++) fct[i]=fct[i-1]*i%mo;
	for(i=1;i<=n;i++) for(j=1;j<=n;j++) scanf("%d",&a[i][j]);
	for(i=1;i<=n;i++) fa[i]=i,g[i]=1;
	for(i=1;i<=n;i++) for(j=i+1;j<=n;j++) {
		int tp=1;
		for(k=1;k<=n;k++) if (a[i][k]+a[j][k]>m)
			{tp=0;break;}
		if (tp) link(i,j);
	}
	ll ans=1;
	for(i=1;i<=n;i++) if (fa[i]==i) (ans*=fct[g[i]])%=mo;

	for(i=1;i<=n;i++) fa[i]=i,g[i]=1;
	for(i=1;i<=n;i++) for(j=i+1;j<=n;j++) {
		int tp=1;
		for(k=1;k<=n;k++) if (a[k][i]+a[k][j]>m)
			{tp=0;break;}
		if (tp) link(i,j);
	}
	for(i=1;i<=n;i++) if (fa[i]==i) (ans*=fct[g[i]])%=mo;

	printf("%lld",ans);
}

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

long long cur[101][10001], pre[101][10001];
long long MOD = 998244353;
int main() {
    int N; cin >> N;
    vector<int> W(N);
    for(int i = 0; i < N; i++) {
        cin >> W[i];
    }
    pre[0][0] = 1LL;

    int sum = 0;
    for(int i = 0; i < N; i++)
        sum += W[i];
    for(int i = 1; i <= N; i++) {
        for(int make = 0; make <= sum; make++) {
            for(int use = 0; use <= N; use++) {
                cur[use][make] = pre[use][make];
                if(W[i - 1] <= make && use > 0)
                    cur[use][make] += pre[use - 1][make - W[i - 1]];
                if(cur[use][make] > MOD) cur[use][make] -= MOD;
            }
        }
        for(int make = 0; make <= sum; make++)
            for(int use = 0; use <= N; use++)
                pre[use][make] = cur[use][make];
    }
    vector<long long> f(N + 1);
    f[0] = 1LL;
    for(int i = 1; i <= N; i++)
        f[i] = f[i - 1] * 1LL * i % MOD;
    long long ans = 0LL;
    if(sum % 2) {
        cout << 0 << "\n";
        return 0;
    }
    for(int use = 0; use <= N; use++) {
        ans += f[use] * 1LL * f[N - use] % MOD * pre[use][sum / 2] % MOD;
        ans %=  MOD;
    }
    if(ans < 0) ans += MOD;
    cout << ans;
}


#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 1000000007
#define INF 1000000000000000000
#define EPS 0.0000000001
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
char s[103];
char bst[24000000];
int n,k;
void make_it(int index,int l,int r)
{
    if(l==r)
    {
        bst[index]=(s[l%n]);
        return;
    }
    int m=(l+r)/2;
    make_it(index*2,l,m);
    make_it(index*2+1,m+1,r);
    if(bst[index*2]==bst[index*2+1]) bst[index]=bst[index*2];
    else if(bst[index*2]!='R'&&bst[index*2+1]!='R') bst[index]='S';
    else if(bst[index*2]!='S'&&bst[index*2+1]!='S') bst[index]='P';
    else bst[index]='R';
}
int main()
{
    int i,j;
    scanf("%d %d ",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%c",&s[i]);
    }
    k=min(k,22);
    int m=1<<k;
    make_it(1,0,m-1);
    printf("%c",bst[1]);
    return 0;
}

//Author: RingweEH
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define ll long long
#define db double
using namespace std;
int min( int a,int b ) { return a<b ? a : b; }
int max( int a,int b ) { return a>b ? a : b; }
int read()
{
    int x=0,w=1; char ch=getchar();
    while ( ch>'9' || ch<'0' ) { if ( ch=='-' ) w=-1; ch=getchar(); }
    while ( ch<='9' && ch>='0' ) x=x*10+ch-'0',ch=getchar();
    return x*w;
}

ll n,k;
char win[230][230];
string str,dbstr;

int main()
{
	n=read(); k=read(); cin>>str;
	win['R']['R']=win['R']['S']=win['S']['R']='R';
	win['S']['S']=win['S']['P']=win['P']['S']='S';
	win['P']['P']=win['P']['R']=win['R']['P']='P';

	while ( k-- )
	{
		dbstr=str+str;
		for ( int i=0; i<n; i++ )
			str[i]=win[dbstr[i*2]][dbstr[i*2+1]];
	}

	cout<<str[0];

	return 0;
}


#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& a) {
  os << "{";
  for (size_t i = 0; i < a.size(); ++i) os << (i > 0 ? "," : "") << a[i];
  return os << "}";
}

[[maybe_unused]] constexpr ll MOD = 1e9 + 7;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

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

  string a, b;
  cin >> a >> b;
  int av = 0, bv = 0;
  rep(i, 0, 3) av += a[i] - '0';
  rep(i, 0, 3) bv += b[i] - '0';
  cout << max(av, bv);
  return 0;
}

#include <iostream>
using namespace std;

int main(){
    unsigned int a, b;

    cin >> a >> b;

    unsigned long max;

    max = 2 * a + 100;
    cout << max - b << endl;

    return 0;

}


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

#define si(a)       scanf("%d",&a)
#define si2(a,b)    scanf("%d%d",&a,&b)
#define si3(a,b,c)  scanf("%d%d%d",&a,&b,&c)
#define sl(a)       scanf("%lld",&a)
#define sl2(a,b)    scanf("%lld%lld",&a,&b)
#define sl3(a,b, c)    scanf("%lld%lld%lld",&a,&b,&c)

#define pfi(a)      printf("%d", a)
#define pfl(a)      printf("%lld", a)
#define pf(a)       printf("a")
#define el          printf("\n");
#define YES         printf("YES\n")
#define NO          printf("NO\n")
#define Yes         printf("Yes\n")
#define No          printf("No\n")
#define yes         printf("yes\n")
#define no          printf("no\n")
#define space       printf(" ")
#define loop(i,a,b) for(int i=a; i<=b; i++)
#define pll         pair<ll,ll>
#define pii         pair<int, int>

#define sq(a)       (a)*(a)

#define pb          push_back
#define mk          make_pair
#define sz          size()
#define ff          first
#define ss          second
#define mem(a,val)  memset(a, val, sizeof(a))
#define all(v)      v.begin(), v.end()

#define md          1000000007
#define pi          acos(-1.0)
#define inf         1000000000000

#define p(a, b, e)  for(int i=b; i<=e; i++) printf("%lld ", a[i]);
#define csh         printf("Case #%d: ", ++cs)
#define csc         printf("Case %d: ", ++cs)

#define fast1 ios::sync_with_stdio(false);
#define fast2 cin.tie(nullptr);

int x[5]= {0, 1, 0, -1};
int y[5]= {1, 0, -1, 0};

ll a[500010], b[500010];
map<ll,ll>mp, vis;
vector<ll>v, g[2005];
vector<pll>vp;
string s,q;
char c;
void dfs(ll rt, ll &cnt)
{
    vis[rt]=1;
    cnt++;
    //cout<<"pp"<<endl;

    for(auto x: g[rt])
    {
        if(vis[x]==0)
        {
            //cout<<"pp"<<endl;
            dfs(x, cnt);
        }
    }
}
int main()
{
    ll t,n,k,m,l,r,mn=0, mx=0,sum=0, ans=0,nm=0,cnt=0,x,y,z;
    int  cs=0;

    sl2(n,m);
    for(int i=0; i<m; i++)
    {
        sl2(a[i], b[i]);
        g[a[i]].pb(b[i]);
    }

    for(ll i=1; i<=n; i++)
    {
        cnt=0;
        vis.clear();
        dfs(i, cnt);
        ans += cnt;
    }
    pfl(ans);

}

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

int N,M;
vector<int> lst[2000];
bitset<2000> visited;
queue<int> q;

int main() {
    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; ++i) {
        int u,v; scanf("%d %d", &u, &v); u--, v--;
        lst[u].push_back(v);
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        visited.reset();
        visited[i] = true;
        q.push(i);
        while (!q.empty()) {
            int u = q.front(); q.pop();
            ans++;
            for (int v: lst[u]) if (!visited[v]) {
                visited[v] = true;
                q.push(v);
            }
        }
    }
    printf("%d", ans);

    return 0;
}


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

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

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

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

void Main(){
    const ll INF = 1e18;
    ll n; cin >> n;
    vll pow3(40, 3), pow5(30, 5);

    rep(i, 40) {
        if(pow3[i] > INF/3) break;
        pow3[i+1] = 3 * pow3[i];
    }
    rep(i, 30) {
        if(pow5[i] > INF/5) break;
        pow5[i+1] = 5 * pow5[i];
    }

    rep(i, 40) rep(j, 30){
        if(n == pow3[i] + pow5[j]){
            cout << i+1 << " " << j+1 << endl;
            return;
        }
    }
    cout << -1 << endl;
    return;
}

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

/*************************************************************************
	> File Name: main.cpp
	> Author: Song
	> Mail: 2675791037@qq.com
	> Created Time: 四 11/19 08:58:42 2020
 ************************************************************************/

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>

using namespace std;

void solve() {
    string str;
    int n;
    cin >> n;
    vector<vector<bool> > a(n, vector<bool>(n, false));
    for (int i = 0; i < n; i++) {
        a[i][i] = true;
        cin >> str;
        for (int j = 0; j < str.length(); j++) {
            if (str[j] == '1') {
                a[i][j] = true;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                if (a[j][i] && a[i][k]) a[j][k] = true;
            }
        }
    }
    double ans = 0.0;
    int cnt;
    for (int i = 0; i < n; i++) {
        cnt = 0;
        for (int j = 0; j < n; j++) {
            if (a[j][i]) cnt++;
        }
        ans += 1.0 / cnt;
    }
    cout << ans << endl;
    return ;
}

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

    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
using ll = long long;
const ll INF = 1LL << 60;
using pll = pair<ll, ll>;
int main() {
  ll A, B;
  cin >> A >> B;
  ll cut = 0, V = 501510;
  rep(i, A) {
    cout << V << " ";
    cut += V;
    V--;
  }
  V = -1;
  rep(i, B-1) {
    cout << V << " ";
    cut += V;
    V--;
  }
  cout << -cut << endl;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

// Picasso didn't learn to paint by watching lectures

/*
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/

using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define ook order_of_key
#define fbo find_by_order
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define mod 1000000007
#define tot_time cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
//#define maxx 200006
#define fixed cout<<fixed<<setprecision(14);
#define ll long long
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long >
#define listi vector< int>
#define pii   pair<int , int>
#define pll pair<long long , long long >
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
#define memo(a,x ) memset( a, x ,sizeof ( a) )
#define randoms mt19937 rng(26);

const long long oo = 1e18;
double PI = 3.14159265358979323846;

template  < class  T >
vector< T > readvector  ( T  n ) {  vector < T > arr(n ) ;
	    for( int  i =0; i < n ; i ++ ) cin>>arr[i] ;
		return arr; }

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll power( ll a, ll n, ll m= 1000000007){
  ll ans = 1;
  while(n){
  if(n&1)
  {
  ans *= a;
  ans%=m;
  }
  a*=a;
  a%=m;
  n/=2;
  }
  return ans ;
}

vector< int > prm ;
vector < bool > vsp ;

void prime ( int nn = 100000 ) {
	vsp = vector < bool > ( nn+1, 0 );
	int size_prime = nn;
	for( ll i =2; i*i < size_prime ; i++){

		if( vsp[i] == 1)
		continue;
		for(ll j = i*i; j < size_prime ;j+=i){

			vsp[j] =1;

		}

	}

	for( int i= 2; i < size_prime ; i++)
	if (vsp[i] == 0)
	prm.pb(i);

}

//auto comparator = [] ( array < ll ,2 >  &a  , array < ll , 2  > &b ) {  return ( a[0] < b[0 ] || (a[ 0] == b[ 0] && a[1]  > b[1] ) ) ; } ;

//priority_queue< array <  ll  , 2> , vector< array< ll ,2 > > , decltype( comparator )  > pq ( comparator);

template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;
// oset< int > tree ;
// tree.ook ( val  )  return index of element ;
// tree.fbo ( idx )   return pointer at the element .

// end of #define

// define globals ...
const int maxx = 2e5+26;

//write function from here ...
// never forget  to recheck your predefined function in template ..
// already defined ::  prime , power , gcd : ( ll )..

int Main(){

    ll n , m ;
    cin>>n>>m;

    //int more = n-m/;
    vector< ll  > ans ;
	if (n >m ){

		int i=1 ;
		ll tot= 0;
		while ( n-->0 ){
			tot+=i;
			ans.pb(i++);
		}
		i =2 ;
		tot = tot - ( m*( m+1))/2;
		ans.pb(-(tot+1));
		while(m-- >1 )
		ans.pb( -(i++ ));
	}
	else {

		int i=1 ;
		ll tot= 0;
		while ( m-->0 ){
			tot+=i;
			ans.pb(-(i++) );
		}
		i =2 ;
		tot = tot - ( n*( n+1))/2;
		ans.pb((tot+1));
		while(n-- >1 )
		ans.pb( (i++ ));

	}

	for( int a : ans )
	cout<<a<<" ";

return 0;

}

int main(){
 quick;

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

int t =1;
//cin>>t;
while(t-- )
 Main();

 return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  int a, b;
  cin >> a >> b;
  int c = a + b;
  if (c >= 15 && b >= 8) {
    cout << 1;
  } else if (c >= 10 && b >= 3) {
    cout << 2;
  } else if (c >= 3) {
    cout << 3;
  } else {
    cout << 4;
  }
  cout << "\n";
  return 0;
}

/*
 * Author: Moon_light
 * Solution:
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lowbit(x) ((x)&(-x))
#define sz(x) ((int)x.size())
#define fr(x) freopen(x,'r',stdin)
#define fw(x) freopen(x,'w',stdout)
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (a);i<=(b); ++i)
#define per(i,a,b) for(int i = (a);i>=(b); --i)
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VB;
typedef double db;

//global variable
const int N = 1;
const int mod = 1e9+7;
int t;

//functions
LL qmi(LL a,LL k,LL mod){
    LL res = 1;
    while(k){
        if(k&1) res = res*a%mod;
        k >>= 1;
        a = a*a%mod;
    }
    return res%mod;
}
int gcd(int a,int b) {
    return b==0? a:gcd(b,a%b);
}

//code from here! Come on! Have a pleasant experience~
int main()
{
    IO;
    int a,b;
    cin>>a>>b;
    int c = a+b;
    int ans = 4;
    if(c >= 15 && b >= 8){
        ans = 1;
    }else if(c >= 10 && b >= 3){
        ans = 2;
    }else if(c >= 3){
        ans = 3;
    }
    cout<<ans<<endl;
    return 0;
}


//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
template<typename T>void rearrange(vector<ll>&ord, vector<T>&v){
  auto tmp = v;
  for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<ll>&ord,Head&& head, Tail&&... tail){
  rearrange(ord, head);
  rearrange(ord, tail...);
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  vector<vector<ll>>g(n);
  rep(i,0,m){
    ll u,v;cin>>u>>v;u--;v--;
    g[u].PB(v);
  }
  res=-INF;
  vector<ll>dp(n,INF);
  rep(i,0,n){
    chmax(res,a[i]-dp[i]);
    chmin(dp[i],a[i]);
    for(auto to:g[i]){
      chmin(dp[to],dp[i]);
    }
  }
  cout<<res<<endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
//#define MOD 1000000007
#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define ALL(v) (v).begin(), (v).end()
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug true
#define debug2 false

int main(void){

    ll A,B;
    cin >> A >> B;
    double C = A*B;
    C/=100;
    cout << setprecision(10) << C << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pob pop_back
void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<(a*d)-(b*c);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r+",stdin);
    //     freopen("output.txt","w+",stdout);
    // #endif
    solve();
}

// International Master sm0016
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define raftaar ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll MOD1=1000000007;

const ll MOD2= 998244353;

const int N=1e6+6;

int main(){
	raftaar

	int x,y,z;cin>>x>>y>>z;int ans;

	int zz=0;

	while(y*z>x*zz){

		zz++;
	}

	cout<<zz-1;
}


#include<ctime>
#include<cstdio>
#include<cctype>
#include<cstring>
#define ll long long
using namespace std;
const ll N=3e6+7;
ll read() {
	char c;
	ll x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while (isdigit(c)){
		x=x*10+(c-48)*f;
		c=getchar();
	}
	return x;
}
ll n,k,t,sum,f[5][N];
ll c[N];
void add(ll x,ll k){
	for(;x<=n*3;x+=x&-x)
		c[x]+=k;
}
ll ask(ll x){
	ll res=0;
	for(;x;x-=x&-x)
		res+=c[x];
	return res;
}
int main() {
	#ifndef ONLINE_JUDGE
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	k=read();
	f[0][0]=1;
	for(ll i=1;i<=3;++i){
		memset(c,0,sizeof(c));
		for(ll j=0;j<=n*(i-1);++j){
			add(j+1,f[i-1][j]);
			add(j+n+1,-f[i-1][j]);
		}
		for(ll j=0;j<=n*i;++j)
			f[i][j]=ask(j);
	}
	for(ll i=3;i<=n*3;++i){
		if(t+f[3][i]<k){
			t+=f[3][i];
			continue;
		}
		sum=i;
		k-=t;
		t=0;
		break;
	}
	for(ll i=n*2;i>1;--i){
		if(i>=sum)
			continue;
		if(t+f[2][i]<k){
			t+=f[2][i];
			continue;
		}
		printf("%lld ",sum-i);
		sum=i;
		k-=t;
		t=0;
		break;
	}
	for(ll i=n;i;--i){
		if(i>=sum)
			continue;
		if(t+f[1][i]<k){
			t+=f[1][i];
			continue;
		}
		printf("%lld %lld",sum-i,i);
		break;
	}
	//--------
	clock_t t2=clock();
	fprintf(stderr,"time:%0.3lfs",1.0*(t2-t1)/CLOCKS_PER_SEC);
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <numeric>
#include <climits>

using namespace std;

int main(void) {
    float a, b;
    cin >> a >> b;
    cout << b / 100.0 * a << endl;
    return 0;
}

/* dont stick to an approach */

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <bitset>
#include <chrono>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

#define PB push_back

#define For(i, n) for (ll i = 0; i < n; i++)

#define trav(a,x) for (auto& a : x)

#define PYES cout<<"YES\n"
#define PNO cout<<"NO\n"
#define PYes cout<<"Yes\n"
#define PNo cout<<"No\n"
#define endl '\n'

#define sq(x)           (x*x)

#define vll             vector<ll>
#define pll             pair<ll,ll>
#define ff              first
#define ss              second
#define rev(v)          reverse(v.begin(),v.end())
#define srt(v)          sort(v.begin(),v.end())
#define grtsrt(v)       sort(v.begin(),v.end(),greater<ll>())
#define mnv(v)          *min_element(v.begin(),v.end())
#define mxv(v)          *max_element(v.begin(),v.end())
#define all(v)          v.begin(),v.end()
#define ACC(v)          accumulate(v.begin(),v.end(),0ll)

#define Fas ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

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

//--------------------------------------------functions-------------------------------------------------//

ll power(ll a,ll b){ll result=1;while(b>0){if(b%2 == 1){result *= a;} a *= a;b /= 2;}return result;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;}
bool isPerfectSquare(ll n){ll sr = sqrt(n);if (sr * sr == n)return true;else return false;}
ll mod(ll x,ll M){return ((x%M + M)%M);}
ll add(ll a, ll b,ll M){return mod(mod(a,M)+mod(b,M),M);}
ll mul(ll a, ll b,ll M){return mod(mod(a,M)*mod(b,M),M);}
ll powerM(ll a,ll b,ll M){
    ll res=1ll;
    while(b){
        if(b%2ll==1ll){
            res=mul(a,res,M);
        }
        a=mul(a,a,M);b/=2ll;
    }
    return res;
}
ll mod_inv(ll a, ll m) {
    ll g = m, r = a, x = 0, y = 1;
    while (r != 0) {
        ll q = g / r;
        g %= r; swap(g, r);
        x -= q * y; swap(x, y);
    }
    return mod(x,m);
}
//------------------------------------sieve of erantothenes-----------------------------------------------//
//ll MAXN=1e7+150;
//vector<ll> fact(MAXN+1);
//void sieve_of_erantothenes()
//{
//    fact[1] = 1;
//    for (ll i = 2; i <= MAXN; i++)
//        fact[i] = i;
//    for (ll i = 4; i <= MAXN; i += 2)
//        fact[i] = 2;
//    for (ll i = 3; i * i <= MAXN; i++){
//        if (fact[i] == i){
//            for (ll j = i * i; j <= MAXN; j += i)
//                if (fact[j] == j)
//                    fact[j] = i;
//        }
//    }
//}
//----------------------------------------nCr mod------------------------------------------------------//
ll nCr(ll n, ll k){
    if(n<k) return 0;
    if(k==0) return 1;
    ll res = 1;
    if (k > n - k) k = n - k;
    for(ll i = 0; i < k; ++i){
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll modInverse(ll n,ll M){
    return powerM(n,M-2,M);
}
vector<ll> fact;
void factcalc(ll n,ll M){
    fact.resize(n+1);
    fact[0]=1;
    for(ll i=1;i<=n;i++){
        fact[i]=mul(fact[i-1],i,M);
    }
}
ll nCrM(ll n,ll r,ll M){
    if(n<r) return 0;
    if(r==0) return 1;
    return mul(mul(fact[n],modInverse(fact[r],M),M),modInverse(fact[n-r],M),M);
}
//-----------------------------------------------solve-----------------------------------------------------//

void solve(){
    ldb a,b;cin>>a>>b;
    cout<<(a/100)*b<<endl;
}

int main(){
    Fas;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cout<<fixed<<setprecision(20);

//    ll t=0;
//    cin>>t;
//    while (t--)

        solve();

    return 0;
}


#include <iostream>
using namespace std;
unsigned long long a,n,cnt=0;
int d;
void calc(){
    a=1000;d=1;
    while(a*1000<=n){
        a*=1000;
        d++;
    }
    cnt+=d+(n-a)*d;
}

int main(void){
    cin>>n;
    while(n>=1000){
        calc();
        n=a-1;
    }
    cout<<cnt<<endl;
}

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

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

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

    vector<ll> pw(18, 1);
    rep(i, 17) pw[i+1] = pw[i]*10;

    int K = 0;
    while(N >= pw[K]) K++;

    ll ans = 0;

    rep2(i, 1, K-1){
        ans += (pw[i]-pw[i-1])*((i-1)/3);
    }

    ans += (N+1-pw[K-1])*((K-1)/3);

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


#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll a[maxn],b[maxn],c[maxn],n;

int main()
{
	n=read(); rep(i,1,n) a[i]=read(); rep(i,1,n) b[i]=read();
	ll premax=0,ans=0;
	rep(i,1,n)
	{
		premax=max(premax,a[i]);
		c[i]=max(c[i-1],premax*b[i]);
	}
	rep(i,1,n) printf("%lld\n",c[i]);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <random>
#include <fstream>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,m;
std::string s[888];
char ans[22][22][22];
bool nochange[22][22][22],already[22][888];

void check(int t){
	int i,j,k,l;
	bool flag;
	for(k=0; k<m; ++k){
		if(already[t][k]){
			continue;
		}
		for(i=0; i<n; ++i){
			for(j=0; j<n; ++j){
				flag = true;
				for(l=0; l<s[k].l_ength(); ++l){
					if(ans[t][i][(j+l)%n] != s[k][l]){
						flag = false;
						break;
					}
				}
				if(flag){
					already[t][k] = true;
					for(l=0; l<s[k].l_ength(); ++l){
						nochange[t][i][(j+l)%n] = true;
					}
					break;
				}
				flag = true;
				for(l=0; l<s[k].l_ength(); ++l){
					if(ans[t][(i+l)%n][j] != s[k][l]){
						flag = false;
						break;
					}
				}
				if(flag){
					already[t][k] = true;
					for(l=0; l<s[k].l_ength(); ++l){
						nochange[t][(i+l)%n][j] = true;
						break;
					}
					break;
				}
			}
			if(already[t][k]){
				break;
			}
		}
	}
}

int main(void){
	int i,j,c[22],k,t,score=0;
	std::random_device seed_gen;
	std::default_random_engine engine(seed_gen());
	std::uniform_int_distribution<> rnd('A','H');
	std::cin >> n >> m;
	for(i=0; i<m; ++i){
		std::cin >> s[i];
	}
	for(t=0; t<20; ++t){
		for(k=0; k<40; ++k){
			for(i=0; i<n; ++i){
				for(j=0; j<n; ++j){
					if(!nochange[t][i][j]){
						ans[t][i][j] = rnd(engine);
					}
				}
			}
			check(t);
		}
		c[t] = 0;
		for(i=0; i<m; ++i){
			if(already[i]){
				++c[t];
			}
		}
		score = std::max(score,c[t]);
	}
	for(t=0; t<20; ++t){
		if(score < c[t]){
			continue;
		}
		for(i=0; i<n; ++i){
			for(j=0; j<n; ++j){
				std::cout << ans[t][i][j];
			}
			std::cout << std::endl;
		}
		break;
	}
	return 0;
}

#if __has_include(<atcoder/all>)
#include <atcoder/all>
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, ll>;
#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 >= (int)(b); i--)
const ll INF = 1e18;
const ld PI = acos(-1);

int N,M;
vector<string> substr;

struct Status{
    char ans[20][20];
};

Status Now;

void in(){
    cin >> N >> M;
    substr.resize(M);
    rep(i,0,M-1){
        cin >> substr[i];
    }
}

void make_randomcase(){

}

int score(){

}

void solve(){
    rep(i,0,N-1){
        rep(j,0,N-1){
            Now.ans[i][j]='A'+random()%8;
        }
    }
}

void out(){
    rep(i,0,19){
        rep(j,0,19){
            cout << Now.ans[i][j];
        }cout << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    srand((unsigned int)time(NULL));
    /*
    while(1){
        make_randomcase();
        solve();
        cerr << score() << '\n';
    }
    */
    in();
    solve();
    //cerr << score() << '\n';
    out();
}


/* Author : Anurag Bhatt
 * Date   : 2021-05-15 17:32:03
 */
#include <bits/stdc++.h>

using namespace std;

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

#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rsz resize
#define bk back()
#define pb push_back
#define ins insert
#define del erase
#define inf INT_MAX
#define db cout << "here" << endl;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define nl endl
const int MOD = 1e9+7;
const ld PI = acos((ld)-1);
mt19937 rng; // or mt19937_64
template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << h; if (sizeof...(t)) cerr << ", ";
    DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
const int MX = 200002;
const int INF = MX+MX;
vector<int> adj[MX];
void solve() {
    int n;
    cin >> n;
    string name[n];
    int height[n];
    int hei[n];
    F0R(i,n) {
        cin >> name[i];
        cin >> height[i];
        hei[i]=height[i];
    }
    sort(height,height+n);
    F0R(i,n) {
        if(hei[i]==height[n-2]) {
            cout << name[i] << endl;
            return;
        }
    }
}

int main() {
    int t = 1;
    //cin >> t; //comment if there is only one test - case
    for(int i = 1; i <= t ; i++) {
        solve();
    }
}

/*if ((double) ((double)(clock() - cl)/(double)CLOCKS_PER_SEC)>1.85) {break;}*/
//#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define double long double
#define ft first
#define sc second
#define pb push_back
#define booost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
#define all(x) (x).begin(),(x).end()
#define file(x) freopen(string(string((x)) + ".in").c_str(), "r", stdin); freopen(string(string((x)) + ".out").c_str(), "w", stdout);
#define GG cout << " OPA " << '\n';

using namespace std;
using namespace __gnu_pbds;
typedef pair <int, int> pi;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 1e5 + 5;
const int K = 1e3 + 5;
const int P = 37;
const int INF = 1e18;
const double d_INF = 2000000000.0;
const double EPS = 1e-20;
const int MOD = 1e9 + 7;
const int LOG = 25;

void solve() {
    int n;
    cin >> n;
    vector <pair <int, string> > v;
    for (int i = 1; i <= n; i ++) {
        string s;
        int x;
        cin >> s >> x;
        v.pb({x, s});
    }
    sort(all(v), greater <pair <int, string> > ());
    cout << v[1].sc << '\n';
}

main () {
    int test = 1;
    booost;
//    cin >> test;
    while (test --) {
        solve();
    }
}


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

int main(){
    ll n;
    int m;
    cin >> n >> m;
    vector<ll> a(m),sec(0);
    rep(i,m) cin >> a[i];
    a.push_back(n+1);a.push_back(0);
    sort(a.begin(),a.end());
    rep(i,m+1){
        ll si = a[i+1]-a[i]-1;
        if(si>0) sec.push_back(si);
    }
    ll k = *min_element(sec.begin(),sec.end());
    ll ans = 0;
    for( ll si : sec ) ans += (si+k-1)/k;
    // if sec%k >0 => +1
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
#define all(V) V.begin(),V.end()
#define pi 3.1415926535897932384626
#define fi fixed<<setprecision(13)
#define MOD 1000000007
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for (ll i = 1; i <=(ll)(n); i++)
#define reps(i,k,n) for (ll i = (ll)k; i < (ll)(n); i++)
using namespace std;
template<class T> void chmin(T& a,T b){ if(a > b) a=b; }
template<class T> void chmax(T& a,T b){ if(a < b) a=b; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
ll nck(ll a,ll b){
  ll s=1,x=1;
  rep(i,b) s=(s*(a-i))/x,x++;
   return s;
}
const ll infll=1LL<<62;
const ll inf=1<<30;
int main(){
  int n,m;cin>>n>>m;
  vector<int> a(n);
  map<int,int> b;
  rep(i,n){
    cin>>a[i];
    if(i<m&&a[i]<m) b[a[i]]++;
  }
  int mi=inf,ma=0;
  bool mio=false;
  rep(i,m){
    if(b[i]==0){
      mi=i;
      mio=1;
      break;
    }
  }
  if(mio==false) ma=m;
  reps(i,m,n){
    int s=a[i],t=a[i-m];
    b[s]++;
    b[t]--;
    if(b[t]==0&&mi>s) mi=t,ma=t;
  }
  if(!mio) cout<<ma;
  else cout<<mi;
}
/*制約を確認しろllじゃなくて大丈夫か？*/


#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main(void){
    int N, K;
    cin >> N >> K;
    int sum = 0;

    for(int z=1; z <= N; ++z) {

        for(int i=1; i <= K; ++i) {
            sum = sum + z * 100 + i;
        }

    }

    cout << sum << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = long long;
using Graph = vector<vector<int>>;
const long long INF = 1LL << 60;
const int SINF = 1LL << 29;
const ll mod = 1000000000+7;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll a, b;
    cin >> a >> b;
    for(int i=b-a; i>=1; i--) {
        int c;
        if(a % i == 0) c = 0;
        else c = a + i - a % i;
        if(c + i <= b) {
            cout << i << endl;
            return 0;
        }
    }
}


/* Author : Anurag Bhatt
 * Date   : 2021-05-22 17:35:47
 */
#include <bits/stdc++.h>

using namespace std;

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

#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rsz resize
#define bk back()
#define pb push_back
#define ins insert
#define del erase
#define inf INT_MAX
#define db cout << "here" << endl;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define nl endl
const int MOD = 1e9+7;
const ld PI = acos((ld)-1);
mt19937 rng; // or mt19937_64
template<class T> bool ckmin(T& a, const T& b) {
    return b < a ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << h; if (sizeof...(t)) cerr << ", ";
    DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
const int MX = 200002;
const int INF = MX+MX;
vector<int> adj[MX];
void solve() {
    int n;
    cin >> n;
    ll a[n];
    ll b[n];
    ll c[n];
    F0R(i,n) cin >> a[i];
    F0R(i,n) cin >> b[i];
    F0R(i,n) cin >> c[i];
    ll flag[100002];
    memset(flag,0,sizeof flag);
    F0R(i,n) flag[a[i]]++;
    ll ans = 0;
    F0R(i,n) {
        ans+=flag[b[c[i]-1]];
    }
    cout << ans;

}

int main() {
    int t = 1;
    //cin >> t; //comment if there is only one test - case
    for(int i = 1; i <= t ; i++) {
        solve();
    }
}

#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 FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long  int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()

#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll mod=998244353;

ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}

ll const N=(ll)1e5+11;
ll const LG=(ll)log2(N)+1;

vpll v[101];
void pre(){
        vll prime(101);
        for(int i=2;i<=100;i++){
                if(prime[i])continue;
                for(int j=i;j<=100;j+=i){
                        prime[j]=1;
                        int x=j;
                        int c=0;
                        while(x%i==0){
                                c++;
                                x/=i;
                        }
                        v[j].pb({i,c});
                }
        }
}
ll rem(ll n,ll m){
        if(n==0 || m==0)return 1;
        map<ll,ll> mp;
        for(int i=1;i<=n+m;i++){
                for(auto [x,y]:v[i]){
                        mp[x]+=y;
                }
        }
        for(int i=1;i<=n;i++){
                for(auto [x,y]:v[i]){
                        mp[x]-=y;
                }
        }
        for(int i=1;i<=m;i++){
                for(auto [x,y]:v[i]){
                        mp[x]-=y;
                }
        }
        ll ans=1;
        for(auto x:mp){
                ans*=pow2(x.ff,x.ss);
        }
        return ans;

}
void solve() {
       ll n;
    cin>>n;
    map<ll,ll> mp,mp3;
    map<ll,vll> mp2;
    vll a(n),b(n),c(n);
    for(auto &x:a)
        cin>>x,mp[x]++;
    for(auto &x:b)
        cin>>x;
    for(auto &x:c)
        cin>>x,mp3[x]++;
    for(ll i=0;i<n;i++)
    {
        mp2[b[i]].push_back(i+1);
    }
    ll ans=0;
    for(auto x:mp2)
    {
        ll t=x.first;
        vll cnt=x.second;
        for(auto y:cnt)
        {
            ans+=(mp[t]*mp3[y]);
        }
    }
    cout<<ans;

}
int main(){
        // FS;
        ll q;
        q=1;
        pre();
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}

ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;

        if(m%2==0)return pow1((n*n)%mod,m/2,mod);

        return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
        return ans;
}


#include <bits/stdc++.h>

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll cmb(ll L) {
    ll p = L;
    ll n = 11;
    ll ret = 1;
    REP(_, 11) {
        ret *= p;
        p--;
        while (n > 0 && ret % n == 0) {
            ret /= n;
            n--;
        }
    }
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll L;
    cin >> L;
    ll ans = 1;

    cout << cmb(L - 1) << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
unsigned long long int binomialCoeff(int n, int k)
{
    unsigned long long int C[n + 1][k + 1];
    int i, j;

    // Caculate value of Binomial Coefficient
    // in bottom up manner
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            // Base Cases
            if (j == 0 || j == i)
                C[i][j] = 1;

            // Calculate value using previously
            // stored values
            else
                C[i][j] = C[i - 1][j - 1] +
                          C[i - 1][j];
        }
    }

    return C[n][k];
}
int main()
{
    int l;
    cin>>l;
    cout<<binomialCoeff(l-1,11)<<endl;
    return 0;
}


#include <iostream>
#include <map>

using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  map<pair<int, int>, int> pre;
  pre[{0, 0}] = 1;
  int at = 0, cg = 0;
  int ans = 0;
  for (char c : s) {
    if (c == 'A')
      at++;
    if (c == 'T')
      at--;
    if (c == 'C')
      cg++;
    if (c == 'G')
      cg--;
    ans += pre[{at, cg}]++;
  }
  cout << ans;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

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

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

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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 fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h, w; cin >> h >> w;
    vector<string> s(h); rep (i, h) cin >> s[i];
    ll ans = 0;
    rep (i, h - 1) rep (j, w - 1) {
        int x = 0;
        rep (p, 2) rep (q, 2) x += (s[i + p][j + q] == '#');
        if (x == 1 || x == 3) ans++;
    }
    cout << ans << "\n";
    return 0;
}


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

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int main(void){
    int n;
    int ans;
    cin>>n;
    if(n>2){
        ans=n-2+1;
    }
    if(n==2)ans=1;
    if(n<2)ans=0;

    cout<<ans<<endl;
}

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

int main() {
  int N;
  cin>>N;
  cout << N-1 << endl;
}


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

#define int long long
#define pb push_back
#define all(v) begin(v), end(v)
#define inf (int)(4e18)
#define N (int)(2e5 + 10)

int isPos(int x, int n, int i) {
     if (i > 2) return 0;
     int len = 3 * (1e10);
     return 3 * (x - 1) + i + n - 1 < len;
}

bool check(string &s, string t) {
     int n = s.length();
     for (int i = 0; i < n; i += 3) {
          int got = min(3ll, n - i);
          string tukda = s.substr(i, got);
          string toMatch = t.substr(0, got);
          if (tukda != toMatch) {
               // dbg(tukda, toMatch);
               return false;
          }
     }
     return true;
}

void testCase() {
     int n; cin >> n;
     string s; cin >> s;
     if (s == "1") {cout << (int)2e10; return;}
     int type = 3;
     if (check(s, "110")) type = 0;
     else if (check(s, "101")) type = 1;
     else if (check(s, "011")) type = 2;
     int mi = 0, ma = 1;
     while (isPos(ma, n, type)) ma *= 2;
     while (mi + 1 < ma) {
          int mid = (mi + ma) / 2;
          if (isPos(mid, n, type)) mi = mid;
          else ma = mid;
     }

     cout << mi;
}

/* Work hard .. Calm and proceed */
int32_t main() {
     ios_base::sync_with_stdio(false);
     cin.tie(nullptr), cout.tie(nullptr);
     int t_c = 1;
     // cin >> t_c;
     while (t_c--)
          testCase();
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <unordered_map>
#include <cstdio>
#include <climits>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const ll INF = 10000000000;

int n;
string s;

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n >> s;
	if (n == 1) {
		if (s == "0")cout << INF << endl;
		else cout << 2 * INF << endl;
		return 0;
	}
	int p = s[0] - '0', cnt = 1;
	for (int i = 1; i < n; i++) {
		if (s[i - 1] == s[i])cnt++;
		else {
			if (p == 0) {
				if (cnt != 1) {
					cout << 0 << endl;
					return 0;
				}
				else cnt = 1, p = 1;
			}
			else {
				if (cnt > 2 || (cnt < 2 && cnt < i)) {
					cout << 0 << endl;
					return 0;
				}
				else cnt = 1, p = 0;
			}
		}
	}
	if (p == 0 && cnt != 1) {
		cout << 0 << endl;
		return 0;
	}
	if (p == 1 && cnt > 2) {
		cout << 0 << endl;
		return 0;
	}
	int d = 0;
	if (s.substr(0, 2) == "10")d = 1;
	if (s.substr(0, 2) == "01")d = 2;
	ll x = 3 * INF - n;
	while (x % 3 != d)x--;
	cout << (x - d) / 3 + 1 << endl;
}


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

#define int long long
#define bitcount(x) (int)__builtin_popcount(x)

int n, m, dp[19][1<<19] ;

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

int fun(int idx, int mask) {
    int &ans = dp[idx][mask] ;
    if (ans != -1) return ans ;
    ans = 0 ;
    bool ok = true ;
    for (auto &it: g[idx]) {
        int c = bitcount(((1<<it.first)-1) & mask) ;
        if (c > it.second) {
            ok = 0 ;
            break ;
        }
    }
    if (!ok) {
        ans = 0 ;
        return 0 ;
    }
    if (idx == n) {
        ans = 1 ;
        return ans ;
    }
    for (int i=0;i<n;++i) {
        if (!(mask&(1<<i))) {
            ans += fun(idx+1, mask|(1<<i)) ;
        }
    }
    ans = max(ans, 0LL) ;
    return ans ;
}

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

    cin >> n >> m ;
    for (int i=1;i<=m;++i) {
        int a, b, c ;
        cin >> a >> b >> c ;
        g[a].push_back({b, c}) ;
    }
    memset(dp, -1, sizeof(dp)) ;
    int ans = 0;
    for (int i=0;i<n;++i) {
        ans += fun(1, 1<<i) ;
    }
    cout << ans << endl ;
    return 0;
}

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

void f(string &X, string &Y, int t, int a, int b, int N) {
    if (t == 2) {
        swap(X, Y);
        return;
    }

    if (a < N && b < N) {
        swap(X.at(a), X.at(b));
    } else if (a < N && b >= N) {
        swap(X.at(a), Y.at(b-N));
    } else if (a >= N && b < N) {
        swap(Y.at(a-N), X.at(b));
    } else if (a >= N && b >= N) {
        swap(Y.at(a-N), Y.at(b-N));
    }
    return;
}

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    vector<int> T(Q), A(Q), B(Q);
    for (int i = 0; i < Q; i++) {
        cin >> T.at(i) >> A.at(i) >> B.at(i);
    }

    string X(N, 'a');
    for (int i = 0; i < N; i++) {
        X.at(i) = S.at(i);
    }
    string Y(N, 'a');
    for (int i = 0; i < N; i++) {
        Y.at(i) = S.at(N+i);
    }

    for (int i = 0; i < Q; i++) {
        f(X, Y, T.at(i), A.at(i)-1, B.at(i)-1, N);
    }

    cout << X << Y << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&(x));
#define pb push_back
#define fi first
#define se second
int A[55];
int P[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
int B[55];
int ans = -1;
int n;
void dfs(int x){
    if(x == 15){
        int y = 1;
        for(int i = 0; i < 15; i++){
            if(B[i]){
                y *= P[i];
            }
        }
        bool flag = true;
        for(int i = 0; i < n; i++){
            if(__gcd(A[i],y) == 1){
                flag = false;break;
            }
        }
        if(flag&& (y < ans|| ans == -1))ans = y;
        return;
    }
   B[x] = 0;
   dfs(x+1);
   B[x] = 1;
   dfs(x+1);
}
signed main()
{

    sc(n)
    for(int i = 0; i < n; i++)
    {
        sc(A[i])

    }
    dfs(0);
    cout << ans <<'\n';
}

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

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


#include<iostream>
#include<string.h>
#include<bits/stdc++.h>
#include<cctype>
#include<cstring>
using namespace std;
int main()
{
    string s;
    char c;
    int flag1=1,flag2=1;
    cin>>s;
    int l = s.length();
    for (int i = 0; i < l; i+=2)
    {
        if(i==l)
        break;
        c=s.at(i);
        if(isupper(c) != 0)
        flag1 = 0;
    }
    for (int i = 1; i < l; i+=2)
    {
        if(i==l)
        break;
        c=s.at(i);
        if(isupper(c) == 0)
        flag1 = 0;
    }
    if(flag1==1 && flag2==1)
    cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <random>
#include <chrono>
#include <numeric>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 567890;
char S[MAXN], T[MAXN];

int main() {
    int N;
    scanf("%d", &N);
    scanf("%s", S);
    scanf("%s", T);
    vector<int> idx, idx2;
    for (int i = 0; i < N; i++)
        if (S[i] == '0')
            idx.push_back(i);

    for (int i = 0; i < N; i++)
        if (T[i] == '0')
            idx2.push_back(i);

    if (idx.size() != idx2.size()) return !printf("-1\n");

    int ans = 0;

    for (int i = 0; i < (int)idx.size(); i++) {
        int want = idx2[i];
        int cur = idx[i];
        if (cur == want) continue;
        ans++;
    }
    printf("%d\n", ans);
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
by Benq;
*/


#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a,b,sizeof(a))
#define vi vector<int>
#define vii vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define w(x)  int x; cin>>x; while(x--)
#define in(a) for(auto &x: a)cin>>x;
#define out(a) for(auto x: a){cout<<x<<' ';}cout<<'\n';
#define inf 1000000000
void print(bool n){if(n)cout<<"YES";else cout<<"NO";cout<<'\n';}
//1000000007 998244353
const int MOD = 1000000007;

int add(int x, int y){
    x += y;
    while(x >= MOD)
        x -= MOD;
    while(x < 0)
        x += MOD;
    return x;
}

int sub(int x, int y){
    return add(x, MOD - y);
}

int mul(int x, int y){
    return (x * 1ll * y) % MOD;
}

int binpow(int x, int y){
    int z = 1;
    while(y > 0)
    {
        if(y % 2 == 1)
            z = mul(z, x);
        x = mul(x, x);
        y /= 2;
    }
    return z;
}

int inv(int x){
    return binpow(x, MOD - 2);
}

int divide(int x, int y){
    return mul(x, inv(y));
}

int fact[2000005];

int c(int n,int m){
	//cout<<n+m<<' '<<fact[n+m]<<' '<<mul(fact[n],fact[m])<<'\n';
	return divide(fact[n],mul(fact[n-m],fact[m]));
}
signed main(){
	int n,m,k;
	cin>>n>>m>>k;
	if(n>m+k){cout<<0<<'\n';return 0;}
	fact[0]=1;
	rep(i,1,2000005)fact[i]=mul(i,fact[i-1]);
	//cout<<fact[5]<<'\n';
	// cout<<c(n+m,n);
	// cout<<' '<<c(n+m,m+k+1)<<'\n';
	cout<<sub(c(n+m,n),c(n+m,m+k+1))<<'\n';
	return 0;
}

// Problem: E - White and Black Balls
// Contest: AtCoder - AtCoder Beginner Contest 205
// URL: https://atcoder.jp/contests/abc205/tasks/abc205_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

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

#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define endl '\n'
#define vi vector<int>
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x) //count number of 1
#define zrobits(x) __builitin_ctzll(x)     //count number of zero before 1st 1 ex- (110000)2 ->4

const int inf=0x3f3f3f3f3f3f3f3f, mod = 1e9 + 7;
int dx[]={0,1,1,1,0,-1,-1,-1};
int dy[]={1,1,0,-1,-1,-1,0,1};

// <--------------------Code Begins Here-------------------->
const int N = 2e6 + 1;
int a[N];
int power(int a, int b, int p){
	int res = 1;
	while(b != 0) {
		if(b & 1)
		  res = (res % p * a % p) % p;
		a = (a%p * a%p)%p;
		b /= 2;
	}
	return res%p;
}
int fact[N],inv[N];
void pre(int p) {
    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<N;i++)
        fact[i]=(i*fact[i-1])%p;
    for(int i=1;i<N;i++)
        inv[i]=power(fact[i], p - 2, p);
}
int nCr(int n, int r, int p) {
    if(r>n)
       return 0;
    if(n==r)
       return 1;
    if(r==0)
       return 1;
    return (((fact[n]*inv[r]) % p )*inv[n-r])%p;
}
int32_t main() {
	SPEED;
	int t = 1;
	// cin>>t;
	pre(mod);
	while(t--) {
		int n, m, k;
		cin>>n>>m>>k;
		if(n > (m + k)) {
			cout<<0;
			return 0;
		}
		int ans = nCr(n + m, n, mod);
		ans -= nCr(n + m, m + k + 1, mod);
		ans %= mod;
		if(ans < 0)ans += mod;
		cout<<ans;
	}
	return 0;
}


#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair< ll, ll > Pi;
using vl = vector<ll>;
using vs = vector<string>;
using vvl = vector<vector<ll>>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;

    }else{
        return a.second < b.second;
    }
}

bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

class UnionFind {
    public:
        UnionFind() : _n(0) {}
        UnionFind(ll n) : _n(n), parent_or_size(n, -1) {}
        ll merge(ll a, ll b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            ll x = leader(a), y = leader(b);
            if (x == y) return x;
            if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
            parent_or_size[x] += parent_or_size[y];
            parent_or_size[y] = x;
            return x;
        }
        bool same(ll a, ll b) {
            assert(0 <= a && a < _n);
            assert(0 <= b && b < _n);
            return leader(a) == leader(b);
        }
        ll leader(ll a) {
            assert(0 <= a && a < _n);
            if (parent_or_size[a] < 0) return a;
            return parent_or_size[a] = leader(parent_or_size[a]);
        }
        ll size(ll a) {
            assert(0 <= a && a < _n);
            return -parent_or_size[leader(a)];
        }
        vvl groups() {
            vl leader_buf(_n), group_size(_n);
            rep (i, _n) {
                leader_buf[i] = leader(i);
                group_size[leader_buf[i]]++;
            }
            vvl result(_n);
            rep (i, _n) result[i].reserve(group_size[i]);
            rep (i, _n) result[leader_buf[i]].pb(i);
            result.erase(
            remove_if(all(result), [&](const vl& v) { return v.empty(); }), result.end());
            return result;
        }
    private:
        ll _n;
        // root node: -1 * component size
        // otherwise: parent
        std::vector<ll> parent_or_size;
};
ll N,M;
map<Pi,ll>m;
vvl G(2e5+5);
vector<ll>seen(2e5+5);
vl ans(2e5+5);
void dfs(ll v,ll p){
    seen[v] = 1;
    rep(i,G[v].size()){
        if(seen[G[v][i]] == 0){
            //cout<<
            if(m[{v,G[v][i]}] ==p){
                dfs(G[v][i],(p)%N+1);
                ans[G[v][i]]=(p)%N+1;
            }else{
                dfs(G[v][i],m[{v,G[v][i]}]);
                ans[G[v][i]]=m[{v,G[v][i]}];
            }

        }
    }
}
int main() {

    cin >>N>>M;
    UnionFind uf(N);

    rep(i,M){
        ll u,v,c;

        cin>>u>>v>>c;
        u--,v--;
        if(!uf.same(u,v)){
            G[v].pb(u);
            G[u].pb(v);
            m[{u,v}]=c;
            m[{v,u}]=c;
            uf.merge(u,v);
        }
    }
    dfs(0,1);
    ans[0]=1;
    rep(i,N){
        cout<<ans[i]<<endl;
    }

    return 0;

}

#include <bits/stdc++.h>
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#define hh "\n"
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define mapa(a,b) make_pair(a,b)
#define mm(a,b) memset(a,b, sizeof(a));
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rof(i,a,b) for(int i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
template <typename T> T gcd (T a, T b) {while (b ^= a ^= b ^= a %= b); return a;}
inline char nc() {static char buf[1000000], *p1 = buf, *p2 = buf;return p1 == p2 && (p2 = (p1 = buf) + fread (buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;}
#define nc getchar
template <typename T> inline void read(T &sum) {char ch = nc();T tf = 0;sum = 0;while((ch < '0' || ch > '9') && (ch != '-')) ch = nc();tf = ((ch == '-') && (ch = nc()));while(ch >= '0' && ch <= '9') sum = sum * 10+ (ch - 48), ch = nc();(tf) && (sum = -sum);}
template <typename T> inline void write(T x){char F[200];T tmp=x>0?x:-x ;if(x<0)putchar('-') ;T cnt=0 ;while(tmp>0){F[cnt++]=tmp%10+'0';tmp/=10;}while(cnt>0)putchar(F[--cnt]) ;}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
int main()
{
    IOS;
    int a,b,x,y;
    cin>>a>>b>>x>>y;
    if(a==b) cout<<x;
    else if(a>b)
    {
        if(x*2<=y) cout<<x+(a-b-1)*x*2;
        else cout<<x+(a-b-1)*y;
    }else
    {
        if(x*2<=y) cout<<x+(b-a)*x*2;
        else cout<<x+(b-a)*y;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int n, ans;
int a[N], f[N];
vector < int > v;
main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], f[a[i]] = i;
	for(int i = 1; i <= n; i++) {
		if(f[i] != i) {
			if(f[i] > i) {
				for(int j = f[i]; j > i; j--) {
					f[a[j - 1]] = j;
					swap(a[j], a[j - 1]);
					ans++;
					v.push_back(j - 1);
				}
			}
			else {
				for(int j = i; j < f[i]; j++) {
					f[a[j + 1]] = j;
					swap(a[j], a[j + 1]);
					ans++;
					v.push_back(j);
				}
			}
		}
		if(ans > n - 1) {
			cout << "-1\n";
			return 0;
		}
	}
	if(ans < n - 1) {
		cout << "-1\n";
		return 0;
	}
	for(int x : v) cout << x << "\n";
}

#include <bits/stdc++.h>
using namespace std;
float inf = numeric_limits<float>::infinity();
using ll = long long;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//素数判定
bool Is_prime(ll num) {
    if (num) return false;
    //if (num != 2 && num % 2 == 0) return false;
    for (int i = 2; i <= sqrt(num); i++) {
        if (num % i == 0) return false;
    }
    return true;
}

//約数全列挙
vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

long combi(int n, int r) {
    if (r == 0) {
        return 1;
    }
    return (n - r + 1) * combi(n, r - 1) / r;
}

long factorial(int n) {
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        ans *= i;
        ans %= 100003;
    }
    return ans;
}

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


#include "iostream"
#include "vector"
#include "queue"
#include "stack"
#include "algorithm"
#include "string"
#include "cstring"
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	cout << (n + 99) / 100 << endl;

}

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

long long n;

int solve(){
	int ans = 0;
	for(int len = 1; 2 * n + len - 1ll * len * len > 0; len++){
		long long sum = 2 * n + len - 1ll * len * len;
		int d = 2 * len;
		if(sum % d == 0) ans += 2;
	}
	return ans;
}

int main(){
	scanf("%lld", &n);
	printf("%d\n", solve());
	return 0;
}


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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()
#define ff first
#define ss second

const double pi=3.1415926535897932384626433832795;
const int inf=1e9;
const ll inf2=1e18;
const int mod=1e9+7;

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void solve(){
    int n;
    cin>>n;
    vi arr(n);
    fr(i,0,n){
        cin>>arr[i];
    }
    sort(all(arr),greater<int>());
    arr.pb(0);
    ll lst=1,cur;
    n++;
    fr(i,1,n){
        cur=(lst*(arr[i-1]-arr[i]+1LL))%mod;
        lst=cur;
    }
    cout<<lst<<endl;
    return;
}

int main()
{
    boost();

    int tc=1;
    //cin>>tc;
    while(tc--)
        solve();
    return 0;
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

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

const char newl = '\n';

int main() {
    int n;
    cin >> n;
    for (int i = 0;i < n;++i) {
        cout << (i*2+1)%n+1 << " " << (i*2+2)%n+1 << newl;
    }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	const int MOD = 998244353;

	int N; cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		A[i] += i;
	}
	vector<int> B(N);
	for (int i = 0; i < N; ++i) {
		cin >> B[i];
		B[i] += i;
	}
	for (int i = 0; i < N; ++i) cerr << A[i] << " \n"[i == N-1];
	for (int i = 0; i < N; ++i) cerr << B[i] << " \n"[i == N-1];
	map<int, vector<int>> Aloc;
	map<int, vector<int>> Bloc;
	for (int i = 0; i < N; ++i) {
		Aloc[A[i]].push_back(i);
		Bloc[B[i]].push_back(i);
	}
	vector<int> perm(N);
	for (int i = N - 1; i >= 0; --i) {
		if (Bloc[A[i]].empty()) {
			cout << "-1\n";
			return 0;
		}
		perm[i] = Bloc[A[i]].back();
		Bloc[A[i]].pop_back();
	}
	// count inversions
	vector<int> fenw(N);
	int64_t ans = 0;
	for (int v : perm) {
		for (int x = v; x < N; x |= (x + 1)) ans += fenw[x];
		for (int x = v; x >= 0; x = (x & (x + 1)) - 1) fenw[x] ++;
	}
	cout << ans << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define f first
#define s second
set<pi> st;
const int nax=2e5+10;
int a[nax],b[nax];
struct node
{
    int n;
    int bit[nax+1];
    node(){}
    node(int _n):n(_n){
        memset(bit,0,sizeof(bit));
    }
    void add(int pos,int val)
    {
        if(pos<=0)
        return;
        while(pos<=n)
        {
            bit[pos]+=val;
            pos+=(pos&-pos);
        }
    }
    int qry(int pos)
    {
        int res=0;
        pos=min(pos,n);
        while(pos)
        {
            res+=bit[pos];
            pos-=(pos&-pos);
        }
        return res;
    }
};
int32_t main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<n;i++)
    cin>>b[i];
    node root(n);
    for(int i=0;i<n;i++)
    {
        st.insert({a[i]+i,i});
        root.add(i+1,1);
    }
    int res=0;
    for(int i=0;i<n;i++)
    {
        int cur=b[i]+i;
        set<pi>::iterator it=st.lower_bound({cur,-1});
        if(it!=st.end() and it->f==cur)
        {
            int j=it->s;
            res+=root.qry(j);
            st.erase(it);
            root.add(j+1,-1);
        }
        else
        {
            cout<<"-1";
            return 0;
        }
    }
    cout<<res;
    return 0;
}


// coached by Dukkha and rainboy
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 100;

int aa[N], bb[N], cc[N], dd[N];
int pp[N], qq[N], ii[N];
int rr[N], ss[N], jj[N];

int cross(int x1, int y1, int x2, int y2) {
	return x1 * y2 - x2 * y1;
}

int dot(int x1, int y1, int x2, int y2) {
	return x1 * x2 + y1 * y2;
}

void convert(int *aa, int *bb, int *pp, int *qq, int n, int x1, int y1, int i2) {
	int x2 = aa[i2], y2 = bb[i2];
	for (int i = 0; i < n; i++) {
		int x = aa[i], y = bb[i];
		pp[i] = cross(x - x1, y - y1, x2 - x1, y2 - y1);
		qq[i] = dot(x - x1, y - y1, x2 - x1, y2 - y1);
	}
}

int main() {
	int n; cin >> n;
	if (n == 1) {
		cout << "Yes\n";
		return 0;
	}
	int xa = 0, ya = 0;
	for (int i = 0; i < n; i++) {
		cin >> aa[i] >> bb[i];
		xa += aa[i], ya += bb[i];
		aa[i] *= n, bb[i] *= n;
	}
	int xb = 0, yb = 0;
	for (int i = 0; i < n; i++) {
		cin >> cc[i] >> dd[i];
		xb += cc[i], yb += dd[i];
		cc[i] *= n, dd[i] *= n;
	}
	for (int i2 = 0; i2 < n; i2++)
		if (aa[i2] != xa || bb[i2] != ya) {
			convert(aa, bb, pp, qq, n, xa, ya, i2);
			break;
		}
	for (int h = 0; h < n; h++)
		ii[h] = h;
	sort(ii, ii + n, [] (int i, int j) { return pp[i] < pp[j] || pp[i] == pp[j] && qq[i] < qq[j]; });
	for (int i2 = 0; i2 < n; i2++)
		if (cc[i2] != xb || dd[i2] != yb) {
			convert(cc, dd, rr, ss, n, xb, yb, i2);
			for (int h = 0; h < n; h++)
				jj[h] = h;
			sort(jj, jj + n, [] (int i, int j) { return rr[i] < rr[j] || rr[i] == rr[j] && ss[i] < ss[j]; });
			bool yes = true;
			for (int h = 0; h < n; h++) {
				int i = ii[h], j = jj[h];
				if (pp[i] != rr[j] || qq[i] != ss[j]) {
					yes = false;
					break;
				}
			}
			if (yes) {
				cout << "Yes\n";
				return 0;
			}
		}
	cout << "No\n";
	return 0;
}

// 問題の URL を書いておく
//

#include <bits/stdc++.h>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#define P(fmt, ...) printf(fmt, __VA_ARGS__)
#define LP printf("L: %d\n", __LINE__)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)
#define P(fmt, ...) ((void)0)
#define LP ((void)0)

#endif

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

using ll = long long;

const double PI = acos(-1);
using P = pair<int, int>;

int calcDist(const P& a, const P& b)
{
    return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
}

int calcMul(const P& a, const P& b)
{
    return a.first * b.second - b.first * a.second;
}

pair<P, int> calcDistAndMul(const P& a, const P& b, const P& c)
{
    P dm;
    dm.first = calcDist(a, c);
    dm.second = calcDist(b, c);
    P v0 = {c.first - a.first, c.second - a.second};
    P v1 = {c.first - b.first, c.second - b.second};

    auto mul = calcMul(v0, v1);
    return {dm, mul};
}

int main(int, const char**)
{
    int N;
    cin >> N;
    vector<P> S(N), T(N);
    rep(i, N) cin >> S[i].first >> S[i].second;
    rep(i, N) cin >> T[i].first >> T[i].second;

    if(N == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    if(N == 2)
    {
        if(calcDist(S[0], S[1]) == calcDist(T[0], T[1]))
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
        return 0;
    }

    vector<pair<P, int>> md(N - 2);
    rep(i, N - 2)
    {
        auto ti = i + 2;
        md[i] = calcDistAndMul(T[0], T[1], T[ti]);
    }

    sort(md.begin(), md.end());
#if 1
    rep(i, N - 2)
    {
        P("[%d]: (%d, %d, %d)\n", i, md[i].first.first, md[i].first.second, md[i].second);
    }
#endif

    rep(i, N) rep(j, N)
    {
        if(i == j) continue;
        P("i, j = (%d, %d)-----------------\n", i, j);
        vector<pair<P, int>> d(N - 2);
        int dcount = 0;
        rep(k, N)
        {
            if(k == i || k == j) continue;
            d[dcount++] = calcDistAndMul(S[i], S[j], S[k]);
        }
        sort(d.begin(), d.end());

#if 1
        rep(k, dcount)
        {
            P("[%d]: (%d, %d, %d)\n", k, d[k].first.first, d[k].first.second, d[k].second);
        }
#endif
        bool valid = true;
        rep(k, dcount)
        {
            if(md[k] != d[k])
            {
                valid = false;
                break;
            }
        }
        if(valid)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

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


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	string s; cin >> s;
	cout << s[1] << s[2] << s[0] << endl;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    // C - Rotate
    char a,b,c;
    cin>>a>>b>>c;
    cout<<b<<c<<a;
}


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

int main() {
    ll S, P;
    cin >> S >> P;

    vector<ll> div;
    for (ll i = 1; i * i <= P; ++i) {
        if (P % i == 0) {
            div.push_back(i);
            if (i * i != P)
                div.push_back(P / i);
        }
    }

    for (ll d : div) {
        ll a = d;
        ll b = P / a;
        if (a + b == S) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

#include <iostream>
using namespace std;

long S, P;

int main() {
    cin >> S >> P;

    for ( int i = 0; i < 10000000; i++ ) {
        if ( ( i * (S-i) ) == P ) {
            cout << "Yes" << endl;
            goto END;
        }
    }
    cout << "No" << endl;
END:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
int lst[3][11];
int nlst[10];

bool check(void) {
    int num[3] = {0};
    for (int i = 0; i < 3; i++) {
        if (nlst[lst[i][0]] == 0) return false;
        for (int j = 0; j < lst[i][10]; j++) {
            num[i] *= 10;
            num[i] += nlst[lst[i][j]];
        }
    }
    return (num[0] + num[1] == num[2]);
}

signed main(void) {
    string s;
    bool b;
    char clst[10];
    int cp = 0;
    for (int i = 0; i < 3; i++) {
        cin >> s;
        for (int j = s.size() - 1; j >= 0; j--) {
            lst[i][10] = s.size();
            b = true;
            // アルファベットを数字に変換
            for (int k = 0; k < cp; k++) {
                if (clst[k] == s[j]) {
                    lst[i][j] = k;
                    b = false;
                    break;
                }
            }
            if (b) {
                if (cp >= 10) {
                    // 11文字以上使われてる
                    cout << "UNSOLVABLE" << endl;
                    return 0;
                }
                clst[cp] = s[j];
                lst[i][j] = cp;
                cp++;
            }
        }
    }

    vector<int> seed = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(seed.begin(), seed.end());
    do {
        for (int i = 0; i < 10; i++) nlst[i] = seed[i];
        b = check();
        if (b) break;
    } while (next_permutation(seed.begin(), seed.end()));

    if (b) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < lst[i][10]; j++) cout << nlst[lst[i][j]];
            cout << endl;
        }
    } else
        cout << "UNSOLVABLE" << endl;
}

#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (long long i = (s); i < (long long)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Pll = pair<ll, ll>;

int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> ball(n+1, vector<ll>()), dp(n+1, vector<ll>(2, 0LL));
    rep(i, n){
        ll x, c;
        cin >> x >> c;
        ball[c].push_back(x);
    }
    ll nowl = 0LL, nowr = 0LL;
    rep(i, n){
        ll balllen = ball[i+1].size();
        if(balllen){
            sort(ball[i+1].begin(), ball[i+1].end());
            ll nextl = ball[i+1][0], nextr = ball[i+1][balllen-1];
            ll dis = nextr - nextl;
            dp[i+1][0] = min(dp[i][0] + abs(nowl - nextr), dp[i][1] + abs(nowr - nextr)) + dis;
            dp[i+1][1] = min(dp[i][0] + abs(nowl - nextl), dp[i][1] + abs(nowr - nextl)) + dis;
            nowl = nextl;
            nowr = nextr;
        }else{
            rep(j, 2){
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    cout << min(dp[n][0] + abs(nowl), dp[n][1] + abs(nowr)) << endl;
    return 0;
}


#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

struct edge{
        int to;
        ll cost;
        edge(){}
        edge(int a, ll b) : to(a), cost(b){}
    };
using ve = vector<edge>;

void bfs(vec &a, vec &b, vec &dist){
    mat G(N);
    rep(i, N - 1) {
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    dist[0] = 0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(int to : G[v]){
            if(dist[to] == INF){
                dist[to] = dist[v] + 1;
                que.push(to);
            }
        }
    }
}

void dfs(int p, int v, vec &a, vec &b, vec &c, vector<ve> &G, ll &res, vec &cv){
    if(p != -1) cv[v] += cv[p];
    for(edge e : G[v]){
        if(e.to != p){
            cv[e.to] += e.cost;
            dfs(v, e.to, a, b, c, G, res, cv);
        }
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>N;
    vector<ve> G(N);
    vec a(N-1), b(N-1), c(N-1, 0), cv(N, 0), dist(N, INF);
    rep(i, N - 1){
        cin>>a[i]>>b[i];
        --a[i]; --b[i];
    }
    bfs(a, b, dist);
    cin>>Q;
    ll res = 0;
    rep(_, Q){
        int t, e, x;
        cin>>t>>e>>x;
        --e;
        if(dist[a[e]] > dist[b[e]]) t = 3 - t;
        if(t == 1){
            res += x;
            c[e] -= x;
        }else{
            c[e] += x;
        }
    }
    rep(i, N - 1) if(dist[a[i]] > dist[b[i]]) swap(a[i], b[i]);
    rep(i, N - 1){
        G[a[i]].emplace_back(b[i], c[i]);
        G[b[i]].emplace_back(a[i], 0);
    }
    dfs(-1, 0, a, b, c, G, res, cv);
    rep(i, N){
        cout<<res + cv[i]<<endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int parent[200005],a[200005],b[200005];
ll prop[200005];
vector<int>edges[200005];

void dfs(int u,int p)
{
    parent[u] = p;
    for(int v:edges[u])
    {
        if(v==p) continue;
        dfs(v,u);
    }
    return ;
}
void dfs2(int u,int p)
{
    prop[u] += prop[p];
    for(int v:edges[u])
    {
        if(v==p) continue;
        dfs2(v,u);
    }
    return ;
}

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

    int n,i,j,u,v,t;
    ll w;
    cin >> n;
    for(i=1;i<n;i++)
    {
        cin >> u >> v;
        a[i] = u;
        b[i] = v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    dfs(1,0);

    int q;
    cin >> q;

    while(q--)
    {
        cin >> t >> i >> w;
        if(t==1)
        {
            u = a[i];
            v = b[i];
        }
        else
        {
            u = b[i];
            v = a[i];
        }
        if(u==parent[v])
        {
            prop[1] += w;
            prop[v] -= w;
        }
        else
            prop[u] += w;
    }
    dfs2(1,0);
    for(i=1;i<=n;i++)
        cout << prop[i] << endl;
}