// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

namespace { namespace unolight {
// Read Input
template<class T> void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( int64_t &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }
void R() {}
template<class T, class... U> void R( T& head, U&... tail ) { _R(head); R(tail...); }
// Write Output
template<class T> void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
void _W( const int64_t &x ) { printf("%" PRId64,x); }
void _W( const double &x ) { printf("%.16f",x); }
void _W( const char &x ) { putchar(x); }
void _W( const char *x ) { printf("%s",x); }
template<class T> void _W( const vector<T> &x ) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); }

#ifdef UNOLIGHT
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}
// }}}

void main() {
    int n;
    R(n);
    W((n-1)/100+1);
}

 // {{{ main
}}
int main() { unolight::main(); return 0; }
// }}}

#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <set>
#include <bitset>
#include <iterator>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define len(v) (int) v.size()
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define gauss(n) ((n) * ((n) + 1)) / 2

#ifdef LOCAL
#include "debugger.h"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;

int main() {

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

	int N; cin >> N;
	int c = 1;
	for(int i = 1; i <= 3000;i += 100,++c) {
		int j = i + 99;
		if(N >= i && N <= j) {
			cout << c << endl;
			break;
		}
	}

	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vector<T>>;

bool debugflag = true;

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

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

void debug(){
	cout << endl;
}

template<class Head, class... Tail>
void debug(Head&& head, Tail&&... tail) {
	if (!debugflag) return;
	cout << head << " ";
	debug(forward<Tail>(tail)...);
}

int main() {
	ll K, N, M; cin >> K >> N >> M;
	vec<ll> A(K); cin >> A;

	vec<ll> B(K, 0); ll m = 0;
	vec<double> b(K, 0);
	vec<pair<ll, ll>> diff;
	for (int i = 0; i < K; ++i) {
		B[i] = (ll)((double)A[i] / N * M);
		b[i] = (double)A[i] / N * M;
		m += B[i];
		diff.emplace_back(B[i] * N - A[i] * M, i);
	}
	sort(diff.begin(), diff.end());
	for (int i = 0; i < M - m; ++i) ++B[(int)diff[i].second];

	cout << B << endl;
}

/*
    Author: Zhikun Wang
    Date: 2021/05/29
*/

#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>string to_string(pair<A, B> p);template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p);template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p);string to_string(const string& s) {  return '"' + s + '"';}string to_string(const char* s) {  return to_string((string) s);}string to_string(bool b) {  return (b ? "true" : "false");}string to_string(vector<bool> v) {  bool first = true;  string res = "{";  for (int i = 0; i < static_cast<int>(v.size()); i++) {    if (!first) {      res += ", ";    }    first = false;    res += to_string(v[i]);  }  res += "}";  return res;}template <size_t N>string to_string(bitset<N> v) {  string res = "";  for (size_t i = 0; i < N; i++) {    res += static_cast<char>('0' + v[i]);  }  return res;}template <typename A>string to_string(A v) {  bool first = true;  string res = "{";  for (const auto &x : v) {    if (!first) {      res += ", ";    }    first = false;    res += to_string(x);  }  res += "}";  return res;}template <typename A, typename B>string to_string(pair<A, B> p) {  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p) {  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p) {  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}void debug_out() { cerr << endl; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {  cerr << " " << to_string(H);  debug_out(T...);}

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

#define set0(x) memset(x,0,sizeof(x))
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

template<typename T> void read(T &x){
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
template<typename T, typename... Args> void read(T &first, Args& ... args) {
    read(first);
    read(args...);
}

int T;

int n,p[555];
int c = n-1;
vi ans;
bool sorted(){
    int ans = 1;
    for(int i=1;i<=n;i++)if(p[i]!=i)ans= 0;
    return ans;
}
void solve(){
    read(n);
    for(int i=1;i<=n;i++)read(p[i]);
    int cc = 1;
    for(int i=1;i<=n-3;i++){
        while(p[i]!=i){
            int cp = 0;
            for(int j = i;j<=n;j++){
                if(p[j] == i) cp = j;
            }
            if((cp-1)%2 == cc%2){
                swap(p[cp-1],p[cp]);
                ans.PB(cp-1);
            }else{
                int c = n-1;
                while(c%2!=cc%2)c-=1;
                swap(p[c],p[c+1]);
                ans.PB(c);
            }
            cc+=1;
        }
    }
    while(!sorted()){
        int c = n-1;
        while(c%2!=cc%2)c-=1;
        swap(p[c],p[c+1]);
        ans.PB(c);
        cc+=1;
    }
    cout<<ans.size()<<"\n";
    for(auto ct:ans)cout<<ct<<' ';
    cout<<"\n";
    ans.clear();
}

int main(){
    read(T);
    while(T--){
        solve();
    }
    return 0;
}


#include <cstdio>
#define abs(x) ((x) < 0 ? -(x) : (x))
int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (c & 1) {
        if (a == b) puts("=");
        else if (a < b) puts("<");
        else puts(">");
    }
    else {
        a = abs(a), b = abs(b);
        if (a == b) puts("=");
        else if (a > b) puts(">");
        else puts("<");
    }
    return 0;
}

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

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

    string s; cin>>s;
    int n = s.size();

    bool ok = 1;
    for(int i = 0; i<n; i++){
        if(i&1 && s[i]>='a' && s[i]<='z') ok = 0;
        else if(i&1^1 && s[i]>='A' && s[i]<='Z') ok = 0;
    }

    cout<<(ok?"Yes\n":"No\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
double PI=acos(-1.0);
#define ll long long
#define ull unsigned long long
#define pii pair<ll,ll>
const ll mod=3;
ll nn;
ll fac[mod+105],inv[mod+105];
void getInv()
{
    fac[0]=fac[1]=inv[1]=1;
    for(int i=2;i<mod;i++)
    {
        fac[i]=fac[i-1]*i%mod;
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    }
}
ll C(ll n,ll m)
{
    if(m>n) return 0;
    return fac[n]*inv[fac[m]*fac[n-m]%mod]%mod;
}
ll Lucas(ll n,ll m)
{
    if(m>n) return 0;
    if(n<mod && m<mod)return C(n,m);
    return Lucas(n/mod,m/mod)*C(n%mod,m%mod)%mod;
}
map<char,ll>m;
int main()
{
    ios::sync_with_stdio(0);
    getInv();
    m['B']=0;
    m['W']=1;
    m['R']=2;
    ll n;
    cin>>n;
    ll ans=0;
    for(int i=0;i<n;i++)
    {
        char op;
        cin>>op;
        ll d=m[op];
        ans=(ans+d*Lucas(n-1,i))%mod;
    }
    if(n%2==0)
        ans=(3-ans)%3;
    if(ans==0)
    {
        cout<<"B"<<endl;
    }
    else if(ans==1)
    {
        cout<<"W"<<endl;
    }
    else if(ans==2)
    {
        cout<<"R"<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

int lower_three(int x){
  int a=1;
  while(3*a<x){
    a*=3;
  }
  return a;
}

char change(char x,char y){
  char list[3]={'R','W','B'};
  if(x==y)return x;
  else{
    fr(i,3){
      if(x!=list[i]&&y!=list[i]) return list[i];
    }
  }
}

int main() {
    int n;
	cin >> n;
    string c;
    cin >> c;
    int a;
    while(n>1){
      a=lower_three(n-1);
      fr(i,n-a){
        c[i]=change(c[i],c[i+a]);
      }
      n-=a;
    }
    cout << c[0] << endl;
}


#include <bits/stdc++.h>

#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i,m,n) for(int i=m; i<(int)(n); i++)
#define forn2(i, n) for(int i=0; i<=(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define in(x) int (x); input((x));
#define x first
#define y second
#define less(a,b) ((a) < (b) - EPS)
#define more(a,b) ((a) > (b) + EPS)
#define eq(a,b) (fabs((a) - (b)) < EPS)
#define remax(a, b) ((a) = (b) > (a) ? (b) : (a))
#define remin(a, b) ((a) = (b) < (a) ? (b) : (a))
#define salfinal(x) cout<<x<<endl;
using namespace std;
const int MAX =1e5+1;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    /*
	freopen("s.txt","r",stdin);
	freopen("sa.txt","w",stdout);
    */
    int v,s,t,d;
    cin>>v>>t>>s>>d;
    if(d<v*t || d>v*s)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

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

int main() {

int V, T, S, D;
cin >> V >> T >> S >> D;

if(D < V*T || V*S < D){cout << "Yes" << endl;}
else{cout << "No" << endl;}

}


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

using namespace __gnu_pbds;
using namespace std;

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

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

#define mp make_pair

int p =  1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, ll deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

mt19937 rnd(time(0));

/*
const int N = 1e6 + 5;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

/*struct DSU
{
    vector<int> sz;
    vector<int> parent;
    vector<int> value;
    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
        value[v] = 0;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        else
        {
            auto par = find_set(parent[v]);
            value[v]^=value[parent[v]];
            parent[v] = par;
            return par;
        }
    }

    void union_sets(int a, int b, int w) {
        find_set(a);
        find_set(b);

        w^=value[a]; w^=value[b];
        a = find_set(a);
        b = find_set(b);

        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            value[b] = w;
            sz[a] += sz[b];
        }
    }

    int val(int v)
    {
        find_set(v); return value[v];
    }

    DSU (int n)
    {
        parent.resize(n);
        sz.resize(n);
        value.resize(n);
        for (int i = 0; i<n; i++) make_set(i);
    }
};*/

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

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

    p = 4;
    b = po(b, c); if (b==0) b = 4;
    p = 10;
    cout<<po(a, b);

}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll mod_pow(ll base, ll exp, ll modulus) {
    base %= modulus;
    ll result = 1;
    while (exp > 0) {
        if (exp & 1) result = (result * base) % modulus;
        base = (base * base) % modulus;
        exp >>= 1;
    }
    return result;
}

void solve(long long A, long long B, long long C) {
    cout << mod_pow(A, mod_pow(B, C, 4) + 4, 10) << endl;
}

int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    solve(A, B, C);
    return 0;
}


#line 1 "/workspaces/compro/lib/template.hpp"

#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}

#line 2 "main.cpp"

long long solve(int N, int M, const std::vector<int> &A, const std::vector<int> &B) {
  int ans = 0;
  vector<vi> g(N);
  REP(i, M) { g[A[i]].push_back(B[i]); }

  auto f = [&](auto self, int cur, vector<bool> &visited) -> void {
    visited[cur] = true;
    for (const auto v : g[cur]) {
      if (!visited[v]) {
        ans++;
        self(self, v, visited);
      }
    }
  };
  REP(i, N) {
    vector<bool> visited(N, false);
    f(f, i, visited);
  }
  return ans + N;
}

// generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator)
int main() {
  int N, M;
  std::cin >> N >> M;
  std::vector<int> A(M), B(M);
  for (int i = 0; i < M; ++i) {
    std::cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }
  auto ans = solve(N, M, A, B);
  std::cout << ans << std::endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
const int mod=1e9+7;
const int mxx=1e5+10;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ff first
#define ss second
vector<int> adj[2222];
bool vis[2222];
int cnt;

void dfs(int u){
	vis[u]=1;
	for(auto v:adj[u]){
		if(!vis[v]){
			cnt++;
			dfs(v);
		}
	}
}

int main(){
	IOS;
	ll t=1,i;
	while(t--){
		int n,m;
		cin>>n>>m;

		for(i=0;i<m;i++){
			int u,v;
			cin>>u>>v;
			adj[u].push_back(v);
		}

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

		cout<<ans;
	}
}


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

vector< pair< long long, long long > > prime_factorize(long long N) {
    vector< pair< long long, long long > > res;
    for(long long a = 2; a * a <= N; ++a) {
        if(N % a != 0)
            continue;
        long long ex = 0;
        while(N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if(N != 1)
        res.push_back({N, 1});
    return res;
}

int main() {
    unsigned long long N;
    cin >> N;
    int res = 2;
    N /= (N & -N);
    for(const auto &p : prime_factorize(N)) {
        res *= (p.second + 1);
    }

    cout << res << endl;
}

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define REP(i,k,n) for(ll i=k;i<ll(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define UNIQUE(a) sort(all(a));a.erase(unique(all(a)),a.end())
#define decimal cout<<fixed<<setprecision(10)
using ll=long long;
using P=pair<ll,ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
constexpr ll inf=1001001001001001;
constexpr int INF=1001001001;
constexpr int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
void YesNo(bool b){if(b)out("Yes");else out("No");}
void yesno(bool b){if(b)out("yes");else out("no");}
void YESNO(bool b){if(b)out("YES");else out("NO");}
ll modpow(ll a,ll b){ll c=1;while(b>0){if(b&1){c=a*c%mod;}a=a*a%mod;b>>=1;}return c;}
vi calc(ll x){vi v;while(x>0){v.eb(x%10);x/=10;}reverse(all(v));return v;}

struct UnionFind{
  vi d;
  UnionFind(ll n=0):d(n,-1){}
  ll find(ll x){
    if(d[x]<0) return x;
    return d[x]=find(d[x]);
  }
  bool unite(ll x,ll y){
    x=find(x); y=find(y);
    if(x==y) return false;
    if(d[x]>d[y]) swap(x,y);
    d[x]+=d[y];
    d[y]=x;
    return true;
  }
  bool same(ll x,ll y){return find(x)==find(y);}
  ll size(ll x){return -d[find(x)];}
};

int main(){
    ll n; cin>>n;
    vi a(n);
    rep(i,n) cin>>a[i];
    ll m=200005;
    UnionFind uf(m);
    rep(i,n){
        uf.unite(a[i]-1,a[n-i-1]-1);
    }
    vi v(m,0);
    rep(i,m){
        v[uf.find(i)]=uf.size(i);
    }
    ll ans=0;
    rep(i,m){
        if(v[i]>0) ans+=v[i]-1;
    }
    out(ans);
    //outv(v);
}


//#include <atcoder/maxflow.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#include <iostream>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <iterator>
#include <random>
#include <chrono>
#include <complex>
#include <bitset>
#include <fstream>

#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

//using namespace __gnu_pbds;
//using namespace atcoder;
using namespace std;

const ll modd = (1000LL * 1000LL * 1000LL + 7LL);
//const ll modd = 998244353;

template<class T>
T fastpower(T x, ll pw, T id = 1) {
    T w = x, res = id;
    while (pw>0) {
        if (pw&1) {
            res = (res * w) % modd;
        }
        pw >>= 1;
        w = (w * w) % modd;
    }
    return res;
}

int main(int argc, char *argv[])   {

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no

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

    cout.precision(12);

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readll(n);
        readll(p);

        cout << ((p-1)*fastpower(p-2,n-1)) % modd << endl;

    }

    return 0;
}

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

long long power(long long b,long long e){
    /*
    Copyright (c) 2021 0214sh7
    https://github.com/0214sh7/library/
    */
    long long r=1;
    while(e){
        if(e&1){
            r=(r*b)%MOD;
        }
        b=(b*b)%MOD;
        e >>=1;
    }
    return r;
}

int main(void){

    ll N,P;
    cin >> N >> P;

    ll Ans = power(P-2,N-1);
    Ans = (Ans*(P-1))%MOD;
    cout << Ans << endl;

    return 0;
}


#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

#define FOR_N(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define FOR_R(i, b, e) for (int64_t i = int64_t(b); i < (int64_t)(e); i++)

int main() {
    int64_t N, C;
    cin >> N >> C;

    vector<pair<int64_t, int64_t>> P(N * 2);

    FOR_N(i, N) {
        int64_t a, b, c;
        cin >> a >> b >> c;
        P[2 * i + 0] = make_pair(a, c);
        P[2 * i + 1] = make_pair(b + 1, -c);
    }

    std::sort(P.begin(), P.end(), [](auto& a, auto& b) { return a.first < b.first; });

    int64_t i = 0, cost = 0, paid = 0;
    while (i < P.size()) {
        const int64_t now = P[i].first;
        while (i < P.size() && P[i].first <= now) {
            cost += P[i++].second;
        }
        if (i < P.size()) {
            paid += std::min(cost, C) * (P[i].first - now);
        }
    }
    cout << paid << endl;

    return 0;
}

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

#define mnto(x, y) x = min(x, (__typeof__(x)) y)
#define mxto(x, y) x = max(x, (__typeof__(x)) y)
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb emplace_back
typedef vector<int> vi;
typedef vector<ii> vii;

#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 200005

int k, n, m;
ll a[MAXN], b[MAXN];
priority_queue<pll> pq;

int main() {
	scanf("%d%d%d", &k, &n, &m);
	REP (i, 0, k) {
		scanf("%lld", &a[i]);
		a[i] *= m;
	}
	int sum = 0;
	REP (i, 0, k) {
		b[i] = a[i] / n;
		sum += b[i];
		pq.push(MP(a[i] - b[i] * n, i));
	}
	int rem = m - sum;
	REP (i, 0, rem) {
		assert(!pq.empty());
		auto [_, id] = pq.top(); pq.pop();
		b[id]++;
	}
	REP (i, 0, k) {
		printf("%lld ", b[i]);
	}
	printf("\n");
	return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using P = pair<int,int>;
#define INF 1001001001
#define LINF (1LL<<60)
#define F first
#define S second
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

int main() {
  int n;
  cin >> n;
  vector<pair<double, double>> d(n);
  double t;
  rep(i, n) {
    cin >> t >> d[i].first >> d[i].second;
    if (t == 1) {
    }
    else if (t == 2) {
      d[i].second -= 0.1;
    }
    else if (t == 3) {
      d[i].first += 0.1;
    }
    else if (t == 4) {
      d[i].first += 0.1;
      d[i].second -= 0.1;
    }
  }
  int ans = 0;
  rep(i, n) {
    rep(j, i) {
      if (max(d[i].first, d[j].first) < min(d[i].second, d[j].second)+0.01) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <utility>
#include <numeric>
#define pb push_back
#define mk make_pair
#define endl "\n"
#define mod 1000000007
#define mod1 29996224275833
#define mul 31
#define PI 3.14159265358979323846264
//#include bits/stdc++.h
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
typedef long long int lli;
typedef long double ld;
typedef pair<lli,lli> ii;
//priority_queue <lli, vector<lli>, greater<lli> > ti;
//priority_queue<pair<lli,pair<lli,lli>>>e;
vector <lli> p[300005],f(300005),q[300005];
lli d[205];
//vector<set<lli>>s(200005);
//set<pair<lli,lli>>s;
//vector<vector<lli>> dp(200005,vector<lli>(25,0));
//vector<lli>f(10000005);
//lli b[1000005],l[1000005];
//vector<vector<lli>> d(300005,vector<lli>(18,0));
//vector<pair<lli,ii>>p[300005];
//map<pair<lli,lli>,lli>mp,np;
//vector<pair<pair<lli, lli>,lli> > st;
//queue<lli> qy;
//freopen("codecoder.in", "r", stdin);
//freopen("codecoder.out", "w", stdout);
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
lli bpow(lli a, lli b) {
    lli res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = (a * a)%mod;
        //cout<<res<<" "<<a<<endl;
        b >>= 1;
    }
    return res%mod;
}
void fact(lli i)
{
    f[0]=1;
    for(lli k=1;k<=i;k++)
    {
        (f[k]=f[k-1]*k)%=mod;
    }
}
lli isprime(lli n)
{
    if(n==1)
        return 0;
    for(lli i=2;i<=sqrt(n);i++)
        if(n%i==0)
            return 0;
    return 1;
}
lli find(lli x)
{
    if(f[x]==x)
        return x;
    else
        return f[x]=find(f[x]);
}
bool cmp(lli x,lli y)
{
    return x<y;
}
void check()
{
    cout<<"HI"<<endl;
}
lli comb(lli i,lli j)
{
    if(j>i)return 0;
    lli k=f[i];
    lli g=(f[j]*(f[i-j]))%mod;
    lli h=bpow(g,mod-2);
    return (k*h)%mod;
}
pair<ld,ld>az(ld a,ld b,ld c,ld d,ld u)
{
    ld x1=(a-c)*cos(u)-(b-d)*sin(u)+c;
    ld y1=(a-c)*sin(u)+(b-d)*cos(u)+d;
    return {x1,y1};
}
/*void sieve()
{
    for(lli i=2;i<=sqrt(10000000);i++)
    {
        if(b[i]==0)
        {
            k.pb(i);
        for(lli j=2;i*j<=sqrt(10000000);j++)
        {
            b[i*j]=1;
        }
        }
    }
}*/
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t;t=1;
    while(t--)
    {
        lli n;cin>>n;
        vector<pair<ld,ld>>v;
        for(lli i=1;i<=n;i++)
        {
            lli z;ld x,y;
            cin>>z>>x>>y;
            if(z==2)
            {
                y-=0.001;
            }
            else if(z==3)
            {
                x+=0.001;
            }
            else if(z==4)
            {
                x+=0.001;y-=0.001;
            }
            v.pb({x,y});
        }
        lli ans=0;
        for(lli i=0;i<n;i++)
        {
            for(lli j=i+1;j<n;j++)
            {
                if((v[j].first<=v[i].second  && v[j].first>=v[i].first)or (v[i].first<=v[j].second && v[i].first>=v[j].first) )
                {
                    ans++;
                }
            }
        }
        cout<<ans<<endl;
    }
}


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

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

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

template<ll MOD = 1000000007>
class ModInt {
    ll n;
    ModInt constexpr inverse() const {
        return ModInt::pow(*this, MOD - 2);
    }

public:
    ModInt() : n(0) {}
    ModInt(ll _n) : n(((_n % MOD) + MOD) % MOD) {}
    ModInt operator+=(const ModInt &m) {
        n += m.n;
        if (n >= MOD) n -= MOD;
        return *this;
    }
    ModInt operator-=(const ModInt &m) {
        n -= m.n;
        if (n < 0) n += MOD;
        return *this;
    }
    ModInt operator*=(const ModInt &m) {
        n *= m.n;
        if (n >= MOD) n %= MOD;
        return *this;
    }
    ModInt operator/=(const ModInt &m) {
        (*this) *= m.inverse();
        return *this;
    }
    friend ModInt operator+(ModInt t, const ModInt &m) {
        return t += m;
    }
    friend ModInt operator-(ModInt t, const ModInt &m) {
        return t -= m;
    }
    friend ModInt operator*(ModInt t, const ModInt &m) {
        return t *= m;
    }
    friend ModInt operator/(ModInt t, const ModInt &m) {
        return t /= m;
    }
    ModInt operator=(const ll l) {
        n = l % MOD;
        if (n < 0) n += MOD;
        return *this;
    }
    friend ostream &operator<<(ostream &out, const ModInt &m) {
        out << m.n;
        return out;
    }
    friend istream &operator>>(istream &in, ModInt &m) {
        ll l;
        in >> l;
        m = l;
        return in;
    }
    static constexpr ModInt pow(const ModInt x, ll p) {
        ModInt<MOD> ans = 1;
        for (ModInt<MOD> m = x; p > 0; p /= 2, m *= m) {
            if (p % 2) ans *= m;
        }
        return ans;
    }
};
using mint = ModInt<998244353>;
mint operator"" _m(unsigned long long m) {
    return mint(m);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    input(n, m);
    mint ans = mint::pow(m, n) * n;
    vector<mint> memo(n, 0);
    vector<bool> used(n, false);
    rep(i, 0, n) {
        rep(j, 0, i) {
            mint t = 0;
            if (used[i - j - 1]) {
                t = memo[i - j - 1];
            } else {
                rep(k, 0, m) {
                    t += mint::pow(m - k - 1, i - j - 1);
                }
                used[i - j - 1] = true;
                memo[i - j - 1] = t;
            }
            ans -= t * mint::pow(m, n - (i - j) - 1);
        }
    }
    print(ans);

    return 0;
}

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long int ;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second
#define set20 cout<<fixed<<setprecision(20)  ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
long double pi=acos(-1) ;
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;}
ll dx[4] {1,0,-1,0} ;
ll dy[4] {0,1,0,-1} ;

int main(){
  ios::sync_with_stdio(false) ;
  cin.tie(nullptr) ;
  vector<string> A(3) ;
  rep(i,3) cin>>A[i] ;
  map<char,vector<P>> mp ;
  rep(i,3){
    string x= A[i] ;
    ll k= x.size() ;
    rep(j,k){
      mp[A[i][j]].pb(mpa(i,j)) ;
    }

  }

  ll cnt=mp.size() ;
  vector<vector<P>> B(cnt) ;
  ll i=0 ;
 for(auto u :mp){
   for(auto v:u.se){
    B[i].pb(v) ;
   }
   i++ ;
 }
  if(cnt>10){
    cout<<"UNSOLVABLE"<<endl ;
    return 0;
  }
  vector<ll> now(10) ;
  rep(i,10) now[i]=i ;
  do{
    ll d[3][15] ;
    rep(a,3)rep(b,15) d[a][b]=-1 ;
    rep(i,cnt){
      for(auto x:B[i]){
        d[x.fi][x.se]=now[i] ;
      }
    }
    if(d[0][0]==0 || d[1][0]==0 ||d[2][0]==0) continue ;
    vector<ll> e(3) ;
    rep(ww,3){
      ll num=0 ;
      rep(pp,15){
        if(d[ww][pp]==-1) break ;
        num*=10ll ;
        num+=d[ww][pp] ;
      }
      e[ww]=num ;
    }
    if(e[0]+e[1]==e[2]){
      rep(unti,3){
        cout<<e[unti]<<endl ;
      }
      return 0;
    }
  }while(next_permutation(now.begin(),now.end())) ;
  cout<<"UNSOLVABLE"<<endl ;
  return 0 ;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <complex>
#define ll long long
#define inf 1e9 + 6
#define sinf 1e15 + 500
#define ld long double
#define ull unsigned long long
#define poll complex<double>
#define line pair<poll, poll>
#define pi acos(-1)
#define lp(a, b, c, d) for (ll a = b; a < c; a += d)
#define endl '\n'
#define EPS 1e-12
#define IO                          \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);                   \
  // freopen("sum.in", "r", stdin);
#define mod 998244353
using namespace std;
const ll N = 2e5 + 5, SEG = (1 << 14);
int n;
vector<pair<int,int>>v;
vector<pair<int,int>>loc;
ll dp[N][2];
ll solve(int las,bool w)
{
  if(las==loc.size()-1)
  {
    if(w)return abs(v[loc[las].second].first);
    else return abs(v[loc[las].first].first);
  }

  ll &ret=dp[las][w];
  if(ret!=-1)return ret;

    ll x;
    if(w)x=v[loc[las].second].first;
    else x=v[loc[las].first].first;
  return ret=min(solve(las+1,0)+abs(v[loc[las+1].second].first-x)+abs(v[loc[las+1].second].first-v[loc[las+1].first].first)        ,
              solve(las+1,1)+abs(v[loc[las+1].first].first-x)+abs(v[loc[las+1].second].first-v[loc[las+1].first].first)
                    );
}
int main()
{
  IO
  cin>>n;
  int a,b;
  memset(dp,-1,sizeof(dp));
  for(int i=0;i<n;i++)
  {
    cin>>a>>b;
    v.push_back({a,b});

  }
    sort(v.begin(),v.end(),[](pair<int,int>a,pair<int,int>c){
      if(a.second==c.second)return a.first<c.first;
      else return a.second<c.second;
    });
    v.insert(v.begin(),{0,0});
    loc.push_back({0,0});
    for(int i=1;i<v.size();i++)
    {
      if(v[i].second!=v[i-1].second)
      {
        loc.push_back({i,i});
      }
      else loc.back().second=i;
    }
    cout<<solve(0,0)<<endl;

  return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define int long long int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define revrep(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))

const int INF = 1e18;
const int mod = 1e9+7;

ostream &operator<<( ostream &output, const pii &p ) { output << p.first << " " << p.second;return output; }
istream &operator>>( istream &input, pii &p ) { input >> p.first >> p.second;return input; }
template<typename T>
void inline println(vector<T> args){ for(T i: args)cout<<i<<" ";cout<<endl; }

int power(int a, int b) {
    if (b == 0)
        return 1;
    int res = power(a, b / 2);
    if (b % 2)
        return (res * res * a);
    else
        return (res * res);
}

void solve() {
	int h, w, n, m; cin>>h>>w>>n>>m;
    set<int> row[h+1], col[w+1];
    rep(i, 1, h+1) {
        row[i].insert(0);
        row[i].insert(w+1);
    }
    rep(i, 1, w+1) {
        col[i].insert(0);
        col[i].insert(h+1);
    }
    vii bulbs(n);
    rep(i, 0, n) cin>>bulbs[i];
    rep(i, 0, m) {
        int x, y; cin>>x>>y;
        row[x].insert(y);
        col[y].insert(x);
    }
    int preRow[h+2][w+2] = {};
    int preCol[h+2][w+2] = {};
    int mat[h+2][w+2] = {};
    for(auto bulb: bulbs) {
        int x = bulb.first;
        int y = bulb.second;
        auto temp = col[y].upper_bound(x);
        int greaterRow = *temp;
        int lesserRow = *prev(temp);
        temp = row[x].upper_bound(y);
        int greaterCol = *temp;
        // for(int i: col[x]) cout<<i<<" ";
        // cout<<endl;
        int lesserCol = *prev(temp);
        preCol[lesserRow+1][y] ++;
        preCol[greaterRow][y] --;
        preRow[x][lesserCol+1] ++;
        preRow[x][greaterCol] --;
    }
    rep(j, 0, w+1) {
        rep(i, 0, h+1) {
            if(i-1 >= 0)
                preCol[i][j] += preCol[i-1][j];
            mat[i][j] += preCol[i][j];
        }
    }
    rep(i, 0, h+1) {
        rep(j, 0, w+1) {
            if(j-1 >= 0)
                preRow[i][j] += preRow[i][j-1];
            mat[i][j] += preRow[i][j];
        }
    }
    int ans = 0;
    rep(i, 0, h+2) {
        rep(j, 0, w+2)
            if(mat[i][j]) ans++;
    }
    cout<<ans<<endl;
}

signed main()
{

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


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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min<ll>(a,b)
#define rmax(a,b) a = max<ll>(a,b)

#define fi first
#define se second

template <class T>
T fp(T x, long long e) {
	T ans(1);
	for(; e > 0; e /= 2) {
		if(e & 1) ans = ans * x;
		x = x * x;
	}
	return ans;
}

const ll mod = round(1e9)+7;
struct mb {
	mb(int v = 0) : val(v < 0 ? v + mod : v) {}
	mb(ll v){ val = (v%mod+mod)%mod; }
	int val;

	void operator += (mb o) { *this = *this + o; }
	void operator -= (mb o) { *this = *this - o; }
	void operator *= (mb o) { *this = *this * o; }
	mb operator * (mb o) { return (int)((long long) val * o.val % mod); }
	mb operator / (mb o) { return *this * fp(o, mod - 2); }
	//bool operator == (mb o) { return val==o.val; } //usar soh para hashes
	mb operator + (mb o) { return val + o.val >= mod ? val + o.val - mod : val + o.val; }
	mb operator - (mb o) { return val - o.val < 0 ? val - o.val + mod : val - o.val; }
};

const int NFAT = 20;
mb fat[NFAT], invfat[NFAT];

mb nck(int n, int k){
	assert(n>=k);
	return fat[n]*invfat[k]*invfat[n-k];
}

const int N = 2e5+10;

int v[N];
mb pot[20][N];

int n;
int va[N];
ll ans_brute = 0;
ll K;

bool check(){
	ll soma = 0;
	fr(i,n) soma+=va[i];
	if(!soma) return 0;
	fr(i,n){
		if(va[i]!=v[i]){
			if(va[i]<v[i]) break;
			return 0;
		}
	}
	set<int> st;
	int i = 0;
	while(i<n and va[i]==0) i++;
	for(;i<n; i++) st.insert(va[i]);

	return sz(st)==K;

}

void go(int i){
	if(i==n){
		if(check()) ans_brute++;
		return;
	}
	int minv = 16;
	if(i==0) minv = v[i]+1;
	fr(val,minv){
		va[i] = val;
		go(i+1);
	}
}

int ton(char c){
	if(c>='0' and c<='9') return c-'0';
	return 10+c-'A';
}

int vis[20][20][N];
mb dp[20][20][N];

mb rec(int ja_usei, int need_usar, int n){
	int delt = need_usar-ja_usei;
	if(delt>n) return 0;
	if(n==0) return delt==0;
	mb &ans = dp[ja_usei][need_usar][n];
	if(vis[ja_usei][need_usar][n]) return ans;
	vis[ja_usei][need_usar][n] = 1;
	if(ja_usei) ans += rec(ja_usei,need_usar,n-1)*ja_usei;
	if(ja_usei<need_usar) ans += rec(ja_usei+1,need_usar,n-1)*(need_usar-ja_usei);
	return ans;
}

mb ways_use(ll k, ll n){
	return rec(0,k,n);
	assert(vis[0][k][n]);
	return dp[0][k][n];
	if(k==0){
		if(n==0) return 1;
		return 0;
	}
	if(k>n) return 0;
	assert(k>=1 and k<=16);
	return pot[k][n]-pot[k-1][n]*k;
}

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

	fat[0] = invfat[0] = mb(1);
	for(int i = 1; i<NFAT; i++){
		fat[i] = mb(i)*fat[i-1];
		invfat[i] = mb(1)/fat[i]; //fp(fat[i],MOD-2);
	}

	for(ll val = 1; val<=16; val++){
		pot[val][0] = 1;
		for(int i = 1; i<N; i++) pot[val][i] = pot[val][i-1]*val;
	}

	string s; cin >> s;
	cin >> K;
	n = sz(s);
	//prin(n);

	fr(i,sz(s)) v[i] = ton(s[i]);

	mb ans = 0;

	vector<int> freq(16);
	int ndif = 0;
	mb aux = 0;
	fr(i,n){
		//prin(i);
		//prin(v[i]);
		mb cur = 0;
		fr(val,16){
			if(val==0 and i==0) continue;
			if(val>=v[i]) break;
			ll nrest = n-i-1;
			int curdif = ndif;
			if(!freq[val]) curdif++;
			if(curdif>K) continue;
			//prin(val);
			ll need_add = K-curdif;
			for(ll add = need_add; add<=K; add++){
				ans +=  nck(16-curdif,need_add)*nck(curdif,add-need_add)*ways_use(add,nrest);
			}
			//return 0;
		}
		//prin(cur.val);
		//prin(ans.val);
		freq[v[i]]++;
		if(freq[v[i]]==1) ndif++;
		if(ndif>K) break;
	}
	//prin(aux.val);
	if(ndif==K) ans += 1;
	if(n>=2){
		for(int i = 1; i<n; i++){
			fr(val,16){
				if(val==0) continue;
				ll nrest = n-i-1;
				int curdif = 1;
				if(curdif>K) continue;
				ll need_add = K-curdif;
				for(ll add = max<ll>(0,need_add); add<=K; add++){
					ans += nck(16-curdif,need_add)*nck(curdif,add-need_add)*ways_use(add,nrest);
				}
			}
		}
	}
	//prin(ans.val);

	cout << ans.val << "\n";
}

#include<bits/stdc++.h>
#define int long long
#define double long double
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second
using namespace std;
using pi = pair<int,int>;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int minf = 0xc0c0c0c0c0c0c0c0;
const int mod = 1e9+7;

int A[200200];
int dp[200200][20];

int c2i(char c) {
    if (c >= '0' && c <= '9') return c-'0';
    return c-'A'+10;
}

void add(int &ref, int val) {
    ref = (ref+val)%mod;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cout<<fixed<<setprecision(10);
    string s; int k; cin>>s>>k;
    int n = sz(s);
    for (int i=0; i<n; i++) {
        A[i] = c2i(s[i]);
    }
    dp[0][1] = A[0] - 1;
    int bit = 1<<A[0];
    for (int i=1; i<n; i++) {
        for (int j=1; j<=16; j++) {
            add(dp[i][j], dp[i-1][j]*j);
            add(dp[i][j+1], dp[i-1][j]*(16-j));
        }
        add(dp[i][1], 15);
        for (int j=0; j<A[i]; j++) {
            add(dp[i][__builtin_popcountll(bit|(1<<j))], 1);
        }
        bit |= 1<<A[i];
    }
    if (__builtin_popcountll(bit) == k) add(dp[n-1][k], 1);
    cout<<dp[n-1][k]<<'\n';
    return 0;
}


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

const int MAXN = 1e3 + 10;
int n, x[MAXN], y[MAXN], ans;

int read()
{
	int sum = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9') {if (ch == '-') fh = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {sum = (sum << 3) + (sum << 1) + (ch ^ 48); ch = getchar();}
	return sum * fh;
}

int main()
{
	n = read();
	for (int i = 1; i <= n; ++i) x[i] = read(), y[i] = read();
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
		{
			if ((double)(y[j] - y[i]) / (x[j] - x[i]) >= -1 && (double)(y[j] - y[i]) / (x[j] - x[i]) <= 1) ans++;
		}
	cout << ans << "\n";
	return 0;
}

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

int main(void) {
	double n, d, h,nd,nh,rus;

	rus = 0.0;
	cin >> n >> d >> h;

	for (int i = 0;i < n;i++) {
		cin >> nd >> nh;

		if (((h - nh)*(-1.0)*nd / (d - nd)) + nh >= rus) {
			rus = ((h - nh)*(-1.0)*nd / (d - nd)) + nh;
		}

	}

	cout << fixed << setprecision(10) << rus << endl;
}


#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x << ": " << (x) << endl
#else
#define debug(x)
#endif
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int maxn=1e6+7,inf=0x3f3f3f3f,mod=1e9+7;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll b,c;
    cin>>b>>c;
    ll pmx,pmi,nmx,nmi;
    if(b<0)
    {
        nmi=b-c/2;
        pmi=(-b)-(c-1)/2;
        pmx=max(-b+c/4+(c%4>=3),-nmi-((c%2)?0:1));
        nmx=max(b+(c-1)/4+((c-1)%4>=3),-pmi-(((c-1)%2)?0:1));
    }
    else if(b>0)
    {
        nmi=-b-(c-1)/2;
        pmi=b-(c)/2;
        pmx=max(b+(c-1)/4+((c-1)%4>=3),-nmi-(((c-1)%2)?0:1));
        nmx=max(-b+c/4+(c%4>=3),-pmi-((c%2)?0:1));
    }
    else if(b==0)
    {
        nmi=-b-(c)/2;
        pmi=0;
        pmx=-nmi-(((c)%2)?0:1);
        nmx=0;
    }
    cout<<pmx-pmi+1+nmx-nmi+1-max(0ll,nmx-pmi+1);
    return 0;
}


#include <bits/stdc++.h>

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;
const int MOD = 1E9 + 7;
string t;
int n;
stack<int> s;

template <class T>
void read(T& x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

template <class T, class... Args>
void read(T& x, Args&... args) {
    read(x), read(args...);
}

template <class T>
void write(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

LL qpow(LL a, LL b, LL MOD) {
    LL ans = 1, base = a;
    while (b) {
        if (b & 1) ans = ans * base % MOD;
        b >>= 1, base = base * base % MOD;
    }
    return ans;
}

void solve(int testNum) {
    // type your code here
    read(n);
    cin >> t;
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == 'x') {
            if (s.size() >= 2) {
                int fir = s.top();
                s.pop();
                int sec = s.top();
                s.pop();
                if (t[sec] != 'f' || t[fir] != 'o')
                    s.push(sec), s.push(fir), s.push(i);
            } else
                s.push(i);
        }else s.push(i);
    }
    cout << s.size();
}

signed main() {
    // freopen("1.in", "r", stdin);
    int testCase = 1;
    // read(testCase);
    for (int i = 1; i <= testCase; i++) solve(i);
    return 0;
}


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

int main() {
  long long int N,i=0,a;
  cin>>N;
  a=log10(i)+1;
  while(i+i*pow(10,a)<=N){
    i++;
    a=log10(i)+1;
  }
    cout<<i-1<<endl;
}

#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]!='.') cout<<a[i];
		else break;
	}
	return 0;
}


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

#include<cstdio>
#include<cstring>
#include<algorithm>

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

const int b = 8;
int A[100000];
int tmp[100001];
const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}
void okuri() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		ci += 4 + __builtin_ctzll((tmp & ma0) ^ ma0) >> 3;
	}
	else {
		ci += 8;
		tmp = *(ll*)ci;
		ci += 4 + __builtin_ctzll((tmp & ma0) ^ ma0) >> 3;
	}
}

const int dm = 1 << 17;
char dn[dm], * di = dn;
const char f[10] = "First\n";
const char s[10] = "Second\n";

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

	int T = getint();

	int are = 1 << 14;
	int owa = are;
	rep(t, T) {
		int N = getint();

		if (N % 2) {
			rep(i, N) okuri();
			memcpy(di, s, 7);
			di += 7;
		}
		else {
			rep(i, N) A[i] = getint();
			if (N > 256) {
				rep(k, 4) {
					int kazu[1 << b] = {}, kazu2[1 << b] = {};
					rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
					rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
					for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
					k++;
					rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
					rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
					for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
				}
			}
			else sort(A, A + N);

			int mae = 0, k = 0;
			rep(i, N) {
				if (mae == A[i]) k++;
				else {
					if (k & 1) break;
					k = 1;
					mae = A[i];
				}
			}

			if (k & 1) {
				memcpy(di, f, 6);
				di += 6;
			}
			else {
				memcpy(di, s, 7);
				di += 7;
			}
		}
		if (t > owa) {
			owa += are;
			fwrite(dn, 1, di - dn, stdout);
			di = dn;
		}
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define ad(a,b) a=(a+b)%mod;
#define X 5010
ll po(ll x,ll y){
	ll res=1;
	for(;y;y>>=1){
		if(y&1)res=res*x%mod;
		x=x*x%mod;
	}
	return res;
}
ll fac[X],ivf[X];
void init(){
	fac[0]=1;
	for(ll i=1;i<X;i++)fac[i]=fac[i-1]*i%mod;
	for(ll i=0;i<X;i++)ivf[i]=po(fac[i],mod-2);
}
ll C(ll n,ll k){
	return fac[n]*ivf[n-k]%mod*ivf[k]%mod;
}

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

ll n,a[100010];
void solve(){
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	bool ok=1;
	if(n%2==1)ok=0;
	else{
		rep(i,n/2)ok&=(a[i*2]==a[i*2+1]);
	}

	if(n%2==0)ok^=1;
	cout<<(ok?"First":"Second")<<endl;
}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	ll t;
	cin>>t;
	while(t--)solve();
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n%2 == 0) {
        cout << "White" << endl;
    } else {
        cout << "Black" << endl;
    }
    return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <deque>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(void){
    int n;
    cin >> n;
    cout << (n-1)/100+1 << endl;
}


#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

using vi = vector<int>;
using vvi = vector<vi>;
using vpii = vector<pair<int,int>>;

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <map<int,int>> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_,map<int,int>()) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    void init(const vector<int>& classes) {
        REP(i,classes.size()) {
            siz[i][classes[i]] = 1;
        }
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x].size() < siz[y].size()) swap(x, y);
        for(const auto &p: siz[y]) {
            auto [v,cnt] = p;
            siz[x][v] += cnt;
        }
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    // 生徒、クラス
    ll size(ll x,int y) { // 素集合のサイズ
        return siz[root(x)][y];
    }
};

