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

// UnionFind
class UnionFind{
	vector<int> d;
	int m;
	public:
	UnionFind(int n = 0):d(n,-1),m(1){}
	~UnionFind(){}
	int find(int x){
		if(d[x] < 0) return x;
		return d[x] = find(d[x]);
	}
	bool unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return false; // 既にxとyは繋がっている。
		if(d[x] > d[y]) swap(x,y);
		d[x] += d[y];
		d[y] = x;
		m = (m < -d[x] ? -d[x] : m);
		return true;
	}
	bool same(int x, int y) { return find(x) == find(y);}
  	int size(int x) { return -d[find(x)];}
  	int sizeMax() { return m;}
};

int main() {
	int N, M;
	cin >> N >> M;
	vector<ll> a(N,0);
	vector<ll> b(N,0);
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	for(int i = 0; i < N; i++){
		cin >> b[i];
	}
	UnionFind U(N);
	for(int i = 0; i < M; i++){
		int c,d;
		cin >> c >> d;
		c--;
		d--;
		U.unite(c,d);
	}
	map<int,ll> P;
	map<int,ll> Q;
	for(int i = 0; i < N; i++){
		int f = U.find(i);
		P[f] += a[i];
		Q[f] += b[i];
	}
	int f = 0;
	for(auto it = P.begin(); it != P.end(); it++){
		if(P[it->first] != Q[it->first]){
			cout << "No" << endl;
			return(0);
		}
	}
	cout << "Yes" << endl;
	return(0);
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define pb push_back
#define vi vector<int>
#define vl vector<long long>
#define fast  \
  cin.tie(0); \
  ios::sync_with_stdio(false);
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, int>;

struct UnionFind {
  vector<int> rank, par;
  UnionFind() {}
  UnionFind(int n) {
    rank.resize(n, 0);
    par.resize(n, 0);
    for (int i = 0; i < n; i++) {
      makeTree(i);
    }
  }
  void makeTree(int x) {
    par[x] = x;
    rank[x] = 0;
  }
  bool isSame(int x, int y) { return findRoot(x) == findRoot(y); }
  bool unite(int x, int y) {
    x = findRoot(x);
    y = findRoot(y);
    if (x == y) return false;
    if (rank[x] > rank[y]) {
      par[y] = x;
    } else {
      par[x] = y;
      if (rank[x] == rank[y]) {
        rank[y]++;
      }
    }
    return true;
  }
  int findRoot(int x) {
    if (x != par[x]) {
      par[x] = findRoot(par[x]);
    }
    return par[x];
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  vl a(n), b(n);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, n) cin >> b[i];
  UnionFind s(n);
  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    s.unite(a - 1, b - 1);
  }
  map<int, vi> g;
  rep(i, 0, n) g[s.findRoot(i)].pb(i);
  for(auto i:g){
    ll cnt = 0;
    ll cnt2 = 0;
    for(auto j:i.se){
      cnt += a[j];
      cnt2 += b[j];
    }
    if(cnt != cnt2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5;
const int inf=1e9;
vector<pair<int,long>> g[siz];
long dist[siz];
void dfs(int v, int par, long d){
	dist[v] = d;
	for(pair<int,long> p:g[v]){
		int u = p.first;
		long w = p.second;
		if(u == par) continue;
		dfs(u, v, d ^ w);
	}
}
long calc(long x, int j){
  	rep(i,0,j) (x *= 2) %= mod;
  	return x;
}
int main(){
	int N; cin>>N;
	int a,b; long c;
	rep(i,0,N-1){
		cin>>a>>b>>c; a--; b--;
		g[a].push_back({b, c});
		g[b].push_back({a, c});
	}
	dfs(0, -1, 0);
	long cnt[60] = {};
	rep(i,0,N)rep(j,0,60){
		if(dist[i] & (1L<<j)) cnt[j]++;
	}
	long ans = 0;
	rep(j,0,60) (ans += calc(cnt[j] * (N-cnt[j]) % mod, j)) %= mod;
	cout<<ans<<endl;
}

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

using lli = long long int;
using ii = pair<int, lli>;

const int MAXN = 2e5;
const lli MOD = 1e9+7;

int n;
vector<ii> adj[MAXN+1];

lli rootXor[MAXN+1];
void dfs(int u, int p, lli x) {
    rootXor[u] = x;

    for(ii v: adj[u]) {
        if(v.first == p) {
            continue;
        }

        dfs(v.first, u, x ^ v.second);
    }
}

lli safeMult(lli a, lli b) {
    if(!b) {
        return 0;
    }

    if(b%2) {
        return (safeMult(a, b-1) + a) % MOD;
    }
    else {
        lli aux = safeMult(a, b/2);
        return (aux + aux) % MOD;
    }
}

int main() {
    scanf("%d", &n);

    for(int i=0; i<n-1; i++) {
        int u, v;
        lli w;
        scanf("%d %d %lld", &u, &v, &w);

        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
    }

    dfs(1, 1, 0);

    vector<lli> ones(60, 0);

    lli ans = 0;
    for(int i=1; i<=n; i++) {
        lli cand = 0;
        for(int j=0; j<60; j++) {
            lli zeroes = (i-1)-ones[j];
            if(rootXor[i]&(lli(1) << j)) {
                cand += safeMult(lli(1) << j, zeroes);
            }
            else {
                cand += safeMult(lli(1) << j, ones[j]);
            }
            cand = cand % MOD;
        }
        ans = (ans + cand) % MOD;

        for(int j=0; j<60; j++) {
            if(rootXor[i]&(lli(1) << j)) {
                ones[j]++;
            }
        }
    }
    printf("%lld\n", ans);
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2e5 + 5;
vector<int> adj[maxn];
int x, y;
int a[maxn], b[maxn];
bool visited[maxn];

void dfs(int src)
{
	visited[src] = true;
	x += a[src];
	y += b[src];
	for (auto node : adj[src])
	{
		if (!visited[node])
		{
			dfs(node);
		}
	}
}

int32_t main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		cin >> b[i];
	for (int i = 0, u, v; i < m; i++)
	{
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	bool ispossible = true;
	for (int i = 1; i <= n; i++)
	{
		if (!visited[i])
		{
			x = y = 0;
			dfs(i);
			if (x != y)
			{
				ispossible = false;
				break;
			}
		}
	}
	if (ispossible)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
	return 0;
}

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

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<pair<long double, int> , null_type,less<pair<long double, int> >, rb_tree_tag,tree_order_statistics_node_update>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

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

const int inf = int(1e9);
const ll INF = ll(1e16);
const int mod = inf + 7;
const double PI = acos(-1.0);
void mul(ll &x, ll y){
  x *= y;
  if(x >= mod) x %= mod;
}
ll bp(ll a, ll n, ll cm){
  ll r = 1;
  while(n){
    if(n & 1) r = r * a % cm;
    a = a * a % cm;
    n >>= 1;
  }
  return r;
}
template<typename T_vector> // neal
void output_vector(const T_vector &v, bool add_one = false, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n');
}
const int N = 200200;
int a[N], b[N], used[N];
vector<int> g[N];
vector<int> id, val;
ll s1, s2;
void dfs(int v){
  used[v] = 1;
  s1 += a[v];
  s2 += b[v];
  for(int to : g[v]){
    if(!used[to]){
      dfs(to);
    }
  }
}
void solve(){
  int n, m;
  cin >> n >> m;
  rep(i, n){
    cin >> a[i];
  }
  rep(i, n){
    cin >> b[i];
  }
  rep(i, m){
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].pb(y);
    g[y].pb(x);
  }
  bool bad = 0;
  rep(i, n){
    if(!used[i]){
      s1 = 0, s2 = 0;
      dfs(i);
      bad |= (s1 != s2);
    }
  }
  cout << (bad ? "No" : "Yes");
}

int main()
{
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    Red;
    int T = 1;
    // cin >> T;
    for(int i = 1; i <= T; ++i){
      solve();
    }
    return 0;

}


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

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

    ll N; cin >> N;
    vector<vector<ll>> p(N, vector<ll> (5));
    rep(i,N)rep(j,5) cin >> p[i][j];
    vector<vector<pair<ll,ll>>> x(5, vector<pair<ll,ll>> (N));
    rep(j,5)rep(i,N) x[j][i] ={p[i][j], i};
    rep(j,5) sort(x[j].begin(), x[j].end());

    if(N <= 10){
        ll ans = 0;
        rep(i,N)rep(j,i)rep(k,j){
            ll cnt = 1e18;
            rep(r,5){
                cnt = min(cnt, max({p[i][r], p[j][r], p[k][r]}));
            }
            ans = max(ans, cnt);
        }
        cout << ans << endl;
        return 0;
    }

    ll ans = 0;
    rep(i,N)rep(j,i){
        auto p1 = p[i];
        auto p2 = p[j];
        ll mi = 1e18, id = 0;
        rep(k,5){
            if(mi > max(p1[k], p2[k])){
                mi = max(p1[k], p2[k]);
                id = k;
            }
        }

        ll it = x[id][N - 1].second;
        if(it == i || it == j) it = x[id][N - 2].second;
        if(it == i || it == j) it = x[id][N - 3].second;
        auto p3 = p[it];

        ll cnt = 1e18;
        rep(k,5){
            cnt = min(cnt, max({p1[k], p2[k], p3[k]}));
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
//#include <atcoder/all>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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;}

int main(){
  ll N; cin >> N;
  vector<int> op;
  ll x=0,y=0;
  vector<ll> fib={1,1};
  for(int i=2;;i++){
    if(fib[i-1]+fib[i-2]>1e18) break;
    fib.pb(fib[i-1]+fib[i-2]);
  }
  int sf = sz(fib);
  int S=sf-1;
  int t = 0;
  while(1){
    if(x+fib[S-t]<=N){
      op.pb(1);
      N-=fib[S-t];
    }
    op.pb(4);
    t++;
    if(x+fib[S-t]<=N){
      N-=fib[S-t];
      op.pb(2);
    }
    op.pb(3);
    t++;
    if(t>=S) break;
  }

  cout << sz(op) << endl;
  rep(i,sz(op)) cout << op[i]  << endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

ll n;
ll a[100005];
vector<ll> ve[100005], now;
ll d[100005];
bool v[100005];

int main()
{
    scanf("%lld", &n);
    for(ll i = 2; i <= n; i++)
    {
        scanf("%lld", &a[i]);
        ve[a[i]].push_back(i);
    }
    for(ll i = n; i >= 1; i--)
    {
        ll t = 0;
        now.clear();
        d[i]--;
        for(ll j = 0; j < ve[i].size(); j++)
        {
            ll jj = ve[i][j];
            if(v[jj]) now.push_back(d[jj]);
            else if(d[jj] > 0) d[i] += d[jj];
            else t += d[jj];
        }
        if((ll)now.size() % 2 == 1) d[i] -= t, v[i] = false;
        else d[i] += t, v[i] = true;
        sort(now.begin(), now.end(), greater<int>());
        for(ll j = 0; j < (ll)now.size() - 1; j += 2) d[i] += now[j] - now[j + 1];
        if((ll)now.size() % 2 == 1) d[i] += now[now.size() - 1];
    }
    printf("%lld\n", (n - d[1]) / 2);
    return 0;
}

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll>
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second
#define M 1000000007
ll max(ll a,ll b){if (a>b) return a; else return b;}
ll min(ll a,ll b){if(a<b) return a; return b;}
ll mod=998244353;

ll po(ll x, ll y){
    if(y==0)
    return 1;
    if(y%2){
        return ((x)*(po(x,y/2)%M)*(po(x,y/2)%M) + M)%M;
    }
   return ((po(x,y/2)%M)*(po(x,y/2)%M) + M)%M;
}

void seive(bool prime[]){
    //bool prime[100002];

    for (ll p=2; p*p<=1000001; p++)
    {
        if (prime[p])
        {
            for (ll i=p*p; i<=1000001; i+=p)
                prime[i] = false;
        }
    }
}

ll powermod(ll x,ll y,ll p)  {
  ll res = 1;
    x = x % p;
 if (x == 0) return 0;
    while (y > 0)
    {     if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

ll gcd(ll x, ll y){
    if (y == 0)
    return x;
    else
    return gcd(y, x % y);
}

ll nck(ll n, ll k){
    ll C[k + 1];
    memset(C, 0, sizeof(C));
    C[0] = 1;
    for (ll i = 1; i <= n; i++) {
        for (ll j = min(i, k); j > 0; j--)
            C[j] = (C[j]%M + C[j - 1]%M)%M;
    }
    return C[k]%M;
}

/*void call(vll &primefactor,int N){
    for(int i=1;i<N;i++)
    {
        primefactor[i]=i;
    }
    for(int i=2;i<N;i++)
    {
        if(primefactor[i]!=i)
            continue;
        for(int j=i;j<N;j+=i)
            primefactor[j]=i;
    }
}*/
string divi(string number, int divisor)
{
    // As result can be very large store it in string
    string ans;

    // Find prefix of number that is larger
    // than divisor.
    int idx = 0;
    int temp = number[idx] - '0';
    while (temp < divisor)
        temp = temp * 10 + (number[++idx] - '0');

    // Repeatedly divide divisor with temp. After
    // every division, update temp to include one
    // more digit.
    while (number.size() > idx) {
        // Store result in answer i.e. temp / divisor
        ans += (temp / divisor) + '0';

        // Take next digit of number
        temp = (temp % divisor) * 10 + number[++idx] - '0';
    }

    // If divisor is greater than number
    if (ans.length() == 0)
        return "0";

    // else return ans
    return ans;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
    //cin>>t;
    while(t--){
        string s; ll k; cin>>s>>k;
        fo(i,k){
            ll n=s.size();
            if(n>=3 && s[n-1]=='0' && s[n-2]=='0' && (s[n-3]-'0')%2==0){
                string kk=s.substr(0,n-2);
                s=divi(kk,2);
            }
            else
            s+="200";
        }
        cout<<s<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll              long long int
#define ld              long double
#define ff              first
#define ss              second
#define mod             1000000007
#define ull             unsigned long long
#define vll             vector<ll>
#define uom             unordered_map
#define uos             unordered_set
#define pll             pair<ll, ll>
#define INF             9223372036854775807
#define w(t)            ll tests;    cin>>tests;        while(tests--)
#define endl            "\n"
#define pb(x)           push_back(x)
#define ppb()            pop_back()
#define all(x)          x.begin(), x.end()
#define mp(a, b)        make_pair(a, b)
#define setp(x, y)      fixed << setprecision(x) << y
#define f(i, a, b)      for(ll i = a ; i < b ; i++)
#define fo(j, a, b)     for(ll j = a ; j >= b ; j--)
#define fill(a, n, x)   f(i, 0, n)     a[i]=x;
using namespace std;

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

int main() {

    init();
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n;
    cin >> n;

    vll v;
    ll i = 1;
    while (i <= 1e18)
    {
        v.pb(i);
        i *= 2;
    }

    ll mn = INF;
    f(i, 0, v.size())
    mn = min(mn, n / v[i] + i + n % v[i]);

    cout << mn;

    return 0;
}

#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

int main()
{
    ull N;
    cin >> N;
    ull b = floor(log2(N)), sum = LLONG_MAX;
    for (int i = 0; i <= b; i += 1)
        sum = min(sum, (N / (1ULL << i)) + i + (N % (1ULL << i)));
    cout << sum;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll k, dp[262144][18], ok[18][18];
ll solve(ll m, ll e){
	if (dp[m][e] != 0) return dp[m][e];
	if ((m ^ (1ll << e)) == 0) return dp[m][e] = 1;
	dp[m][e] = 1e18;
	for (ll i = 0; i < k; i++){
		if (ok[i][e] != -1 && m & (1 << i)) dp[m][e] = min(dp[m][e], solve(m & ~(1ll << e), i) + ok[i][e]);
	}
	return dp[m][e];
}
int main(){
	ll n, m, ans = 1e18;
	scanf("%ld %lld", &n, &m);
	ll a[m], b[m];
	vector<ll> ad[n];
	for (ll i = 0; i < m; i++){
		scanf("%lld %lld", &a[i], &b[i]), a[i]--, b[i]--;
		ad[a[i]].emplace_back(b[i]);
		ad[b[i]].emplace_back(a[i]);
	}
	scanf("%lld", &k);
	ll c[k];
	for (ll i = 0; i < k; i++) scanf("%lld", &c[i]), c[i]--;
	for (ll i = 0; i < k; i++){
		queue<ll> q;
		q.push(c[i]);
		ll d[n];
		fill(d, d + n, -1);
		d[c[i]] = 0;
		while (!q.empty()){
			ll f = q.front();
			q.pop();
			for (ll e : ad[f]){
				if (d[e] == -1){
					d[e] = d[f] + 1;
					q.push(e);
				}
			}
		}
		for (ll j = 0; j < k; j++) if (i != j) ok[i][j] = d[c[j]];
	}
	for (ll i = 0; i <= k; i++) ans = min(ans, solve((1ll << k) - 1, i));
	if (ans == 1e18) ans = -1;
	printf("%lld\n", ans);
}

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

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

ll N;
vector<pair<ld,ld>> P;
ld dist[110][110];

map<ld,bool> rad;

void init() {
    cin >> N;
    rep(i,N) {
        ld x, y; cin >> x >> y;
        P.push_back({x,y});
    }
    rep(i,N) {
        rep(j,N) {
            if (i==j) continue;
            ld from_x = P[i].first, from_y = P[i].second;
            ld to_x = P[j].first, to_y = P[j].second;
            ld dx = to_x - from_x, dy = to_y - from_y;
            dist[i][j] = sqrt(dx*dx+dy*dy);
        }
        dist[i][N] = dist[N][i] = (ld)100 - P[i].second;
        dist[i][N+1] = dist[N+1][i] = P[i].second + (ld)100;
    }
    dist[N][N+1] = dist[N+1][N] = 200.0;
    rep(i,N+2) rep(j,N+2) {
        rad[dist[i][j]*0.5] = true;
    }
    rad[100.0] = true;
}

bool judge(ld r) {
    ld d = (ld)2*r;
    vector<vector<ll>> G(N+2);
    rep(i,N+2) rep(j,N+2) {
        if (dist[i][j]>=d) continue;
        G[i].push_back(j);
    }
    queue<ll> que;
    que.push(N);
    vector<bool> seen(N+2);
    seen[N] = true;
    while (que.size()) {
        ll x = que.front();
        que.pop();
        for (ll y : G[x]) {
            if (seen[y]) continue;
            seen[y] = true;
            que.push(y);
        }
    }
    return seen[N+1];
}

void solve() {
    init();
    ld ans = 0.0;
    for (auto p : rad) {
        ld r = p.first;
        bool NG = judge(r);
        if (NG) break;
        ans = r;
    }
    cout << fixed << setprecision(10);
    cout << ans << endl;
}

int main() {
    solve();
}


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

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

int main(void)
{
    ll n,tmp;
    cin >> n;
    vector<ll> v;

    for(long i=1;i<=sqrt(n);++i)
    {
        if(n%i==0)
        {
            cout << i << endl;
            if(i!=n/i)
            {
                v.push_back(n/i);
            }
        }
    }
    if(v.size()==0)
    {
        return 0;
    }
    for(long i=0;i<=v.size();++i)
    {
        tmp=v[v.size()-i];
        if(tmp!=0)
        {
            cout << v[v.size()-i] << endl;
        }
    }

    return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int n, m, k;
char graph[501][501];

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

bool isValid(int x, int y)
{
	return x < n && y < m && x >= 0 && y >= 0 && graph[x][y] == 'X';
}

void dfs(int i, int j)
{

	if (times == 0)
	{
		for (int i = 0; i < n; i++)
			printf("%s\n", graph[i]);
		exit(0);
	}

	graph[i][j] = '.';
	times--;

	for (int p = 0; p < 4; p++)
	{
		int g = i + dx[p];
		int h = j + dy[p];

		if (isValid(g, h))
		{
			dfs(g, h);
		}
	}

}

int32_t main() {

	//c_p_c();
	FIO;

	int n;
	cin >> n;

	int i;
	set<int>se;

	for (i = 1; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			se.insert(i);
			se.insert(n / i);
		}

	}

	for (auto &it : se)
		cout << it << endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T,typename U>T & chmax(T &a,const U &b){if(a<b){a=b;} return a;}
template<typename T,typename U>T & chmin(T &a,const U &b){if(b<a){a=b;} return a;}

//BEGIN CUT HERE
template <typename T>
struct SegmentTree{
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;

  SegmentTree(F f,T ti):f(f),ti(ti){}

  void init(int n_){
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }

  void build(const vector<T> &v){
    int n_=v.size();
    init(n_);
    for(int i=0;i<n_;i++) dat[n+i]=v[i];
    for(int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }

  void set_val(int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
  }

  T query(int a,int b){
    if(a>=b) return ti;
    T vl=ti,vr=ti;
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }

  template<typename C>
  int find(int st,C &check,T &acc,int k,int l,int r){
    if(l+1==r){
      acc=f(acc,dat[k]);
      return check(acc)?k-n:-1;
    }
    int m=(l+r)>>1;
    if(m<=st) return find(st,check,acc,(k<<1)|1,m,r);
    if(st<=l and !check(f(acc,dat[k]))){
      acc=f(acc,dat[k]);
      return -1;
    }
    int vl=find(st,check,acc,(k<<1)|0,l,m);
    if(~vl) return vl;
    return find(st,check,acc,(k<<1)|1,m,r);
  }

  template<typename C>
  int find(int st,C &check){
    T acc=ti;
    return find(st,check,acc,1,0,n);
  }
};
//END CUT HERE

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

  ll H,W,M;
  cin>>H>>W>>M;
  vector<vector<ll>> ROW(H),COL(W);
  for(auto &I:ROW){I.push_back(W);}
  for(auto &I:COL){I.push_back(H);}
  for(int i=0;i<M;i++){
    int X,Y;
    cin>>X>>Y;
    X--; Y--;
    ROW[X].push_back(Y);
    COL[Y].push_back(X);
  }
  for(auto &I:ROW){sort(I.begin(),I.end());}
  for(auto &I:COL){sort(I.begin(),I.end());}
  ll ans=0;

  auto f=[](ll a,ll b){return a+b;};
  SegmentTree<ll> Tr(f,0);
  Tr.build(vector<ll>(3e5,0));

  priority_queue<pll> PQ;

  for(int i=0;i<COL[0][0];i++){ans+=ROW[i][0]; PQ.push({ROW[i][0],i});}
  for(int i=0;i<ROW[0][0];i++){ans+=COL[i][0];}
  for(int i=ROW[0][0]-1;i>=0;i--){
    while(!PQ.empty() && PQ.top().F>i){Tr.set_val(PQ.top().S,1); PQ.pop();}
    ans-=Tr.query(0,COL[i][0]);
  }
  cout<<ans<<endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
namespace Ruri{
    #define ms(a,b) memset(a,b,sizeof(a))
    #define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
    #define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
    #define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
    #define ce(i,r) i==r?'\n':' '
    #define pb push_back
    #define all(x) x.begin(),x.end()
    #define gmn(a,b) a=min(a,b)
    #define gmx(a,b) a=max(a,b)
    #define fi first
    #define se second
    typedef long long ll;
    typedef unsigned long long ull;
    typedef double db;
    const int infi=1e9;//infi较大，注意涉及inf相加时爆int
    const ll infl=4e18;
    inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
    inline ll pos_mod(ll a,ll b){ return (a%b+b)%b; }
    //std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
}
using namespace Ruri;
namespace Read{
    #define ss(a) scanf("%s",a)
    inline int ri(){ int x; scanf("%d",&x); return x; }
    inline ll rl(){ ll x;  scanf("%lld",&x); return x; }
    inline db rd(){ db x; scanf("%lf",&x); return x; }
}
namespace DeBug{
    #define pr(x) cout<<#x<<": "<<(x)<<endl
    #define pra(x,a,b) cout<<#x<<": "<<endl; \
            repi(i,a,b) cout<<x[i]<<" ";     \
            puts("");
    #define FR(a) freopen(a,"r",stdin)
    #define FO(a) freopen(a,"w",stdout)
}
using namespace Read;
using namespace DeBug;
const int MAX_N=505;
struct node{
	int x,y,z;
	bool operator <(const node &a)const{ return x<a.x; }
};
typedef pair<ll,node> P;
int r,c;
int a[MAX_N][MAX_N],b[MAX_N][MAX_N];
ll dis[MAX_N][MAX_N][2];
void Dijkstra()
{
	repi(i,1,r)repi(j,1,c) dis[i][j][0]=dis[i][j][1]=infl;
	priority_queue<P,vector<P>,greater<P> > q;
	dis[1][1][1]=0,q.push(P(0,node{1,1,1}));
	while(!q.empty())
	{
		P now=q.top(); q.pop();
		int x=now.se.x,y=now.se.y,z=now.se.z;
		if(dis[x][y][z]<now.fi)	continue;
		if(z==0){
			if(!r) continue;
			if(dis[x-1][y][0]>dis[x][y][z]+1)
				dis[x-1][y][0]=dis[x][y][z]+1,q.push(P(dis[x-1][y][0],node{x-1,y,0}));
			if(dis[x-1][y][1]>dis[x][y][z]+1)
				dis[x-1][y][1]=dis[x][y][z]+1,q.push(P(dis[x-1][y][1],node{x-1,y,1}));
		}
		else{
			if(y<c&&dis[x][y+1][z]>dis[x][y][z]+a[x][y])
				dis[x][y+1][z]=dis[x][y][z]+a[x][y],q.push(P(dis[x][y+1][z],node{x,y+1,z}));

			if(y&&dis[x][y-1][z]>dis[x][y][z]+a[x][y-1])
				dis[x][y-1][z]=dis[x][y][z]+a[x][y-1],q.push(P(dis[x][y-1][z],node{x,y-1,z}));

			if(x<r&&dis[x+1][y][z]>dis[x][y][z]+b[x][y])
				dis[x+1][y][z]=dis[x][y][z]+b[x][y],q.push(P(dis[x+1][y][z],node{x+1,y,z}));

			if(r&&dis[x][y][0]>dis[x][y][z]+1)
				dis[x][y][0]=dis[x][y][z]+1,q.push(P(dis[x][y][0],node{x,y,0}));
		}

	}
}
int main()
{
	r=ri(),c=ri();
	repi(i,1,r)repi(j,1,c-1) a[i][j]=ri();
	repi(i,1,r-1)repi(j,1,c) b[i][j]=ri();
	Dijkstra();
	printf("%lld\n",dis[r][c][1]);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pld = pair<ld,ld>;
using vll = vector<ll>;
using vld = vector<ld>;
using vstr = vector<string>;
#define _GLIBCXX_DEBUG
#define rep(j, m) for (ll j = 0; j < (ll)(m); j++)
#define rep2(i, l, n) for (ll i = l; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
const ld PI = 3.1415926535897932;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
vll dx = {-1,0,1,0};
vll dy = {0,-1,0,1};
vll Dx = {-1,-1,-1,0,0,1,1,1};
vll Dy = {-1,0,1,-1,1,-1,0,1};
const ll INF = 1000000000000000;

vll F(400001);
vll G(400001);

ll nCr_mod3(ll n,ll r) {
    if (n == r || r == 0) {return 1;}
    else {
        if (F[n] > F[r] + F[n - r]) {
            return 0;
        }
        else {
            if (G[n] == G[r]*G[n - r]%3) {return 1;}
            else {return 2;}
        }
    }
    return 0;
}
int main() {
    rep(i,400001) {
        if (i == 0) {
            F[i] = 0;G[i] = 0;
        }
        else if (i == 1) {
            F[i] = 0;G[i] = 1;
        }
        else {
            ll f = i;
            F[i] = F[i - 1];
            while(f%3 == 0) {
                f /= 3;
                F[i]++;
            }
            G[i] = G[i - 1]*f%3;
        }
    }
    ll N;
    cin >> N;
    string C;
    cin >> C;
    vll V(N);
    rep(i,N) {
        if (C[i] == 'B') {V[i] = 0;}
        if (C[i] == 'W') {V[i] = 1;}
        if (C[i] == 'R') {V[i] = 2;}
    }
    ll ans = 0;
    rep(i,N) {
        ans += V[i]*nCr_mod3(N - 1,i);
        ans %= 3;
    }
    if (N%2 == 0) {
        if (ans == 0) {cout << "B" << endl;}
        else if (ans == 1) {cout << "R" << endl;}
        else {cout << "W" << endl;}
    }
    else {
        if (ans == 0) {cout << "B" << endl;}
        else if (ans == 1) {cout << "W" << endl;}
        else {cout << "R" << endl;}
    }
}

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

typedef long long ll;
typedef vector<ll>vl1;
typedef vector<vl1> vl2;

typedef vector<double> vd1;
typedef vector<vl1> vl2;

struct struka
{ll val; ll ind;};
typedef vector<struka> vs;

bool compa(struka& a, struka& b)
{ if(a.val==b.val) return a.ind<b.ind;
  return a.val<b.val;
}

void radi()
{ ll i, j, k, kn, m, n, p, t, l, r, x, y, z, a, b, c, d, ost;
  ll val, pos, tmp, suma, maxa, mina, naso, num, dole, gore, sred;
  double dval;
  string str1;
  char ch1;

  cin>>n;
  vd1 dp(n+2);
  dp[n]=0;
  for(i=n-1;i>=0;i--)
   { dval= ((n-i)*1.)/n;
     dp[i]=(1.+dp[i+1]*dval)/dval;}
  cout<<fixed<<setprecision(10);
  cout<<dp[0]-1.;

}

int main()
{ ll t, p;
  t=1;
  for(p=1;p<=t;p++) radi();
  return 0;
}
/*

*/


#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 3005;

// Mod int
const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint operator~() const { return mint(1) / *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint& operator/=(const mint& a){ (x*=a.pow(mod-2).x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  mint operator/(const mint& a)const{ return mint(*this) /= a;}
  mint pow(ll t) const {
    if(!t) return 1;
    mint res = pow(t/2);
    res *= res;
    return (t&1)?res*x:res;
  }
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
mint ex(mint x, ll t) { return x.pow(t);}
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
struct comb {
  vm f, g;
  comb(){}
  comb(int mx):f(mx+1),g(mx+1) {
    f[0] = 1;
    rrep(i,mx) f[i] = f[i-1]*i;
    g[mx] = f[mx].pow(mod-2);
    for(int i=mx;i>0;i--) g[i-1] = g[i]*i;
  }
  mint operator()(int a, int b) {
    if (a < b) return 0;
    return f[a]*g[b]*g[a-b];
  }
};
//

mint dp[MX][MX];

int main() {
  int n,k;
  scanf("%d%d",&n,&k);
  dp[0][0] = 1;
  rep(i,n+1)drep(j,n+1) {
    dp[i+1][j+1] += dp[i][j];
    if (j%2 == 0) dp[i][j/2] += dp[i][j];
  }
  cout<<dp[n][k]<<endl;
  return 0;
}

#include<iostream>
using namespace std;
#define int long long
const int N=1e4;
const int MOD=998244353;
/**
 * 设f[i][j]为用i个数凑出j的方案数
 * 则有：
 *      f[i][j]=f[i-1][j-1]+f[i][2*j]
 *      f[i][j]=0 (j>i)
 *
 */
int f[N][2*N];
int n,m;
signed main(){
    cin>>n>>m;
    f[0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=i;j>=1;j--)
            f[i][j]=(f[i-1][j-1]+f[i][2*j])%MOD;
    cout<<f[n][m]<<endl;
    // system("pause");
}


#include <bits/stdc++.h>
# define rep(i,l,n) for(int i=l,i##_end=n;i<i##_end;++i)
# define rrep(i,n,l) for(int i=((int)(n)-1),i##_end=l;i>=i##_end;--i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    // 1. input
    ll N;
    cin>>N;

    // 2.
    ll ans = 0;
    ans += max(0LL,N - 999);
    ans += max(0LL,N - 999'999);
    ans += max(0LL,N - 999'999'999);
    ans += max(0LL,N - 999'999'999'999);
    ans += max(0LL,N - 999'999'999'999'999);

    // 3. output
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define mp        make_pair
#define pb        push_back
#define ppb       pop_back
#define all(x)    (x).begin(),(x).end()
#define int       long long
#define double    long double

void solve() {

	int n;
	cin >> n;

	int count = 0;

	int i = 0;

	for (i = 1000; i <= n; i *= 1000) {

		count += n - i + 1 ;

	}

	cout << count << "\n";

}

signed main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

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

	while (t-- > 0) {
		solve();
	}

	return 0;
}


/*input
37 450

*/

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define endl "\n"
#define sp " "
#define all(v) v.begin(),v.end()
#define makepr(a,b) make_pair(a, b)
#define loop(i,k,n) for(ll i=k;i<n;i++)
#define rlop(i,n,k) for(ll i=n-1;i>=k;i--)
#define lop(i ,a) for(auto i : a)
#define vecl vector<ll>
#define vecprl vector<pair<ll, ll> > v;
#define mpll map<ll, ll>
#define mpsl map<string, ll>
#define prll pair<ll, ll>
#define setl set<ll>
#define mod(a,b) a%b

typedef long long ll;
typedef long double ld;

int main()
{
	fast;
	int n , m;
	cin >> n>> m;
	float k = n*1.0/100;
	cout<<m*k<<endl;
	return 0;
}

#include <iostream>
using namespace std;

int main(){
   float a,b;
   cin >> a >> b;

   cout << b/100 * a;
   return 0;
}


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

int main()
{
    long long X, Y, A, B;
    cin >> X >> Y >> A >> B;
    long long ans = 0;
    while (X < Y) {
        if (X < Y / (double)A && X < Y - B) {
            if (X * A < X + B) {
                ans++;
                X *= A;
            } else {
                ans += (X * A - X) / B;
                X += (X * A - X) / B * B;
            }
        } else if (X < Y / (double)A) {
            ans++;
            X *= A;
        } else if (X < Y - B) {
            ans += (Y - X - 1) / B;
            X += (Y - X - 1) / B * B;
        } else {
            break;
        }
    }
    cout << ans << endl;
}

/*/ Author: _Math.man /*/

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

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

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

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

	}
    return 0;
}


#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef double d;
typedef long double ld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<d> vd;
typedef vector<ld> vld;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

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

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

int main(){
    float X, Y, Z;
    cin >> X >> Y >> Z;
    float res = Z*Y / X;
    if(res == floor(res)) cout << res - 1 << endl;
    else cout << floor(res) << endl;
}


#include <math.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define max(p, q) ((p) > (q) ? (p) : (q))
#define min(p, q) ((p) < (q) ? (p) : (q))
#define mod
using ll = long long;
using P = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T> >;
const ll INF = 1e18 + 1;
int main()
{
  int n;
  cin >> n;
  VV<ll> c(n, V<ll>(n));
  V<ll> a(n), b(n);
  rep(i, 0, n) rep(k, 0, n)
          cin >>
      c[i][k];
  a[0] = 0;
  b[0] = c[0][0];
  rep(i, 1, n)
  {
    a[i] = c[0][i] - c[0][i - 1] + a[i - 1];
    b[i] = c[i][0] - c[i - 1][0] + b[i - 1];
  }
  int j = 0;
  rep(i, 0, n) rep(k, 1, n)
  {
    if (a[k] - a[k - 1] != c[i][k] - c[i][k - 1])
      j++;
    if (b[k] - b[k - 1] != c[k][i] - c[k - 1][i])
      j++;
  }
  if (j != 0)
    cout << "No" << endl;
  else
  {
    cout << "Yes" << endl;
    ll ma = INF, mb = INF;
    rep(i, 0, n)
    {
      ma = min(ma, a[i]);
      mb = min(mb, b[i]);
    }
    if (ma < 0)
    {
      rep(i, 0, n)
      {
        a[i] += -ma;
        b[i] += ma;
      }
    }
    if (mb < 0)
      rep(i, 0, n)
      {
        b[i] += -mb;
        a[i] += mb;
      }
    rep(i, 0, n) cout << b[i] << " ";
    cout << endl;
    rep(i, 0, n) cout << a[i] << " ";
    cout << endl;
  }

  return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  int n;
  cin >> n;
  vector<vector<int>> c(n, vector<int>(n));
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      cin >> c[i][j];
    }
  }

  int m = INF;
  for(int i = 0; i < n; i++)m = min(m, c[i][0]);
  for(int i = 0; i < n; i++)a[i] = c[i][0] - m;
  for(int i = 0; i < n; i++)b[i] = c[0][i] - a[0];

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(c[i][j] != a[i] + b[j]){
	cout << "No" << endl;
	return 0;
      }
    }
  }

  cout << "Yes" << endl;
  for(int i = 0; i < n; i++)cout << a[i] << " ";
  cout << endl;
  for(int i = 0; i < n; i++)cout << b[i] << " ";
  cout << endl;
  return 0;
}


#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
#include <queue>
//#include <stack>
#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MOD 998244353
//#define MAX 200100
//#define NIL -1
//#define INFTY 1000000000000000000

vector<vector<vector<LD>>> abc(101, vector<vector<LD>>(101, vector<LD>(101, 0)));
vector<vector<vector<bool>>> is_visit(101, vector<vector<bool>>(101, vector<bool>(101, false)));

void bfs(pair<LL, pair<LL, LL>> s){
    queue<pair<LL, pair<LL, LL>>> q;
    q.push(s);
    pair<LL, pair<LL, LL>> u;
    while(!q.empty()){
        u=q.front();
        q.pop();
        LL a=u.first;
        LL b=u.second.first;
        LL c=u.second.second;
        //cout << a << " " << b << " " << c << endl;
        if(a!=0){
            abc[a+1][b][c]+=abc[a][b][c]*a/(a+b+c);
            //cout << a+1 << " " << b << " " << c << endl;
            if(a+1<100 && is_visit[a+1][b][c]==false){
                is_visit[a+1][b][c]=true;
                q.push(make_pair(a+1, make_pair(b,c)));
            }
        }
        if(b!=0){
            abc[a][b+1][c]+=abc[a][b][c]*b/(a+b+c);
            if(b+1<100 && is_visit[a][b+1][c]==false){
                is_visit[a][b+1][c]=true;
                q.push(make_pair(a, make_pair(b+1,c)));
            }
        }
        if(c!=0){
            abc[a][b][c+1]+=abc[a][b][c]*c/(a+b+c);
            //cout << abc[a][b][c] << " " << abc[a][b][c+1] << endl;
            if(c+1<100 && is_visit[a][b][c+1]==false){
                is_visit[a][b][c+1]=true;
                q.push(make_pair(a, make_pair(b,c+1)));
            }
        }
    }
}

int main(){
    LL a;
    LL b;
    LL c;
    cin >> a >> b >> c;
    abc[a][b][c]=1;
    is_visit[a][b][c]=true;
    bfs(make_pair(a, make_pair(b, c)));
    LD ans=0;
    for(LL i=0; i<100; i++){
        for(LL j=0; j<100; j++){
            if(i<b || j<c){
                continue;
            }
            ans+=abc[100][i][j]*(LD)(100+i+j-a-b-c);
        }
    }

    for(LL i=0; i<100; i++){
        for(LL j=0; j<100; j++){
            if(i<a || j<c){
                continue;
            }
            ans+=abc[i][100][j]*(LD)(100+i+j-a-b-c);
        }
    }

    for(LL i=0; i<100; i++){
        for(LL j=0; j<100; j++){
            if(i<a || j<b){
                continue;
            }
            ans+=abc[i][j][100]*(LD)(100+i+j-a-b-c);
        }
    }

    cout << setprecision(12) << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pi 3.14159265358979323846
const ll INF=1e18;
const ll N=2e5+5;
const ll MOD=1e9+7;
using namespace std;
double dp[105][105][105];

ll POWER(ll base,ll expo)
{
    ll ret=1;
    while(expo)
    {
        if(expo&1)ret=ret*base;
        expo>>=1;
        base=base*base;
    }
    return ret;
}
ld fun(ll a,ll b,ll c)
{
    if(a==100 || b==100 || c==100)
        return 0;
    if(dp[a][b][c]!=-1)return dp[a][b][c];
    double tot=a+b+c;
    double ans=1+(a/tot)*fun(a+1,b,c)+(b/tot)*fun(a,b+1,c)+(c/tot)*(fun(a,b,c+1));
    return dp[a][b][c]=ans;
}
int main()
{
    ll test_case=1; //cin>>test_case;
    while(test_case--)
    {
        ll a,b,c;
        for(ll i=0;i<=100;i++){
            for(ll j=0;j<=100;j++){
                for(ll k=0;k<=100;k++)
                    dp[i][j][k]=-1;
            }
        }
        cin>>a>>b>>c;
        double ans=fun(a,b,c);
        cout<<fixed<<setprecision(12)<<ans;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;

#define mod             1000000007
#define what_is(x)      cerr<<#x<<" is "<<x<<"\n";
#define read(x)         freopen("in.txt","r",stdin);
#define write(x)        freopen("out.txt","w",stdout);
#define Fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define sz              3000005

int main(){
    Fast;///using Fast I/O

    vector < ll > v;
    ll a,b,c, i,j,k, t,n,m, x, y;
    cin>>x>>y>>a>>b;

    i=x;
    v.push_back(x);
    while((double)i*a<y){
        v.push_back(i*a);
        i=i*a;
    }

    ll ans=0, exp;
    for(i=0; i<v.size(); i++){
        exp=i+(y-v[i]-1)/b;
        ans=max(ans, exp);
    }

    cout<<ans<<endl;

    return 0;
}

#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

bool check(ll a, ll b, ll c, ll d){
    return a+b == c+d || a-b == c-d || abs(a-c) + abs(b-d) <= 3;
}

int ddx[4] = {3, 0, -3, 0};
int ddy[4] = {0, -3, 0, 3};

int main(){
    ll a, b,c,d;
    cin >>a >>b >> c >> d;
    int ans = 3;
    {
        if((a+b) % 2 == (c + d) % 2)ans = 2;
        for(int dy = -2; dy <= 2; ++dy){
            for(int dx = -2; dx <= 2; ++dx){
                int na = dx+a, nb = dy+b;
                if(check(na, nb, c, d))ans = 2;
            }
        }
        rep(i,4){
            int na = ddx[i] + a, nb = ddy[i] + b;
            if(check(na, nb, c, d))ans = 2;
        }
        //
        for(int dy = -2; dy <= 2; ++dy){
            for(int dx = -2; dx <= 2; ++dx){
                int nc = dx+c, nd = dy+d;
                if(check(a, b, nc, nd))ans = 2;
            }
        }
        rep(i,4){
            int nc = ddx[i] + c, nd = ddy[i] + d;
            if(check(a, b, nc, nd))ans = 2;
        }
    }
    if(check(a, b, c, d))ans = 1;
    if(a == c && b == d)ans = 0;
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
#include <cstdint>
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
const int MOD = 1000000007;
const int mod = 1000000007;
const int MAX = 510000;
const double inf = 900719925474099;
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
vector<vector<int>> ruiseki2d(vector<vector<int>> vec){
    rep(i,vec.size()-1){
        rep(j,vec[0].size()-1){
            vec[i+1][j+1] = vec[i][j+1]+vec[i+1][j]-vec[i][j]+vec[i+1][j+1];
        }
    }
    return vec;
}
vector<int> ruiseki(vector<int> vec){
    rep(i,vec.size()-1){
        vec[i+1] += vec[i];
    }
    return vec;
}
signed main(void){
    int a,b;
    cin >> a >> b;
    bool flag = false;
    for(int i=1;sqrt(b)>=i;i++){
        if(b%i!=0) continue;
        if((i+(b/i))==a){
            flag = true;
        }
    }
    cout << ((flag)?"Yes":"No") << endl;
}

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

int main() {
    int64_t S, P;
    cin >> S >> P;
    for (int64_t N = 1; N * N <= P; N++) {
        if (P % N != 0) {
            continue;
        }

        int64_t M = P / N;
        if (N + M == S) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}


#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <queue>

#define	INF   1010101010LL
#define INFLL 1010101010101010101LL

using namespace std;

int mod = 1000000007;
//int mod = 998244353;

class BIT {
public:
	BIT(int n) : a(n) {}

	void add(int p, long long num)
	{
		while (p < a.size()) {
			a[p] += num;
			p |= p + 1;
		}
	}

	/* i から j までの和 [i, j] */
	long long sum(int i, int j)
	{
		long long s = 0, t = 0;
		i--;
		while (i >= 0) {
			s += a[i];
			i = (i & (i + 1)) - 1;
		}
		while (j >= 0) {
			t += a[j];
			j = (j & (j + 1)) - 1;
		}
		return t - s;
	}

	void print()
	{
		for (int i = 0; i < a.size(); i++) {
			cout << a[i] << endl;
		}
	}

private:
	vector<long long> a;
};

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	vector<long long> b(n), c(n), d(n), e(n);
	BIT bit(n);
	long long t = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = bit.sum(a[i] + 1, n - 1);
		d[i] = n - b[i] - 1;
		t += b[i];
		bit.add(a[i], 1);
	}
	BIT bit1(n);
	for (int i = n - 1; i >= 0; i--) {
		c[i] = bit1.sum(a[i] + 1, n - 1);
		e[i] = n - c[i] - 1;
		bit1.add(a[i], 1);
	}

	for (int i = 0; i < n; i++) {
		cout << t << endl;
		t -= a[i];
		t += n - 1 - a[i];
	}

	return 0;
}

#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#include<cmath>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y,ll z){

    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        ll w=(p*p)%z;
        if(y%2==0)
         return w;
        else
        return (x*w)%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n;
    cin>>n;
    ll a[200]={0},c=0;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        a[x%200]++;
    }
    for(int i=0;i<200;i++)
    {
        c=c+(a[i]*a[i]-a[i])/2;
    }
    cout<<c;}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ford(i,a,b) for(int i=a;i<=b;i++)
#define foru(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,a,b) for(int i=a;i<b;i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define bug(x) cout<<x<<'\n';
#define bit(x,i) ((x>>i)&1ll)

int n,x,kq=0;

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

    cin>>n;

    ford(i,1,n){
        cin>>x;
        if(x>10) kq+=(x-10);
    }

    cout<<kq;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  vector<int> A(n);
  map<int, int> cnt;
  rep(i, n) {
    cin >> A[i];
    cnt[A[i]]++;
  }
  int mn = k;
  ll ans = 0;
  rep(i, n) {
    ans += 1LL * (mn - min(mn, cnt[i])) * i;
    chmin(mn, cnt[i]);
  }
  ans += mn * n;
  cout << ans << endk;
  return 0;
}


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

int n,m;
vector<int> G[20];
bool used[20];
int col[20];
vector<int> vs;

void dfs(int v)
{
    if(used[v])return;
    used[v]=true;
    vs.push_back(v);
    for(int u:G[v])dfs(u);
}

ll now;
void dfs2(int i)
{
    if(i==vs.size()){
        now++;
        return;
    }
    int v = vs[i];
    rep(c,3){
        col[v] = c;
        bool ok = true;
        for(int u:G[v]){
            if(col[u]==c)ok=false;
        }
        if(!ok)continue;
        dfs2(i+1);
    }
    col[v]=-1;
}
int main()
{
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ll ans = 1;
    memset(col,-1,sizeof(col));
    rep(i,n){
        if(used[i])continue;
        ans*=3;
        vs = vector<int>();
        dfs(i);
        col[vs[0]]=0;
        now=0;
        dfs2(1);
        ans*=now;
    }
    cout << ans << endl;
    return 0;
}

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
#define rep(i,n) for(int i=0;i<n;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
const int inf=1e9;
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
using namespace std;
const int N=25;
int n,m;
vi adj[N];
vector<bool>vis(N,false);
vi g,color;
void dfs(int s){
	vis[s]=true;
	for(auto i:adj[s]){
		if(!vis[i])
			dfs(i);
	}
	g.pb(s);
}
int cnt(int idx){
	if(idx==g.size())
		return 1;
	int s=g[idx];
	int res=0;
	for(int c=0;c<3;c++){
		bool ok=true;
		for(auto i:adj[s]){
			if(c==color[i])
				ok=false;
		}
		if(ok){
			color[s]=c;
			res+=cnt(idx+1);
			color[s]=-1;
		}
	}
	return res;
}
int solve()
{
	bool flag=true;
	cin>>n>>m;
	color.resize(n+1,-1);
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	int sum=1LL;
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			g.clear();
			dfs(i);
			reverse(g.begin(),g.end());
			int ans=cnt(0);
			sum*=ans;
		}
	}
	cout<<sum<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}


 //----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef    long long                	 ll;
typedef    long double              	 ld;
typedef    unordered_set<ll>         	 usll;
typedef    unordered_multiset<ll>    	 umsll;
typedef    multiset<ll>              	 msll;
typedef    set<ll>                  	 sll;
typedef    vector<ll>               	 vll;
typedef    pair<ll,ll>              	 pll;
typedef    vector<pll>              	 vpll;
typedef    priority_queue<ll>       	 pqll;
typedef    vector<int>              	 vi;
typedef    set<int>                 	 si;
typedef    multiset<int>            	 msi;
typedef    unordered_multiset<int>  	 umsi;
typedef    unordered_set<int>       	 usi;
typedef    pair<int,int>               	 pi;
typedef    vector<pi>                	 vpi;
typedef    priority_queue<int>       	 pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_si;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_sll;
typedef    tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_msi;
typedef    tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_msll;
#define    in          		insert
#define    fi          		first
#define    se          		second
#define    pb   	    	push_back
#define    mp   	   		make_pair
#define    be   	   		begin
#define    en   	   		end
#define    itr  	   		iterator
#define    io  	       		ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   	   		1000000007
#define    inf  	   		8222372026854775807
#define    ninf   	   		-inf
#define    ima   	   		2047483647
#define    imi   	   		-ima
#define    oncnt       		__builtin_popcount
#define    zerobegin   		__builtin_clz
#define    zeroend    		__builtin_ctz
#define    parity      		__builtin_parity
#define    eps         		1e-9
#define    coutd       		cout<<setprecision(10)<<fixed
#define    mems(dp,x)  		memset(dp,x,sizeof(dp))
#define    fbo         		find_by_order
#define    ook    	   		order_of_key
#define    all(x)      		x.be(),x.en()
#define    upb    	   		upper_bound
#define    lowb  	   		lower_bound
#define    lte(v,x)    		(upb(all(v),x)-v.be())
#define    gte(v,x)    		(v.end()-lowb(all(v),x))
#define    gt(v,x)     		(v.en()-upb(all(v),x))
#define    lt(v,x)     		(lowb(all(v),x)-v.be())
const      ld PI= 			3.1415926535897932384626433832792884197169399375105820974944;
inline ll mpow(ll x,ll n){if(n==0)return 1;if(x==0)return 0;if(n==1)return(x%mo);ll u=(mpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll minv(ll x){return mpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=minv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int main()
{              io
int testcases=1;       //            cin>>testcases;
while(testcases--)
{

ld a,b;
cin>>a>>b;
coutd<<((a-b)/a)*100.00;

}return 0;}

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pl = pair<ll, ll>;
using Vs = vector<string>;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;//10の18乗
#define yn {puts("Yes");}else{puts("No");}
#define dame { puts("-1"); return 0;}

int main() {
    ll n,m,q;
    cin >> n >> m >> q;
    vector<Pl> v(n);
    rep(i,n) cin >> v[i].F >> v[i].S;
    sort(all(v));
    v.PB(MP(inf,inf));
    Vl box(m);
    rep(i,m) cin >> box[i];
    rep(i,q){
        ll ans=0;
        ll l,r;
        cin >> l >> r;
        l--;r--;
        Vl ok;
        rep(j,l) ok.PB(box[j]);
        rrep(j,r+1,m) ok.PB(box[j]);
        sort(all(ok));
        priority_queue<ll> que;
        ll now=0;
        //cout << ok.size() << l << r << endl;
        rep(j,ok.size()){
            while(v[now].F<=ok[j]){
                que.push(v[now].S);
                now++;
            }
            if(!que.empty()){
                ll x=que.top();que.pop();
                ans+=x;
            }
            //cout << ans << endl;
        }
        cout << ans << endl;
    }

}


#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <random>

using namespace std;
using ll = long long;

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n)
    {
        ll tempA;
        ll tempB;
        cin >> tempA >> tempB;
        tempA--;
        tempB--;
        // a<=b となるように並べます→いみない！！！
        if (tempA <= tempB)
        {
            a[i] = tempA;
            b[i] = tempB;
        }
        else
        {
            a[i] = tempB;
            b[i] = tempA;
        }
    }
    ll aMax = 0;
    ll bMax = 0;
    rep(i, n)
    {
        aMax = max(aMax, a[i]);
        bMax = max(bMax, b[i]);
    }
    ll colorKinds = max(aMax, bMax) + 1;

    vector<vector<ll>> targets(colorKinds);
    rep(i, n)
    {
        targets[a[i]].push_back(b[i]);
        targets[b[i]].push_back(a[i]);
    }

    ll result = 0;
    vector<bool> doneColor(colorKinds, false);
    for (ll color = 0; color < colorKinds; color++)
    {
        if (doneColor[color] == true)
        {
        }
        else
        {
            queue<ll> que;
            que.push(color);
            ll islandMembers = 0;
            ll kyohi = 0;
            while (!que.empty())
            {
                ll nowColor = que.front();
                que.pop();
                if (doneColor[nowColor] == false)
                {
                    doneColor[nowColor] = true;
                    islandMembers++;
                    for (ll target : targets[nowColor])
                    {
                        que.push(target);
                    }
                }
                else
                {
                    // その頂点は調査済みだった場合
                    kyohi++;
                }
            }
            if (kyohi == islandMembers - 1)
            {
                // loopなし
                result += islandMembers - 1;
            }
            else
            {
                // loopあり
                result += islandMembers;
            }
        }
    }
    cout << result << endl;
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <iostream>
#include <fstream>
#include <chrono>

using namespace std;

void solve(int test, istream &in) {
    int n; string s;
    in >> n >> s;
    vector<int> a(n + 1);
    int maxa = 0;
    for (int i = 0; i <= n; i++) {
        in >> a[i];
        maxa = std::max(maxa, a[i]);
    }
    int maxk = 1;
    vector<int> b(n + 1), cnt(n + 1);
    for (int k = 2; k <= maxa; k++) {
        for (int i = 0; i <= n; i++) {
            b[i] = a[i] / k;
            cnt[i] = a[i] % k;
        }
        bool good = true;
        for (int i = 0; i < n; i++) {
            int l0 = b[i], l1 = b[i + 1];
            int r0 = b[i], r1 = b[i + 1];
            if (cnt[i] > cnt[i + 1])
                r0++;
            else if (cnt[i] < cnt[i + 1])
                r1++;
            if (s[i] == '>') {
                std::swap(l0, l1);
                std::swap(r0, r1);
            }
            if (l0 >= l1 || r0 >= r1)
                good = false;
        }
        if (good)
            maxk = k;
    }
    for (int i = 0; i <= n; i++) {
        b[i] = a[i] / maxk;
        cnt[i] = a[i] % maxk;
    }
    printf("%d\n", maxk);
    for (int k = 0; k < maxk; k++) {
        for (int i = 0; i <= n; i++) {
            printf("%d ", k < cnt[i] ? b[i] + 1 : b[i]);
        }
        printf("\n");
    }
}

int main(int argc, char* argv[])
{
#ifdef VLAD_LOCAL
	//FILE *f = fopen("in.txt", "r");
    ifstream f("in.txt");
    auto start = std::chrono::steady_clock::now();
#else
	//FILE *f = stdin;
    istream &f = cin;
#endif
    int tests = 1;
    //f >> tests;
    for (int test = 0; test < tests; test++) {
        solve(test, f);
    }
#ifdef VLAD_LOCAL
    auto end = std::chrono::steady_clock::now();
    double seconds = (double)std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / 1000;
    printf("\n%.3lf seconds\n", seconds);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{";
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r;
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {
        double ans = 0;
        int n;
        cin >> n;
        rep(i,1,n) ans += n*1.0/i;
        cout << fixed << setprecision(10) << ans << endl;
    }
}


#pragma GCC optimize("O3")

#include <bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// using cint = cpp_int;

#define fastio \
std::cin.tie(nullptr); \
std::ios::sync_with_stdio(false);

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

#define For(i, m, n)    for(int i = (m); (i) < (n); ++(i))
#define Rep(i, n)       For(i, 0, n)
#define Each(e, con)    for(auto e: con)
#define rEach(e, con)   for(auto &e: con)
#define crEach(e, con)  for(const auto &e: con)

#define All(con)        (con).begin(), (con).end()
#define Unique(con)     std::sort(All(con)); (con).erase(std::unique(All(con)), (con).end())
#define Reverse(con)    std::reverse(All(con))
#define Middle(con)     (con).begin() + ((con).end() - (con).begin()) / 2

template <class Ty1, class Ty2>
std::istream &operator>>(std::istream &is, std::pair<Ty1, Ty2> &arg)
{ is >> arg.first >> arg.second; return is; }
template <class Ty>
std::istream &operator>>(std::istream &is, std::vector<Ty> &arg)
{ rEach(e, arg) is >> e; return is; }
template <class Ty>
std::istream &operator>>(std::istream &is, std::vector<std::vector<Ty>> &arg)
{ rEach(sub, arg) { rEach(e, sub) { is >> e; }} return is; }

template <class Ty1, class Ty2>
std::istream &vecinput(std::vector<Ty1> &arg1, std::vector<Ty2> &arg2)
{ assert(arg1.size() == arg2.size());
auto sz = arg1.size(); Rep(i, (int)sz) std::cin >> arg1[i] >> arg2[i]; return std::cin; }
template <class Ty1, class Ty2, class Ty3>
std::istream &vecinput(std::vector<Ty1> &arg1, std::vector<Ty2> &arg2, std::vector<Ty3> &arg3)
{ assert(arg1.size() == arg2.size()); assert(arg2.size() == arg3.size());
auto sz = arg1.size(); Rep(i, (int)sz) std::cin >> arg1[i] >> arg2[i] >> arg3[i]; return std::cin; }
template <class Ty1, class Ty2, class Ty3, class Ty4>
std::istream &vecinput(std::vector<Ty1> &arg1, std::vector<Ty2> &arg2, std::vector<Ty3> &arg3, std::vector<Ty4> &arg4)
{ assert(arg1.size() == arg2.size()); assert(arg2.size() == arg3.size()); assert(arg3.size() == arg4.size());
auto sz = arg1.size(); Rep(i, (int)sz) std::cin >> arg1[i] >> arg2[i] >> arg3[i] >> arg4[i]; return std::cin; }

int main() {
fastio

    int r, x, y;
    cin >> r >> x >> y;

    double dist = hypot(x, y);

    int ans = 0;
    while(dist > 2 * r) {
        dist -= r;
        ++ans;
    }

    if(abs(dist - r) < 1e-9) cout << ans + 1 << endl;
    else cout << ans + 2 << endl;

    return 0;
}

#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
int main(){
	ll n,a,b,c;
	scanf("%lld%lld%lld",&n,&a,&b);
	c=(ll)(sqrt(a*a+b*b));
	if(c*c==a*a+b*b){
		if(c==n)puts("1");
		else if(c==0)puts("0");
		else printf("%lld\n",max(2LL,(c+n-1)/n));
		return 0;
	}
	++c;
	printf("%lld\n",max(2LL,(c+n-1)/n));
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main(void) {
	int N;
	cin >> N;
	int A[N], B[N], C[N];
	for(int i = 0; i < N; i++) cin >> A[i];
	for(int i = 0; i < N; i++) cin >> B[i];
	for(int i = 0; i < N; i++) {
		cin >> C[i];
		C[i]--;
	}

	int cnt[100010];
	for(int i = 0; i < 100010; i++) cnt[i] = 0;
	for(int i = 0; i < N; i++) cnt[A[i]]++;

	ll ans = 0;
	for(int i = 0; i < N; i++) {
		ans += cnt[B[C[i]]];
	}

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

#include <bits/stdc++.h>
using namespace std;
#define fora(i, x, n) for(int i=(x); i<(n) ; ++i)
#define trav(a, A) for(auto& a : A)
#define endl '\n'
#define ford(i, x) for(int i=(x); i>=0 ; --i)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define INF ((long long int) ((unsigned long long int)~0>>1))

using li = long long int;
using vi = vector<int>;

unordered_map<int,int> freq_colors;
vi color;
vector<vi> tree;
vi good_vertex;

void dfs(int u, int parent = 0){

	freq_colors[color[u]]++;
	if ( freq_colors[color[u]] == 1 ){
		good_vertex.pb(u);
	}
	for(auto v : tree[u]){
		if (v == parent)	continue;

		dfs(v, u);
	}
	freq_colors[color[u]]--;
}

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

	color.resize(n);
	tree.resize(n);

	for(auto& c : color){
		cin >> c;
	}
	int a, b;
	fora(i, 0, n-1){
		cin >> a >> b; a--; b--;
		tree[a].pb(b);
		tree[b].pb(a);
	}

	dfs(0, 0);
	sort(all(good_vertex));

	for(auto& v : good_vertex){
		cout << v+1 << endl;
	}
}

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


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef string str;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define pb(x)                       push_back(x)
#define pf(x)                       push_front(x)
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MAXN = 1e3 + 10;
const ll INF = 1e18;
const ll LOG = 20;
const ll MOD = 1e9 + 7;

ll poww(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
    	if (b & 1) ans = ans * a % md;
    return ans;
}

ll fib[MAXN] , c[4];

int main(){

    fast_io;
    fib[1] = fib[2] = 1;
	for (int i = 3; i < MAXN; i++){
		fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
	}
	ll n;
	cin >> n;
	for (int i = 0; i < 4; ++ i){
		char ch;
		cin >> ch;
		c[i] = ch - 'A';
	}
	if (n < 4){
        cout << 1;
        return 0;
	}
	if (!c[1]){
		if (!c[0]){
            cout << 1;
            return 0;
		}
		if (!c[2]){
            cout << fib[n - 1];
            return 0;
		}
		cout << poww(2, n - 3, MOD);
		return 0;
	}
    if (c[3]){
        cout << 1;
        return 0;
    }
	if (c[2]){
        cout << fib[n - 1];
        return 0;
	}
	cout << poww(2, n - 3, MOD);

}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXM = 1e4 + 5;
#define pb push_back
#define eb emplace_back
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define LINF 9223372036854775807
#define LMIN -9223372036854775807
#define mp make_pair
#define tiii tuple<int, int, int>
#define tlll tuple<ll, ll, ll>
#define mid(s, e) (s + (e - s) / 2)
#define F first
#define z endl
#define S second
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)            // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)           // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n)-1; i >= 0; --i)        // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)          // reverse 1 based
#define all(x) (x).begin(), (x).end()                            //Forward traversal
#define rall(x) (x).rbegin, (x).rend()                           //reverse traversal
// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define pll pair<long long, long long>
#define present(c, x) ((c).find(x) != (c).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, pair<int, int>> ppi;
typedef double ld;
//std::rotate(vec1.begin(), vec1.begin()+rotL, vec1.end())    Rotate vector left rotL times.  in Theta(n)
//  std::rotate(vec2.begin(), vec2.begin()+vec2.size()-rotR, vec2.end());     Rotate vector Right rotR times. int Theta(n)

class compare
{
public:
    bool operator()(const pair<int, int> &a, const pair<int, int> &b)
    {
        if (a.first == b.first)
            return a.second > b.second;
        return a.first < b.first;
    }
};
bool isprime(int n)
{
    if (n == 1)
        return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int gcd(int a, int b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}
int countDigits(int n)
{
    return floor(log10(n) + 1);
}
int main()
{
    // auto start = chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    if (n == 1)
        cout << 1 << endl;
    else
    {
        int count = 1;
        int x = 0;
        while (x < n)
        {
            x += count;
            count++;
        }
        cout << count - 1 << endl;
    }
    // auto end = chrono::high_resolution_clock::now();
    // double time_taken =
    //     chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    // time_taken *= 1e-9;
    // cout << "Time taken by program is : " << fixed
    //      << time_taken << setprecision(9);
    // cout << " sec" << endl;
    return 0;
}


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

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

int main(){
    readFile();
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, x;
    cin >> n >> x;
    vector<ll> ans;
    for(ll i = 0 ; i < n ; ++i){
        ll val;
        cin >> val;
        if(val != x) ans.push_back(val);
    }
    for(ll i : ans) cout << i << ' ';
    cout << '\n';
}

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

int main() {
	int h,w;
	std::cin >> h >> w;
	int n=h*w;
	V<int> a(n);
	fill(a);
	int min=a[0];
	rep(i,n) min=std::min(min,a[i]);
	lnt ans=0;
	rep(i,n) ans+=a[i]-min;
	print(ans);
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <map>
#include <set>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;

using ll = long long;

vector<ll> A;

ll calc(ll N, ll sep)
{
    ll ret = 0;
    //vector<ll> v;
    ll OR = 0;
    bool f = false;
    for(ll i = 0;i < N;i++)
    {
        OR |= A[i];
        f = true;
        if(sep & (1LL<<i))
        {
            ret ^= OR;
            OR = 0LL;
            f = false;
        }
    }
    if(f)
    {
        ret ^= OR;
    }
    return ret;
}

int main()
{
    ll N;
    cin >> N;
    A.resize(N);
    for(ll i = 0;i < N;i++)
    {
        cin >> A[i];
    }

    ll sep;
    ll lim = 1<<(N-1LL);
    ll ans = 1e15;
    for(sep=0;sep<lim;sep++)
    {
        ll ret = calc(N, sep);
        //cout << "ret = " << ret << " sep = " << sep << endl;
        ans = min(ans, ret);
    }
    cout << ans << endl;
    return 0;
}

// Problem: B - Mex Boxes
// Contest: AtCoder - KEYENCE Programming Contest 2021
// URL: https://atcoder.jp/contests/keyence2021/tasks/keyence2021_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

// Problem: A - Two Sequences 2
// Contest: AtCoder - KEYENCE Programming Contest 2021
// URL: https://atcoder.jp/contests/keyence2021/tasks/keyence2021_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define int long long
using namespace std;
#ifndef use_ios11
#define use_ios11
using namespace std;
struct ins{
    int ans;
    ins(){ans=1;}
#define endl '\n'
    void read(){}
    void read1(char &s){
        char c=getchar();
        for(;!isprint(c)||c==' '||c=='\n'||c=='\t';c=getchar());
        s=c;
        if(c==EOF)ans=0;
    }
    void read1(string &s){
        s="";
        char c=getchar();
        for(;!isprint(c)||c==' '||c=='\n'||c=='\t';c=getchar());
        for (;isprint(c)&&c!=' '&&c!='\n'&&c!='\t';c=getchar())s+=c;
        if(c==EOF)ans=0;
    }
    template<typename T>void read1(T &n){
        T x=0;int f=1;char c=getchar();
        for(;!isdigit(c);c=getchar()){
            if(c=='-')f=-1;
            if(c==EOF){ans=0;return;}
        }
        for(;isdigit(c);c=getchar())x=x*10+c-48;
        n=x*f;
        if(c==EOF)ans=0;
        if(c!='.')return;
        T l=0.1;
        while((c=getchar())<='9'&&c>='0')x=x+(c&15)*l,l*=0.1;
        n=x*f;
        if(c==EOF)ans=0;
    }
    void write(){}
    void write1(string s){
        int n=s.size();
        for(int i=0;i<n;i++)putchar(s[i]);
    }
    void write1(const char *s){
        int n=strlen(s);
        for(int i=0;i<n;i++)putchar(s[i]);
    }
    void write1(char s){putchar(s);}
    void write1(float s,int x=6){
        char y[10001];
        sprintf(y,"%%.%df",x);
        printf(y,s);
    }
    void write1(double s,int x=6){
        char y[10001];
        sprintf(y,"%%.%dlf",x);
        printf(y,s);
    }
    void write1(long double s,int x=6){
        char y[10001];
        sprintf(y,"%%.%dLf",x);
        printf(y,s);
    }
    template<typename T>void write1(T n){
        if(n<0)n=-n,putchar('-');
        if (n>9)write1(n/10);
        putchar('0'+n%10);
    }
    template<typename T>friend ins operator>>(ins x,T &n);
    template<typename T>friend ins operator<<(ins x,T n);
    operator bool(){return ans;}
};
template<typename T>ins operator>>(ins x,T &n){
    if(!x.ans)return x;
    x.read1(n);return x;
}
template<typename T>ins operator<<(ins x,T n){
    x.write1(n);
    return x;
}
ins yin;
ins yout;
#endif
int ans,h[300010];
signed main(){
	int n,k;yin>>n>>k;
	for(int i=1;i<=n;i++){
		int x;yin>>x;
		if(x<=n)h[x]++;
	}
	int s=k;
	for(int i=0;i<=n+1;i++){
		if(h[i]<s)ans+=(s-h[i])*i,s=h[i];
		// cout<<ans<<endl;
	}yout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[10005],b[10005],ans=12345678;
int main()
{
	cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[i]>>b[i];
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
            if (i==j)
                ans=min(ans,a[i]+b[i]);
            else
                ans=min(ans,max(a[i],b[j]));
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define pb push_back
#define endl '\n'
#define sa(x) sort((x).begin(), (x).end());
#define int long long

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T> static inline void sd(vector<T> &x) {sort((x).begin(), (x).end(), greater<T>()) ; }

void solve(){
	int n;
	cin>>n;
	vector<int> v[2];
	v[0].resize(n);
	v[1].resize(n);

	int a=LLONG_MAX, b=LLONG_MAX;
	rep(i,0,n){
		cin>>v[0][i]>>v[1][i];
		amin(a, v[1][i]+v[0][i]);
		rep(j,0,i){
			amin(a, min(max(v[0][i], v[1][j]), max(v[1][i], v[0][j])));
		}
	}

	cout<<a;
}

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int testcases=1;
	//cin>>testcases;
	while(testcases--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

struct edge{
    ll to;
    ll c;
};

vector<edge> g[210000];
VI sum(210000,0);
ll s=0;

void dfs(int v, int p){
    sum[v]=s;
    for(auto i:g[v]){
        if(i.to!=p){
            s^=i.c;
            dfs(i.to,v);
            s^=i.c;
        }
    }
}

int main(){
    int n; cin >> n;
    ll a, b, c;
    REP(i,n-1){
        cin >> a >> b >> c;
        a--, b--;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }
    dfs(0,-1);
    VI cnt(60,0);
    REP(i,n){
        ll x=sum[i];
        REP(j,60){
            if(x&1)
                cnt[j]++;
            x>>=1;
        }
    }
    ll ans=0;
    ll p=1;
    REP(i,60){
        ans+=cnt[i]*(n-cnt[i])%MOD*p%MOD;
        ans%=MOD;
        p=p*2%MOD;
    }
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<pair<int, long long int>>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int u, v;
    long long int w;
    cin >> u >> v >> w;
    u--;
    v--;
    pair<int, long long int> p = make_pair(v, w), q = make_pair(u, w);
    G.at(u).push_back(p);
    G.at(v).push_back(q);
  }
  vector<long long int> dist(N, -1);
  queue<int> que;
  que.push(0);
  dist.at(0) = 0;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int i = 0; i < G.at(u).size(); i++) {
      int v = G.at(u).at(i).first;
      if (dist.at(v) >= 0) continue;
      long long int w = G.at(u).at(i).second;
      dist.at(v) = dist.at(u) ^ w;
      que.push(v);
    }
  }
  long long int ans = 0, MOD = 1000000007;
  for (int k = 0; k < 60; k++) {
    vector<long long int> cnt(2, 0);
    for (int i = 0; i < N; i++) cnt.at((dist.at(i) >> k) & 1)++;
    ans += ((long long int)1 << k) % MOD * cnt.at(0) % MOD * cnt.at(1) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,bl[55][55],val[55][55],di[]={0,0,-1,1},dj[]={1,-1,0,0},nn,mm;
bool vis[2505],p;
int main()
{
    //freopen("in.txt","r",stdin);
    p=true;
    scanf("%d %d",&n,&m);
    for(int i=0;i<50;i++)
    {
        for(int j=0;j<50;j++)
        {
            scanf("%d",&bl[i][j]);
        }
    }
    for(int i=0;i<50;i++)
    {
        for(int j=0;j<50;j++)
        {
            scanf("%d",&val[i][j]);
        }
    }
    while(1)
    {
        vis[bl[n][m]]=true;
        p=false;
        for(int i=0;i<4;i++)
        {
            nn=n+di[i];
            mm=m+dj[i];
            if(nn<0||mm<0||nn>=50||mm>=50)continue;
            if(!vis[bl[nn][mm]])
            {
                if(i==0)printf("R");
                else if(i==1)printf("L");
                else if(i==2)printf("U");
                else printf("D");
                p=true;
                n=nn;
                m=mm;
                //printf(" %d %d\n",n,m);
                break;
            }
        }
        if(!p)break;
    }
}

#include <bits/stdc++.h>

clock_t start;

constexpr int H = 50, W = 50;
int si, sj;
int t[H][W], p[H][W];

struct cand {
    std::string s;
    int score, i, j;
    std::vector<bool> seen;
    bool operator<(const cand& rhs) const { return score < rhs.score; }
    bool valid(const char& c) {
        if (c == 'L') return (0 < j && !seen[t[i][j - 1]]);
        if (c == 'R') return (j < W - 1 && !seen[t[i][j + 1]]);
        if (c == 'U') return (0 < i && !seen[t[i - 1][j]]);
        if (c == 'D') return (i < H - 1 && !seen[t[i + 1][j]]);
    }
    cand move(const char& c) {
        cand ret = *this;
        ret.s.push_back(c);
        if (c == 'L') ret.j--;
        else if (c == 'R') ret.j++;
        else if (c == 'U') ret.i--;
        else ret.i++;
        ret.score += p[ret.i][ret.j];
        ret.seen[t[ret.i][ret.j]] = true;
        return ret;
    }
};

int main() {
    start = clock();

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

    std::cin >> si >> sj;
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) std::cin >> t[i][j];
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) std::cin >> p[i][j];

    constexpr int N = 1000;
    int n = 1;
    std::vector<bool> seen(H * W, false);
    seen[t[si][sj]] = true;
    cand ans = {"", p[si][sj], si, sj, seen};
    std::vector<cand> c(N, ans);
    while (clock() - start <= 1.95 * CLOCKS_PER_SEC) {
        std::vector<cand> v;
        for (int i = 0; i < n; i++) {
            ans = std::max(ans, c[i]);
            if (c[i].valid('L')) v.push_back(c[i].move('L'));
            if (c[i].valid('R')) v.push_back(c[i].move('R'));
            if (c[i].valid('U')) v.push_back(c[i].move('U'));
            if (c[i].valid('D')) v.push_back(c[i].move('D'));
        }
        sort(v.begin(), v.end());
        n = std::min(N, (int)v.size());
        int m = n / 2;
        for (int i = 0; i < m; i++) c[i] = v[(int)v.size() - 1 - i];
        if (n == m) continue;
        int skip = ((int)v.size() - m) / (n - m);
        for (int i = 0; i < n - m; i++) c[i + m] = v[i * skip];
    }
    std::cout << std::max(ans, c[0]).s << '\n';
}


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

const int mod=998244353;

int main() {
  long long a,b,c;
  cin>>a>>b>>c;
  long long ans=(((a*(a+1)/2%mod) * (b*(b+1)/2%mod)%mod) * (c*(c+1)/2%mod))%mod;
  cout<<ans<<endl;
}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define  fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define tiii tuple<int, int, int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ret return
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define ford(container, it) for(auto it = container.begin(); it != container.end(); it++)
#define fors(container, it, a, b) for(auto it = a; it != b; it++)
#define ff first
#define all(v) v.begin(),v.end()
#define ss second
#define rep(i,n) for(i=0;i<n;i++)
#define fu(i,a,n) for(i=a;i<=n;i++)
#define fd(i,n,a) for(i=n;i>=a;i--)
#define gi(n) scanf(%d,&n)
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int arr[]={0,6,5,4,3,2,1};
    int sum=arr[a]+arr[b]+arr[c];
    cout<<sum<<endl;
}


#include <bits/stdc++.h>

using namespace std;

#define endl "\n"

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

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

   cout<<(2*a+100)-b;

     return 0;
}

#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define  ff      first
#define  ss      second
#define  pb      push_back
#define  ll      long long
#define  MX      100005
#define  inf     INT_MAX
#define  mod     1000000007
#define  endl    "\n"

#define  W(t)            while(t--)
#define  gcd(a,b)        __gcd(a,b)
#define  lcm(a,b)        (a*b)/gcd(a,b)
#define  all(v)          v.begin(),v.end()
#define  clr(a,x)        memset(a,x,sizeof(a))
#define  rep(i,a,b)      for(i = a; i <= b; i++)
#define  irep(i,b,a)     for(i = b; i >= a; i--)
#define  IOS             ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,
    rb_tree_tag, tree_order_statistics_node_update>;

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

   IOS
   ll a,b; cin >> a>>b;
   cout << 2*a+100 - b<<endl;
}