void solve() {
    int N,Q; cin >> N >> Q;
    UnionFind uf(N);
    vector<int> css(N);
    REP(i,N) cin >> css[i];
    uf.init(css);

    REP(_,Q) {
        int a,b,c; cin >> a >> b >> c;
        if (a == 1) {
            b--; c--;
            uf.merge(b,c);
        } else {
            b--;
            cout << uf.size(b,c) << endl;
        }
    }
}

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

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

ll
getColor(vector<ll> & color, ll i) {
  ll end = i;
  while (color[end] != end) end = color[end];

  ll mid = i;
  while (color[mid] != end) {
    ll temp = color[mid];
    color[mid] = end;
    mid = temp;
  }

  return end;
}

void
solve() {
  ll n, q;
  cin>>n>>q;

  ll c;
  vector<ll> color(n + 1);
  map<ll, ll> current[200005];
  for (ll i=1; i<=n; i++) {
    cin>>c;
    color[i] = i;
    current[i][c] = 1;
  }

  ll x, y, z;
  for (ll i=0; i<q; i++) {
    cin>>x>>y>>z;
    if (x == 1) {
      ll left = getColor(color, y);
      ll right = getColor(color, z);
      if (left != right) {
        if (current[left].size() > current[right].size()) {
            color[right] = left;
            for (auto & p : current[right]) current[left][p.first] += p.second;
        }
        else {
            color[left] = right;
            for (auto & p : current[left]) current[right][p.first] += p.second;
        }
      }
    }
    else {
      ll end = getColor(color, y);
      cout<<current[end][z]<<endl;
    }
  }
}

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

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

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

  return 0;
}


#include<bits/stdc++.h>

#define fast                     ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl                     '\n'
#define all(A)                   (A).begin(),(A).end()
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define traceA(A,x)              cerr<<#A<<": ";for(int i = 0; i < (x) ; ++i) cerr<<A[i]<<' ';cerr<<endl
#define traceV(A)                cerr<<#A<<": ";for(auto i:A)cerr<<i<<' ';cerr<<endl
#define traceM(A,n,m)            cerr<<#A<<": "<<endl;for(int i = 0; i < (n) ; ++i){for(int j = 0; j < (m) ; ++j) cerr << A[i][j] << ' ';cerr << endl;}

typedef long long int ll;
typedef long double ld;

using namespace std;

const int N = 2e5 + 77;
int A[N];

void sol(){
    int a , b , c ; cin >> a >> b >> c ;
    if(a*a + b*b < c*c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


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

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

#define pb            push_back
#define pf            push_front
#define all(x)        begin(x), end(x)
#define sz(x)         (int)(x).size()
#define ff            first
#define ss            second
#define mp            make_pair
#define lb            lower_bound
#define ub            upper_bound
#define Tcase()       int tcc; cin >> tcc; while(tcc--)
#define FOR(i, a, b)  for(int i = (a); i < (b); i++)
#define F0R(i, a)     FOR(i, 0, a)

const ll  MOD   = 998244353;
const ll  INF   = 9e18;
const int MX    = 2e5 + 5;
const ld  PI    = acos((ld) -1);
const int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main(){

    setIO();

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

    cout << min({a, b, c, d});
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define cases() ll t;cin>>t;while(t--)
#define pb push_back
#define ff first
#define ss second
#define light ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const ll MAX = 1e5+5;
const ll INF = 1e18;
const ll MOD = 1e9+7 ;

int main()
{
    vector<int> a(4);
    int i;
    for(i=0;i<4;i++)
        cin >> a[i];
    cout << *min_element(a.begin(),a.end());
}


#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int num_cases;
  cin >> num_cases;
  for (int case_id = 0; case_id < num_cases; case_id++) {
    int64 l, r;
    cin >> l >> r;
    int64 base_count = r - l - l + 1;
    if (base_count < 0) {
      cout << 0 << endl;
    } else {
      cout <<  base_count * (base_count + 1) / 2 << endl;
    }
  }
}

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

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  constexpr ModInt() : x(0) {}
  constexpr ModInt(int64_t y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  constexpr ModInt &operator+=(const ModInt &p) noexcept {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt &p) noexcept {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt &p) noexcept {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  constexpr ModInt &operator/=(const ModInt &p) noexcept {
    *this *= p.inverse();
    return *this;
  }
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt operator+(const ModInt &p) const noexcept {
    return ModInt(*this) += p;
  }
  constexpr ModInt operator-(const ModInt &p) const noexcept {
    return ModInt(*this) -= p;
  }
  constexpr ModInt operator*(const ModInt &p) const noexcept {
    return ModInt(*this) *= p;
  }
  constexpr ModInt operator/(const ModInt &p) const noexcept {
    return ModInt(*this) /= p;
  }
  constexpr bool operator==(const ModInt &p) const noexcept { return x == p.x; }
  constexpr bool operator!=(const ModInt &p) const noexcept { return x != p.x; }
  constexpr ModInt inverse() const noexcept {
    int a = x, b = mod, u = 1, v = 0, t = 0;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  constexpr ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend constexpr ostream &operator<<(ostream &os, const ModInt &p) noexcept {
    return os << p.x;
  }
  friend constexpr istream &operator>>(istream &is, ModInt &a) noexcept {
    int64_t t = 0;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  constexpr int get_mod() { return mod; }
};

int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, a, b;
    cin >> n >> a >> b;
    if (a > b) swap(a, b);
    ModInt<> aall = (n - a + 1), ball = (n - b + 1), cross = 0, res = 0;
    res = aall.pow(2) * ball.pow(2);
    cross = (b - a + 1) * (n - b + 1);
    long long l = b + 1, r = min(n, a + b - 1);
    auto sum = [](long long x) { return x * (1 + x) / 2; };
    if (l <= r) cross += (sum(n - l + 1) - sum(n - r)) * 2;
    res -= cross * cross;
    cout << res << endl;
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define MAX 10000003
using namespace std;
#define ll long long int
#include<fstream>
#define fast ios_base::sync_with_stdio(false);
#define io   cin.tie(NULL);
#define inp(arr,n) for(ll i=0;i<n;i++){cin>>arr[i];}
#define print(arr,n) for(ll i=0;i<n;i++){cout<<arr[i]<<" ";}
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}
int main()
{

	ll t;
	t=1;
	while(t--)
	{
		ll a,b;
		cin>>a>>b;
		if(a>=b)
		{
			for(ll i=1;i<=a;i++)
				cout<<i<<" ";
			for(ll i=1;i<=b-1;i++)
				cout<<-i<<" ";
			ll sum=0;
			for(ll i=b;i<=a;i++)
				sum+=i;
			cout<<-sum<<endl;
		}
		if(a<b)
		{
			for(ll i=1;i<=b;i++)
				cout<<-i<<" ";
			for(ll i=1;i<=a-1;i++)
				cout<<i<<" ";
			ll sum=0;
			for(ll i=a;i<=b;i++)
				sum+=i;
			cout<<sum<<endl;
		}
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <set>
//#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define all(v) v.begin(), v.end()
#define front(v) *v.begin()
#define back(v) *(--v.end())
#define len(v) v.size()
#define int long long

using longl = long long;
using longd = long double;

const longl INF = 1e9;
const longl LINF = 1e18;
const longl mod = 1e9 + 7;
const double PI = acos(-1);
//------------------------------------------------------------------------------------------------

longl divup(longl a, longl b){
    return (a + b - 1) / b;
}

longl bin_pow(longl a, longl b){
    longl res = 1;

    while (b > 0){
        if (b % 2)
            res = res * a % mod;

        a = a * a % mod;
        b /= 2;
    }
    return res;
}

//------------------------------------------------------------------------------------------------
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

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

    int n;
    int k;
    if (a > b) {
        n = a;
        k = 1;
    }
    else {
        n = b;
        k = -1;
    }

    int sum = 0;
    int sum2 = 0;
    vector<int> tmp;
    for (int i = 0; i < n; i++){
        cout << (i + 1) * k << ' ';
        sum += (i + 1) * k;

        if (i < min(a, b) - 1){
            cout << -((i + 1) * k) << ' ';
        }
        else {
            sum2 += (i + 1) * k;
        }
    }

    cout << -sum2;

    return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

const int N = 2e5 + 5, MOD = 998244353;
LL pre[N << 1], apre[N << 1];
int n, m;

LL qpow(LL a, LL b = MOD - 2) {
    LL ans = 1;
    while (b) {
        if (b & 1) {
            ans = ans * a % MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return ans;
}

void init() {
    pre[0] = 1;
    apre[0] = qpow(pre[0]);
    for (int i = 1; i <= N * 2; ++i) {
        pre[i] = pre[i - 1] * i % MOD;
        apre[i] = qpow(pre[i]);
    }
}

LL C(int a, int b) {
    return (pre[a] * apre[b] % MOD) * apre[a - b] % MOD;
}

int main() {
    init();
    read(n), read(m);
    LL ans = 0;
    for (int i = 1; i <= m; ++i) {
        LL val = i, now = 1;
        for (int j = 2; j * j <= val; ++j) {
            int cnt = 0;
            while (val % j == 0) {
                val /= j;
                cnt++;
            }
            now = now * C(n + cnt - 1, n - 1) % MOD;
        }
        if (val != 1) {
            now = now * C(n, n - 1) % MOD;
        }
        ans += now;
        ans %= MOD;
    }
    printf("%lld\n", ans);
	return 0;
}

#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
const ll INF = 1000000000000000000 + 1;
const int MAX_N = 20 + 10;
ll A[MAX_N];

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

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

  ll ans = INF;

  for (int i = 0; i < (1<<N); i++) {

    ll res;
    int bit;

    res = A[0];
    if((i & 1) == 1) bit = 1;
    else bit = 0;

    vector<ll> v;

    for (int j = 1; j < N; j++) {
      if( ((i >> j) & 1) == bit){
	res |= A[j];
      }
      else {
	bit = (i>>j) & 1;
	v.push_back(res);
	res = A[j];
      }
    }
    v.push_back(res);

    ll xorval = v[0];
    for (int j = 1; j < v.size(); j++) {
      xorval ^= v[j];
    }
    ans = min(ans, xorval);
  }

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


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

long long f[100];

int main() {
    f[0] = 0;
    f[1] = 1;
    for (int i = 2; i < 100; ++i) {
        f[i] = f[i - 2] + f[i - 1];
    }
    long long n;
    scanf("%lld", &n);
    queue<int> Q;
    while (n) {
        int x = upper_bound(f + 1, f + 93, n) - f - 1;
        Q.push(x);
        n -= f[x];
    }
    int lmt = Q.front();
    vector<int> ans;
    for (int i = 1; i <= lmt; ++i) {
        if (i != 1) {
            if ((i & 1) ^ (lmt & 1)) ans.push_back(4);
            else ans.push_back(3);
        }
        while (!Q.empty() && lmt - Q.front() + 1 == i) {
            Q.pop();
            if ((i & 1) ^ (lmt & 1)) ans.push_back(2);
            else ans.push_back(1);
        }
    }
    printf("%d\n", (int)ans.size());
    for (int it : ans) {
        printf("%d\n", it);
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define mod 1000000007
#define ll long long
vector<int>v;
int ans[N];
ll n,a[N];
void add(int x,int p){
	for(int i=ans[0];i>x;i--)ans[i+1]=ans[i];
	ans[0]++,ans[x+1]=p;
}
int main(){
	scanf("%lld",&n);
	a[0]=a[1]=1;
	for(int i=2;i<=90;i++)a[i]=a[i-1]+a[i-2];
	for(int i=90;i;i--)
		if (n>=a[i]){
			n-=a[i];
			v.push_back(i);
		}
	add(ans[0],1);
	for(int i=1;i<=v[0];i++)add(ans[0],3+(i&1));
	for(int i=1;i<v.size();i++)add(ans[0]-v[i],5-ans[ans[0]-v[i]+1]);
	ans[ans[0]]=3;
	for(int i=0;i<=ans[0];i++)printf("%d\n",ans[i]);
}


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

int main()
{
	double n;

	cin >> n;
	n *= 1.08;
	n = (int)(n);

	if (n == 206)
		cout << "so-so" << endl;
	else if(n < 206)
		cout << "Yay!" << endl;
	else
		cout << ":(" << endl;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rrep(i,n) for(int i = (n-1);i>=0;--i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF=1<<30;
//const ll INF=1LL<<60;

int main() {

    int n;
    cin >> n;

    double ans = (double)n*1.08;

    int k = ans;

    if(k<206)   cout<<"Yay!"<<endl;
    else if(k==206) cout<<"so-so"<<endl;
    else    cout<<":("<<endl;

 return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

typedef long long ll;
typedef long double ld;
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPR(i,a,b) for(int i = b; i >= a; i--)
#define all(a)              a.begin(), a.end()
#define alln(a, n)          (a, a+n)
#define sz(x) (int)(x).size()
#define MAX                 10000007
#define MIN                 -10000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mii             map<int,int>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf 1e18
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef set<int> si;
const int MOD=1e9+7;
ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll power(ll a,ll b,ll MOD){if(b == 0)return 1;if(b == 1)return a;ll ans = power(a,b/2,MOD) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;}
ll inverse(ll x){x%=MOD;return power(x,MOD-2,MOD);}
ll fact[1],inv[1];
void factorial(ll n){
  fact[0]=1;
  for(ll i=1;i<=n;i++){
    fact[i]=fact[i-1]*i;
    if(fact[i]>=MOD)
      fact[i]%=MOD;
  }
}
ll ncr(ll n,ll r){
  if(n<r||n<0||r<0)
    return 0;
  ll b=inv[n-r];
  ll c=inv[r];
  ll a=fact[n]*b;
  if(a>=MOD)
    a%=MOD;
  a*=c;
  if(a>=MOD)
    a%=MOD;
  return a;
}
vector<char> is_prime(100001, true);
void sieve(ll n){
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= n; i++) {
        if (is_prime[i] && (long long)i * i <= n) {
            for (int j = i * i; j <= n; j += i)
                  is_prime[j] = false;
        }
  }
}

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

    int t;
    t=1;
    cout<<fixed<<setprecision(0);
     //  cin>>t;
    while(t--){
            ll n;
            cin>>n;
            ll a[n];
            set<ll>s;
            REP(i,0,n-1) cin>>a[i];
            ll j=0;
            REP(i,0,n-1){
              s.insert(a[i]);
              while(s.count(j)) j++;
              cout<<j<<"\n";
            }

             }
             cerr<<"Time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}

// https://atcoder.jp/contests/abc201/tasks/abc201_d

// if we reach i,j with different path then still the subproblem remain same.
#include<bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define     pb    push_back
#define     ff    first
#define     ss    second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#warning Remember to change t
inline void setIO();
using namespace std;
typedef long long ll;
typedef long double ld;
ll const MX = 2e3+7;
ll const inf = MX*MX + 7;
ll dp[MX][MX];
char grid[MX][MX];
ll h,w;

// ll f(ll i,ll j){
//     // if(i>w||j>h){
//     //     return -inf;
//     // }
//     return ;
// }

ll cost(ll i ,ll j){
    if(i==h&&j==w){
        return 0;
    }
    if(dp[i][j]!=inf){
        return dp[i][j];
    }
    ll a,b;
    if(((i+j)%2)==0){
        a = -inf;
        b = -inf;
        if(i<=h-1){
            a = cost(i+1,j)+(grid[i+1][j]=='+'?1:0);
        }
        if(j<=w-1){
            b = cost(i,j+1)+(grid[i][j+1]=='+'?1:0);
        }
         dp[i][j] = max(a,b);
         return dp[i][j];
    }else{
        a = inf;
        if(i<=h-1){
            a = cost(i+1,j)-(grid[i+1][j]=='+'?1:0);
        }
        if(j<=w-1){
            b = cost(i,j+1)-(grid[i][j+1]=='+'?1:0);
        }
        dp[i][j] = min(a,b);
        return dp[i][j];
    }
}

int solve(){
  cin >> h >> w;

  // cout << h << w << "\n";

  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
        cin >> grid[i][j];
        dp[i][j]=inf;
    }
  }

  ll ans = cost(1,1);

  // for(int i=1;i<=h;i++){
  //   for(int j=1;j<=w;j++){
  //       cout << dp[i][j]<<" ";
  //   }
  //   cout<<"\n";
  // }

  if(ans>0){
    cout<<"Takahashi";
  }else if (ans==0){
    cout<<"Draw";
  }else{
    cout << "Aoki";
  }

    return 0;
  }

int main(){
    Speed_UP

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

    ll t = 1;
    while(t--){
        solve();
    }
}

inline void setIO(string name="") {
    #ifndef ONLINE_JUDGE
    freopen((name+".in").c_str(), "r", stdin);
    freopen((name+".out").c_str(), "w", stdout);
    #endif
    }


#include <bits/stdc++.h>
constexpr int DEBUG = 0;
using namespace std;
using int64 = long long;

struct Edge {
  int s, t;
  Edge(int s, int t) : s(s), t(t) {}
};

vector<vector<Edge>> ReadUndirectedGraph(int n, int m, int offset) {
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < m; i++) {
    int v1, v2; cin >> v1 >> v2; v1 -= offset; v2 -= offset;
    graph[v1].push_back(Edge(v1, v2)); graph[v2].push_back(Edge(v2, v1));
  }
  return graph;
}

class FF {
 private:
  int64 x_;
  void Normalize() {
    if (0 <= x_ && x_ < P) { return; } x_ %= P; if (x_ < 0) { x_ += P; }
  }
 public:
  // static constexpr int P = 998244353;
  static constexpr int P = 1000000007;
  FF(int64 x) : x_(x) { Normalize(); }
  FF() : x_(0) {}
  int64 Value() const { return x_; }
  FF operator+(FF o) const { FF r(*this); r += o; return r; }
  FF operator-(FF o) const { FF r(*this); r -= o; return r; }
  FF operator* (FF o) const { FF r(*this); r *= o; return r; }
  FF operator/ (FF o) const { return (*this) * o.Power(P - 2); }
  bool operator== (FF o) const { return x_ == o.x_; }
  void operator+= (FF o) { x_ += o.x_; if (x_ >= P) x_ -= P; }
  void operator-= (FF o) { x_ -= o.x_; if (x_ < 0) x_ += P; }
  void operator*= (FF o) { x_ = (x_ * o.x_) % P; }
  FF Power(int64 p) const {
    if (p < 0) { return FF(1) / Power(-p); } FF x(*this), r(1);
    while (p) { if (p % 2) { r *= x; } x *= x; p /= 2; } return r;
  }
};
ostream& operator<<(ostream& s, const FF& x) { s << x.Value(); return s; }

template<typename T>
vector<vector<T>> Make2D(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

vector<vector<FF>> Id(int n) {
  auto a = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) { a[i][i] = 1; }
  return a;
}

vector<vector<FF>> Multiply(vector<vector<FF>> a, vector<vector<FF>> b) {
  int n = a.size();
  auto c = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  return c;
}

vector<vector<FF>> Power(vector<vector<FF>> a, int p) {
  int n = a.size();
  vector<vector<FF>> r = Id(n);
  // while (p) { if (p % 2) { r *= x; } x *= x; p /= 2; } return r;
  while (p) {
    if (p % 2) {
      r = Multiply(r, a);
    }
    a = Multiply(a, a);
    p /= 2;
  }
  return r;
}

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

  int n, m, k; cin >> n >> m >> k;
  vector<FF> xs(n);
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    xs[i] = x;
  }
  auto graph = ReadUndirectedGraph(n, m, 1);

  auto a = Make2D(n, n, FF(0));
  for (int i = 0; i < n; i++) {
    a[i][i] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (const auto& e : graph[i]) {
      a[i][e.t] += FF(1) / FF(2 * m);
      a[i][i] -= FF(1) / FF(2 * m);
    }
  }

  // for (int i = 0; i < n; i++) {
  //   for (int j = 0; j < n; j++) {
  //     cout << a[i][j] * 4 << " ";
  //   }
  //   cout << endl;
  // }

  a = Power(a, k);

  // for (int i = 0; i < n; i++) {
  //   for (int j = 0; j < n; j++) {
  //     cout << a[i][j] << " ";
  //   }
  //   cout << endl;
  // }

  for (int i = 0; i < n; i++) {
    FF e = 0;
    for (int j = 0; j < n; j++) {
      e += a[i][j] * xs[j];
    }
    cout << e << endl;
  }
}

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

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<double> VD;

#define MOD 1000000007

/* Matrix operations */

typedef int64 Element;
typedef vector<Element> Row;
typedef vector<Row> Matrix;

Matrix zeros(int h, int w) {
    return Matrix(h, Row(w));
}

Matrix identity(int n) {
    Matrix c = zeros(n,n);
    REP (i,n) c[i][i]=1;
    return c;
}

Matrix transpose(const Matrix &a) {
    int h=a[0].size(), w=a.size();
    Matrix t = zeros(h, w);
    REP (i,h) REP (j,w) t[i][j]=a[j][i];
    return t;
}

Matrix operator+(const Matrix &a, const Matrix &b) {
    int h=a.size(), w=a[0].size();
    assert(a.size()==b.size() && a[0].size()==b[0].size());
    Matrix c = zeros(h,w);
    REP (i,h) REP (j,w) {
        c[i][j]=a[i][j]+b[i][j];
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator+(const Matrix &a, Element k) {
    int h=a.size(), w=a[0].size();
    Matrix c = a;
    REP (i,h) REP (j,w) {
        c[i][j]+=k;
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator*(Element k, const Matrix &a) {
    int h=a.size(), w=a[0].size();
    Matrix c = a;
    REP (i,h) REP (j,w) {
        c[i][j]*=k;
        c[i][j]%=MOD;
    }
    return c;
}

Matrix operator*(const Matrix &a, const Matrix &b) {
    int h=a.size(), w=b[0].size();
    assert(a[0].size()==b.size());
    Matrix c = zeros(h,w);
    REP (i,h) REP (j,w) {
        REP (k,a[0].size()) {
            c[i][j]+=a[i][k]*b[k][j];
            c[i][j]%=MOD;
        }
    }
    return c;
}

Matrix operator+(Element k, const Matrix &a) {
    return a+k;
}

Matrix operator*(const Matrix &a, Element k) {
    return k*a;
}

Matrix operator-(const Matrix &a, const Matrix &b) {
    return a+(-1)*b;
}

Matrix mat_pow(const Matrix &a, int k) {
    assert(a.size()==a[0].size());
    if (k==0) return identity(a.size());
    if (k%2==0) {
        Matrix c=mat_pow(a,k/2);
        return c*c;
    } else {
        Matrix c=mat_pow(a,k-1);
        return c*a;
    }
}

void mat_print(const Matrix &a) {
    REP (i,a.size()) {
        REP (j,a[i].size()) {
            if (j!=0) cout << " ";
            cout << a[i][j];
        }
        cout << endl;
    }
}

int modPow(int a, int k, int m) {
	if (k==0) return 1;
	else if (k%2==0) {
		int64 b=modPow(a,k/2,m);
		return (b*b)%m;
	} else {
		int64 b=modPow(a,k-1,m);
		return (a*b)%m;
	}
}

int n,m,k;
int a[100];
int deg[100];
vector<int> adj[100];

int main() {
    //freopen("test.in","r",stdin);
    cin >> n >> m >> k;
    REP (i,n) cin >> a[i];
    Matrix A = zeros(n,n);
    REP (i,m) {
        int x,y;
        cin >> x >> y;
        x--; y--;
        adj[x].PB(y); adj[y].PB(x);
        deg[x]++; deg[y]++;
    }
    int64 inv_2m=modPow(2*m,MOD-2,MOD);
    int64 inv_m=modPow(m,MOD-2,MOD);
    REP (i,n) {
        for (int j : adj[i]) {
            A[i][j]=inv_2m; //1.0/(2*m);
            A[i][i]=(A[i][i]+inv_2m)%MOD; //+=1.0/(2*m);
        }
        A[i][i]=(A[i][i]+(m-deg[i])*inv_m)%MOD;
    }
    Matrix v = zeros(n,1);
    REP (i,n) v[i][0]=a[i];
    Matrix Ak = mat_pow(A,k);
    Matrix vk = Ak*v;
    REP (i,n) {
        cout << vk[i][0] << endl;
    }
    return 0;
}


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

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

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

	int N;
	cin >> N;
	int kotae = 0;
	rep(i, N) {
		int a;
		cin >> a;
		if (a >= 10) kotae += a - 10;
	}
	co(kotae);

	Would you please return 0;
}

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

// ll binpow(ll a, ll b) {
//     ll res = 1;
//     while (b > 0) {
//         if (b & 1)
//             res = res * a;
//         a = a * a;
//         b >>= 1;
//     }
//     return res;
// }

// void SieveOfEratosthenes(ll n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.
//     bool prime[n + 1];
//     memset(prime, true, sizeof(prime));

//     for (ll p = 2; p * p <= n; p++)
//     {
//         if (prime[p] == true)
//         {
//             for (ll i = p * p; i <= n; i += p)
//                 prime[i] = false;
//         }
//     }
//     /* Print all prime numbers
//     for (ll p = 2; p <= n; p++)
//         if (prime[p])
//             cout << p << " ";*/
// }

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

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

int n,i,sum=0;
cin>>n;
int a[n];
for(i=0;i<n;i++){
	cin>>a[i];
	if(a[i]>10){
		sum+=a[i]-10;
	}
}
cout<<sum;

cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
return 0;
}


#pragma GCC optimize("O3")

#include "bits/stdc++.h"

#define sz(x) (int)(x).size()
using namespace std;
const int64_t INV = int64_t(332748118);
const int64_t MOD = int64_t(998244353);
const int mxN = int(5e3) + 5;
int64_t dp[mxN][mxN];
char arr[mxN][mxN];
int h,w,k;

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

    cin >> h >> w >> k;
    for(int i=0; i<k; i++) {
        int r,c; char val;
        cin >> r >> c >> val;
        arr[r][c] = val;
    }
    dp[1][1] = 1;
    for(int i=1; i<=h; i++)
        arr[i][0] = 'X';
    for(int j=1; j<=w; j++)
        arr[0][j] = 'X';
    for(int i=1; i<=h; i++) {
        for(int j=1; j<=w; j++) {
            if(i==1 && j==1) continue;
            switch(arr[i-1][j]) {
                case 0:
                    dp[i][j] += (2 * INV * dp[i-1][j]) % MOD;
                    break;
                case 'X':
                case 'D':
                    dp[i][j] += dp[i-1][j];
                    break;
            }
            switch(arr[i][j-1]) {
                case 0:
                    dp[i][j] += (2 * INV * dp[i][j-1]) % MOD;
                    break;
                case 'X':
                case 'R':
                    dp[i][j] += dp[i][j-1];
                    break;
            }
        }
    }
    int times = h * w - k;
    int64_t mul = 1;
    while(times--) {
        mul *= 3;
        mul %= MOD;
    }
    cout << (dp[h][w] * mul) % MOD << "\n";

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int, int> >
#define vpll vector <pair <long long, long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#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 MANX MAXN
#define itn int
#define dbg(x); {cout << #x << "=" << x << ", ";}
#define in(x); { for (auto &to : x) cin >> to;}
#define out(x); { for (auto &to : x) cout << to << " "; cout << '\n'; }

const ll INFLL = 1e18;
const int MAXN = 3e5+100;
const ll INF = 1e9;
const int mod1 = 998244353;
const int mod2 = 1e9+21;
int add(int a,int b)
{
    a+=b;
    if (a>=mod1)
        return a-mod1;
    return a;
}

int mult(int a,int b)
{
    return 1ll*a*b%mod1;
}
void ad(int &x,int y)
{
    x=add(x,y);
}
int sub(int a,int b)
{
    a-=b;
    if (a<0)
        return a+mod1;
    return a;
}

int bin_pow(int base,ll deg)
{
    if (deg==0)
        return 1;
    int t=bin_pow(base,deg/2);
    if (deg&1)
        return 1ll*t*t%mod1*base%mod1;
    else
        return 1ll*t*t%mod1;
}
void solve()
{
    int h,w,k;
    cin>>h>>w>>k;
    vector <vector <char> > c(h,vector <char>(w,'1'));
    while (k--)
    {
        int x,y;
        cin>>x>>y;
        x--,y--;
        cin>>c[x][y];
    }
    vector <int> pows(MAXN);
    pows[0]=1;
    for (int i=1;i<MAXN;i++)
        pows[i]=mult(3,pows[i-1]);
    vector <vector <int> > pref(h+1,vi(w+1));
    for (int i=1;i<=h;i++)
    {
        for (int j=1;j<=w;j++)
            pref[i][j]=pref[i][j-1]+(c[i-1][j-1]=='1'?1:0);
    }
    for (int j=1;j<=w;j++)
    {
        for (int i=1;i<=h;i++)
            pref[i][j]+=pref[i-1][j];
    }
    auto get = [&](int x,int y,int x1,int y1)
    {
        x++,y++,x1++,y1++;
        if (x>h||y>w)
            return 1;
        int ans=pref[x1][y1];
        ans+=pref[x-1][y-1];
        ans-=pref[x1][y-1];
        ans-=pref[x-1][y1];
        return pows[ans];
    };
    vector <vector <int> > dp(h,vi(w));
    dp[0][0]=1;
    for (int i=0;i<h;i++){
        for (int j=0;j<w;j++)
        {
            if (c[i][j]=='1')
            {
                if (i+1<h)
                    ad(dp[i+1][j],mult(mult(2,get(i,j+1,i,w-1)),dp[i][j]));
                if (j+1<w)
                    ad(dp[i][j+1],mult(mult(2,get(i+1,j,h-1,j)),dp[i][j]));
            }
            else if (c[i][j]=='R')
            {
                if (j+1<w)
                    ad(dp[i][j+1],mult(mult(1,get(i+1,j,h-1,j)),dp[i][j]));
            } else if (c[i][j]=='D')
            {
                if (i+1<h)
                    ad(dp[i+1][j],mult(mult(1,get(i,j+1,i,w-1)),dp[i][j]));
            }
            else{
                if (j+1<w)
                    ad(dp[i][j+1],mult(mult(1,get(i+1,j,h-1,j)),dp[i][j]));
                if (i+1<h)
                    ad(dp[i+1][j],mult(mult(1,get(i,j+1,i,w-1)),dp[i][j]));
            }
        }
    }
    cout<<mult(dp[h-1][w-1],c[h-1][w-1]=='1'?3:1);
    // X?
    // RR
}

int main() {
    #ifdef Mip182
    freopen("a.in", "r", stdin);
    #else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #endif
    int _t;
    _t=1;
//    cin>>_t;
    while (_t--)
        solve();
    #ifdef Mip182
    cout<<'\n'<<"Time : "<<(double)(clock())/CLOCKS_PER_SEC<<'\n';
    #endif
}


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

#define ALL(v) (v).begin(),(v).end()
#define REP(i,n) for(int i=0,i_len=n; i<i_len; ++i)

template<typename T1,typename T2> bool chmax(T1 &a, T2 b) { if (a<b) { a=b; return 1; } return 0; }
template<typename T1,typename T2> bool chmin(T1 &a, T2 b) { if (b<a) { a=b; return 1; } return 0; }

int n, k;
vector<vector<int> > g;
vector<int> d;  // d[v]: 頂点vと葉の最大距離

void dfs(int cur, int pre, int x, int& cnt){
    d[cur] = 0;
    for(auto& nxt : g[cur]){
        if(nxt == pre) continue;
        dfs(nxt, cur, x, cnt);
        if(d[nxt]+1 > x) cnt++;  // cur-nxtを切る
        else if(d[cur]+d[nxt]+1 > x){  // curの最長の部分木かnxtのいずれかを切る
            cnt++;
            chmin(d[cur], d[nxt]+1);
        }else{
            chmax(d[cur], d[nxt]+1);
        }
    }
}

// k個以下の直径がx以下の木に分解できるか
bool check(int x){
    int cnt = 1;
    dfs(0, -1, x, cnt);
    return cnt <= k;
}

int solve(){
    cin >> n >> k;
    g.resize(n);
    d.resize(n);
    REP(i,n-1){
        int u, v;
        cin >> u >> v;
        u--;v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    // 直径がx*2+1 <=> 任意の頂点への距離がx以下である頂点が存在する
    int ok = n, ng = -1;
    while(abs(ok-ng)>1){
        int mid = (ok+ng)/2;
        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << (ok+1)/2 << endl;
    return 0;
}

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

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

using namespace __gnu_pbds;
using namespace std;

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

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

#define mp make_pair

const int MOD =  998244353;

int mul(int a, int b) {
    return (1LL * a * b) % MOD;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=MOD) s-=MOD;
    return s;
}

int sub(int a, int b) {
    int s = (a+MOD-b);
    if (s>=MOD) s-=MOD;
    return s;
}

int po(int a, ll deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, MOD-2);
}

mt19937 rnd(time(0));

/*
const int LIM = 3e5 + 5;

vector<int> facs(LIM), invfacs(LIM);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<LIM; i++) facs[i] = mul(facs[i-1], i);
    invfacs[LIM-1] = inv(facs[LIM-1]);
    for (int i = LIM-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

/*struct DSU
{
    vector<int> sz;
    vector<int> parent;
    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        find_set(a);
        find_set(b);

        a = find_set(a);
        b = find_set(b);

        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        };
    }

    DSU (int n)
    {
        parent.resize(n);
        sz.resize(n);
        for (int i = 0; i<n; i++) make_set(i);
    }
};*/

vector<vector<int>> G;

int n, k;

vector<int> parent;
vector<int> depth;
vector<vector<int>> children;

void dfs(int v, int par = -1)
{
    for (auto it: G[v]) if (it!=par)
    {
        children[v].push_back(it);
        depth[it] = depth[v] + 1;
        parent[it] = v;
        dfs(it, v);
    }
}

set<pair<int, int>> worst;
vector<bool> deleted;
vector<int> deleting;

void del(int v, int dist)
{
    if (!deleted[v])
    {
        worst.erase(mp(depth[v], v)); deleted[v] = true;
    }
    if (dist<=deleting[v]) return;
    deleting[v] = dist;

    if (dist==0) return;

    for (auto it: G[v]) del(it, dist-1);
}

bool check(int d)
{
    worst.clear();
    for (int i = 0; i<n; i++) worst.insert(mp(depth[i], i));
    deleted.clear(); deleted.resize(n);
    deleting.clear(); deleting.resize(n);

    int cnt = 0;
    while (!worst.empty())
    {
        cnt++;
        //cout<<"Iter "<<cnt<<": "<<endl;

        //for (auto it: worst) cout<<it.first<<' '<<it.second<<endl;

        auto it = *prev(worst.end());
        if (it.first<=d)
        {
            return (cnt<=k);
        }

        int deleting = it.second;
        for (int i = 0; i<d; i++) deleting = parent[deleting];
        //cout<<"Deleting: "<<deleting<<endl;
        del(deleting, d);
    }
    if (worst.empty()) return (cnt<=k);
}

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

    cin>>n>>k;

    G.resize(n);
    for (int i = 0; i<n-1; i++)
    {
        int u, v; cin>>u>>v; u--; v--;
        G[u].push_back(v); G[v].push_back(u);
    }

    parent.resize(n); depth.resize(n); children.resize(n);

    parent[0] = -1;
    dfs(0);

    int L = 0; int R = n;
    while (R-L>1)
    {
        int mid = (L+R)/2;
        if (check(mid)) R = mid; else L = mid;
    }

    cout<<R<<endl;

}


#include <bits/stdc++.h>
/*#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>*/
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=2e5+10;
const int mod=998244353;
const int inf=0x3f3f3f3f;
int n,T,a[maxn],m;
double k[maxn],b[maxn],sumk,sumb;
int main()
{
	cin>>n>>m>>T;
	int cnt=1;
	int jb=T;
	while(T--)
	{
		int y;
		cin>>y;
		a[y]=1;
		if(a[y-1]==1)
			cnt++;
		else
		{
			if(cnt>=m)
			{
				printf("-1");
				return 0;
			}
			cnt=1;
		}
	}
	if(cnt>=m&&jb!=0)
	{
		printf("-1");
		return 0;
	}
	for(int i=n-1;i>=0;i--)
	{
		sumk=sumk+k[i+1]-k[i+m+1];
		sumb=sumb-b[i+m+1]+b[i+1];
		if(a[i]==1)
		{
			k[i]=1;
			continue;
		}
		k[i]=sumk;
		b[i]=sumb;
		b[i]/=(double)m;
		k[i]/=(double)m;
		b[i]++;
	//	printf("%d %lf %lf\n",i,k[i],b[i]);
	}
	if(k[0]==1)
		printf("-1");
	else
		printf("%.4lf",(-b[0])/(k[0]-1));
	return 0;
}

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

//#define FILE
#define int long long
#define debug(x) cout << #x << " = " << x << endl
#define file(FILENAME) freopen(FILENAME".in", "r", stdin), freopen(FILENAME".out", "w", stdout)
#define LINE() cout << "LINE = " << __LINE__ << endl
#define LL long long
#define ull unsigned long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fst first
#define scd second
#define inv(x) qpow((x),mod - 2)
#define lowbit(x) ((x) & (-(x)))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define randint(l, r) (rand() % ((r) - (l) + 1) + (l))
#define vec vector

const int MAXN = 510;
const int INF = 2e11;
const double PI = acos(-1);
const double eps = 1e-6;
//const int mod = 1e9 + 7;
//const int mod = 998244353;
//const int G = 3;
//const int base = 131;

int n, m;
int c[MAXN][MAXN], tmp[MAXN][MAXN];
int a[MAXN], b[MAXN], sum;

template<typename T> inline bool read(T &a) {
	a = 0; char c = getchar(); int f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') {a = a * 10 + (c ^ 48); c = getchar();}
	a *= f;
	return 1;
}

template<typename A, typename ...B>
inline bool read(A &x, B &...y) {return read(x) && read(y...);}

signed main () {
#ifdef FILE
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	read(n);
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			read(c[i][j]);
	b[1] = c[1][1];
	for(int i = 2; i <= n; ++i)
		b[i] = b[i - 1] + c[1][i] - c[1][i - 1];
	for(int i = 1; i <= n; ++i)
		a[i] = c[i][i] - b[i];
	sum = INF;
	for(int i = 1; i <= n; ++i) sum = min(sum, b[i]);
	for(int i = 1; i <= n; ++i) {
		a[i] += sum, b[i] -= sum;
		if(a[i] < 0 || b[i] < 0) return puts("No"), 0;
	}
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			if(a[i] + b[j] != c[i][j]) return puts("No"), 0;
	puts("Yes");
	for(int i = 1; i <= n; ++i) cout << a[i] << ' ';
	cout << endl;
	for(int i = 1; i <= n; ++i) cout << b[i] << ' ';
	cout << endl;
	return 0;
}