#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pr;
typedef vector<int> vec;
typedef long long int lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define TEST int T; cin >> T; while(T--)

#define rep(i,n) for (auto i = 0; i < n; ++i)
#define repk(i,k,n) for (auto i = k; i < n; ++i)
#define repr(i,k,n) for (auto i = k; i >= n; --i)

void solve() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a>b) cout << "Takahashi" << endl;
    else if(a<b) cout << "Aoki" << endl;
    else {
        if(c == 0) cout << "Aoki" << endl;
        else cout << "Takahashi" << endl;
    }
}

int main() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // TEST {
        solve();
    // }
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=1e18;

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

  int N,M;
  cin>>N>>M;
  vector<int> A(M),B(M);
  vector<ll> C(M);
  rep(i,M){
    cin>>A[i]>>B[i]>>C[i];
    A[i]--;B[i]--;
  }

  vector<vector<pair<int,ll>>> g(N);
  rep(i,M) g[A[i]].push_back(mkp(B[i],C[i]));

  vector<ll> ans(N,-1);
  for(int st=0;st<N;st++){
    vector<ll> dist(N,INF);
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> PQ;
    for(auto e:g[st]){
      int nex=e.first;
      ll neco=e.second;
      if(dist[nex]>neco){
        dist[nex]=neco;
        PQ.push(mkp(neco,nex));
      }
    }

    while(!PQ.empty()){
      auto f=PQ.top();
      PQ.pop();

      int now=f.second;
      ll cost=f.first;
      if(dist[now]<cost) continue;
      for(auto e:g[now]){
        int nex=e.first;
        ll neco=e.second;
        if(dist[nex]>dist[now]+neco){
          dist[nex]=dist[now]+neco;
          PQ.push(mkp(dist[nex],nex));
        }
      }
    }
    if(dist[st]!=INF) ans[st]=dist[st];
  }

  for(auto d:ans) cout<<d<<"\n";

  return 0;
}


/*
このコード、と～おれ!
Be accepted!
∧＿∧
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
#include <array>
#include <chrono>

//#pragma GCC target("arch=skylake-avx512")
#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)
#define printLdb(a) printf("%.50Lf\n", a)
#define printdbd(a) printf("%.16lf\n", a)
#define prints(s) printf("%s\n", s.c_str())
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d))

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

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

//cpp_int
#if __has_include(<boost/multiprecision/cpp_int.hpp>)
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace boost::multiprecision;
#else
using cpp_int = ll;
#endif

//atcoder library
#if __has_include(<atcoder/all>)
#include <atcoder/all>
//using namespace atcoder;
#endif

/*
	random_device seed_gen;
	mt19937 engine(seed_gen());
	uniform_int_distribution dist(1, 100);
*/

/*----------------------------------------------------------------------------------*/

int main() {

	int v, t, s, d;
	scanf("%d%d%d%d", &v, &t, &s, &d);
	printyn(d < t * v or v * s < d);

	Please AC;
}

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

typedef long long ll;
typedef pair<ll, ll> pll;
const ll mod=1000000007;
const char nl='\n';

void solve(){
    ll i,j,k,l,n,r,m,u,v,x,y;
	cin>>n>>x>>y>>k;

	if(x>y) swap(x,y);
	cout<< ((k>=n*x and k<=n*y)?"No":"Yes")<<nl;

}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t = 1,i=1;
	// cin >> t;
    while (t--)
    {
		// cout<<"Case #"<< i++ <<": ";
        solve();
    }
    return 0;
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int t;
  cin >> t;
  while (t--) {
    ll n;
    cin >> n;
    n %= 4;
    if (n == 1 || n == 3) {
      cout << "Odd" << endl;
    } else if (n == 2) {
      cout << "Same" << endl;
    } else {
      cout << "Even" << endl;
    }
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
const ll MM = 1000000007;
const ll INF = 1e18;
const long double PI = acos(-1.0);
//------------------------------------------//

int main(){
    int M,H;cin >> M >> H;
    if(H%M==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


#line 1 "Contests/AtCoder_abc200/abc200_b/main.cpp"
using namespace std;
#line 2 "library/bits/stdc++.h"

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#line 3 "Contests/AtCoder_abc200/abc200_b/main.cpp"

#define ll long long

void solve(){
    // write your solution here.
}

int main() {
    ll N;
    int K;
    cin >> N >> K;
    for(int i=0; i<K; i++){
        if(N%200==0)    N/=200;
        else{
            N=N*1000+200;
        }
    }
    cout << N << endl;
    return 0;
}

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

int main() {
    double a, b, c;
    cin >> a >> b;
    cout << (1 - (b / a)) * 100 << endl;
}


#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 1010
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

LL T,n,s,k,i,j,x,Ans;

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}

IL LL read(){
	LL p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

IL LL Gcd(LL a,LL b){return (!b)?a:Gcd(b,a%b);}

IL void Ex_gcd(LL a,LL b,LL &x,LL &y){
	LL p=0,q=0;
	if (b==0) {
		x=1;	y=0;	return;
	}	else {
		Ex_gcd(b,a%b,p,q);
		x=q;	y=p-a/b*q;
	}
}

IL LL Inv(LL a,LL p){
	LL x=0,y=0;
	Ex_gcd(a,p,x,y);
	return x;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	T=read();
	while (T--){
		n=read();	s=read();	k=read();
		s=n-s;
		if (!s)	{
			puts("0");
			continue;
		}
		if (s%Gcd(k,n)){
			puts("-1");
			continue;
		}
		x=Gcd(k,n);
		k/=x;	n/=x;	s/=x;
		x=Inv(k,n)%n;
		Ans=(x*s)%n;
		Ans%=n;
		while (Ans<0)	Ans+=n;
		cout<<Ans<<endl;
	}
	return 0;
}

#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  ll n = 0;
  if( B >= C*D ) n = -1;
  else{
    double m = C*D - B;
    double r = A / m;
    n = ceil(r);
  }
  cout << n;
  return 0;
}


#include <iostream>
#include<string>
using namespace std;
int main()
{
	int a;
	cin >> a;
	if (a % 2 == 1)cout << "Black"<<endl;
	else cout << "White" << endl;
}

#include <bits/stdc++.h>
using namespace std;
//関数定義

int main() {
//ここに中身
  string S;
  cin >> S;
  char x = S.at(0);
  S.at(0) = S.at(1);
  S.at(1) = S.at(2);
  S.at(2) = x;
  cout << S;
}


#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep3(i, a, b) for (ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define nl '\n'
#define endl '\n'
#define all(c) begin(c), end(c)
#define ok() puts(ok ? "Yes" : "No");
#define pcnt(x) __builtin_popcountll(x)
#define df(x) ll x = in();
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vs = vector<string>;
using P = pair<ll, ll>;
using gt = greater<P>;
using minq = priority_queue<P, vector<P>, gt>;
using vP = vector<P>;
inline ll in() {
  ll x;
  scanf("%lld", &x);
  return x;
}
template <class T> void takeUnique(vector<T> &v) {
  auto last = std::unique(v.begin(), v.end());
  v.erase(last, v.end());
}
template <class T> void print(const initializer_list<T> &il) {
  for (auto x : il) {
    cout << x << " ";
  }
  cout << "\n";
}
inline void priv(vll a) {
  rep(i, (int)a.size() - 1) cout << a[i] << " ";
  cout << a.back() << nl;
}
inline void priv(vi a) {
  rep(i, (int)a.size() - 1) cout << a[i] << " ";
  cout << a.back() << nl;
}
const ll LINF = 8e18L + 1;
const int INF = 8e9 + 1;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int dxx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dyy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// g++ -std=c++17 -stdlib=libc++
#define _GLIBCXX_DEBUG
// This slows down the execution; even the time complexity, since it checks if
// std funcs such as lower_bound meets prereqs

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(16);
  int n;
  cin >> n;
  vi a(n);
  vi b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  int mx = 0;
  int mn = INF;
  rep(i, n) chmax(mx, a[i]);
  rep(i, n) chmin(mn, b[i]);
  cout << max(0, mn - mx + 1) << nl;
  return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int &i: a) cin >> i;
    for (int &i: b) cin >> i;

    int ans = 0;
    for (int i = 1; i <= 1000; i++) {
        int ok = 1;
        for (int x = 0; x < n; x++) {
            ok &= (i >= a[x] && i <= b[x]);
        }
        ans += ok;
    }

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

int main() {
    FASTIO;
    PRECISION;

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

    for (int i = 1; i <= t; i++) {
        solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int main()
{
    int n;
    cin>>n;
    string aa,ab,ba,bb;
    cin>>aa>>ab>>ba>>bb;
    int ans=1;
    for(int i=0;i<n-3;i++) ans=ans*2%mod;
    if((ab=="A"&&aa=="B"&&ba=="B")||(ab=="B"&&bb=="A"&&ba=="A"))
        cout<<ans<<'\n';
    else if((ab=="A"&&aa=="B")||(ab=="B"&&bb=="A"))
    {
        int dp1=1,dp2=0;
        for(int i=2;i<=n;i++)
        {
            int sv=dp1;
            dp1=(dp2+dp1)%mod;
            dp2=sv;
        }
        cout<<dp2<<'\n';
    }
    else cout<<1<<'\n';
}

#include <bits/stdc++.h>

#define fileio                                                  \
    freopen("C:\\Users\\PRISM17\\Desktop\\in.txt", "r", stdin); \
    freopen("C:\\Users\\PRISM17\\Desktop\\out.txt", "w", stdout);
#define fastio                   \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define dbg(x) cout << #x << " : " << x << endl;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)

#define mid (st[id].l + st[id].r >> 1)
#define lson (id << 1)
#define rson (id << 1 | 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const int inf = 0x3f3f3f3f;
const int INF = 1e9;
const ll mod = 1e9 + 7;

string s[2][2];
set<string> st;
int n;
void dfs(string str) {
    if (str.length() == n) {
        st.insert(str);
        return;
    }
    int len = str.length();
    for (int i = 1; i < len; i++) {
       string nstr = str;
       nstr.insert(i, s[str[i - 1] - 'A'][str[i] - 'A']);
       dfs(nstr);
    }
}
void table() {
    for (int aa = 0; aa <= 1; aa++) {
        for (int bb = 0; bb <= 1; bb++) {
            for (int ab = 0; ab <= 1; ab++) {
                for (int ba = 0; ba <= 1; ba++) {
                    s[0][0] = string(1, 'A' + aa); s[1][1] = string(1, 'A' + bb);
                    s[0][1] = string(1, 'A' + ab); s[1][0] = string(1, 'A' + ba);
                    cout << endl << s[0][0] << s[0][1] << s[1][0] << s[1][1] << ' ';
                    for (int i = 3; i <= 10; i++) {
                        n = i;
                        st.clear();
                        dfs("AB");
                        cout << st.size() << ' ';
                    }
                }
            }
        }
    }
}
int main() {
//    table();
    cin >> n;
    string str(4, ' ');
    for (int i = 0; i < 4; i++) cin >> str[i];
    auto solve = [&](int n, string& pat) -> int {
        vector<int> pow(n + 1, 1), fib(n + 1, 1);
        for (int i = 4; i <= n; i++) {
            pow[i] = pow[i - 1] * 2 % mod;
            fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
        }
        if (pat[0] == 'A' && pat[1] == 'A') return 1;
        if (pat[1] == 'B' && pat[3] == 'B') return 1;
        if (pat == "ABAA" || pat == "BABA" || pat == "BBAA" || pat == "BABB") return pow[n];
        else return fib[n];
    };
    cout << solve(n, str) << endl;
}


#include <bits/stdc++.h>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int h, w;
    int min_n = 100000;
    int ans = 0;
    cin >> h >> w;
    vector<int> a(h*w);
    rep(i, h*w){
        cin >> a[i];
        min_n = min(min_n, a[i]);
    }
    rep(i, h*w){
        ans+=a[i]-min_n;
    }
    cout << ans << endl;
    return 0;
}

#pragma region template
// clang-format off

#if __has_include(<src.hpp>)
#include <src.hpp>  // precompiled header
#endif

#ifdef __INTELLISENSE__
#define NDEBUG
namespace std {
#endif

#include <cassert>
#include <cctype>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#ifdef __INTELLISENSE__
  using namespace std;
}
#endif

#ifdef LOCAL_DEBUG
#include <debugger.hpp>  // https://gist.github.com/naskya/d28b74e1df8816740c6fcbf0c66c5693
#define see(...) debugger::print(#__VA_ARGS__, __VA_ARGS__)
#define here(label) debugger::output << "[Debug] " << #label << (std::string(#label).size() ? " | " : "") << "line " << __LINE__ << " (" << __func__ << ")\n"
#define com(msg) debugger::output << "[Debug] " << msg << "\n"
#define local(x) do{x} while(0)
#define alter(x, y) x
#else
#define see(...) (static_cast<void>(0))
#define here(label) (static_cast<void>(0))
#define com(msg) (static_cast<void>(0))
#define local(x) (static_cast<void>(0))
#define alter(x, y) y
#endif

#if (!defined LOCAL_DEBUG) || (defined NOWARN)
#define warn(msg) (static_cast<void>(0))
#else
#define warn(msg) debugger::output << "[Warning] " << msg << "\n          \033[0;35m#define NOWARN\033[0m to suppress this warning.\n"
#endif

#if (defined LOCAL_DEBUG) || (defined LOCAL_NDEBUG) || (defined __INTELLISENSE__)
#define NOEXCEPT
#define M_assert(expr) assert(expr)
#define O_assert(expr) assert(expr)
#else
#define NOEXCEPT noexcept
#define M_assert(expr) do{if(__builtin_expect(!(expr), 0)) {long long *p = (long long*) std::malloc(1 << 30); for (int i = 0; i < static_cast<int>((1 << 30) / sizeof(long long)); p[i] = 1, i += (1 << 9)); std::fprintf(stderr, "%lld", *p);}} while(0)
#define O_assert(expr) do{if(__builtin_expect(!(expr), 0)) for(int i = 0; i < (1 << 24); i++) std::puts("Hello, world!");} while(0)
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rng(i, f, t, s) for (int i = (f); ((s) > 0) ? (i < (int)(t)) : (i > (int)(t)); i += (s))
#define erng(i, f, t, s) for (int i = (f); ((s) > 0) ? (i <= (int)(t)) : (i >= (int)(t)); i += (s))

[[maybe_unused]] constexpr int       INF   = 1000000005;
[[maybe_unused]] constexpr long long LINF  = 1000000000000000005LL;
[[maybe_unused]] constexpr double    EPS   = 1e-9;
[[maybe_unused]] constexpr int       dy[8] = {1, 0, -1, 0, 1, 1, -1, -1};
[[maybe_unused]] constexpr int       dx[8] = {0, 1, 0, -1, -1, 1, 1, -1};

template <class S, class T, class... U, class V = std::common_type_t<S, T, U...>> constexpr V Min(S a, T b, U... c) {
  if constexpr (sizeof...(U) > 0) return std::min((V) a, (V) Min(b, c...)); else return std::min((V) a, (V) b);
}
template <class S, class T, class... U, class V = std::common_type_t<S, T, U...>> constexpr V Max(S a, T b, U... c) {
  if constexpr (sizeof...(U) > 0) return std::max((V) a, (V) Max(b, c...)); else return std::max((V) a, (V) b);
}

// clang-format on
#pragma endregion

void solve(long long H, long long W, std::vector<std::vector<long long>> A) {
  int ans = 0;
  int min = INF;
  rep(i, H) {
    rep(j, W) {
      min = Min(min, A[i][j]);
    }
  }
  rep(i, H) {
    rep(j, W) {
      ans += A[i][j] - min;
    }
  }
  std::cout << ans << "\n";
}

int main() {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
  long long H;
  std::scanf("%lld", &H);
  long long W;
  std::scanf("%lld", &W);
  std::vector<std::vector<long long>> A(H, std::vector<long long>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      std::scanf("%lld", &A[i][j]);
    }
  }
#pragma GCC diagnostic pop
  solve(H, W, std::move(A));
}


#include<cstdio>
#define N 100002
int n, pri[N], bz[N], ans[N], tot;
int main(){
	scanf("%d", &n);
	for (int i = 2; i <= n; i ++){
		if (!bz[i]){
			pri[++ tot] = i;
			ans[i] = 1;
		}
		for (int j = 1; j <= tot && i * pri[j] <= n; j ++){
			bz[i * pri[j]] = 1;
			ans[i * pri[j]] = ans[i] + 1;
			if (i % pri[j] == 0) break;
		}
	}
	for (int i = 1; i <= n; i ++) printf("%d ", ans[i] + 1);
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
	/*freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);*/
	int n;
	cin >> n;
	int curr = 1;
	for (int i = 1; i <= n; i++) {
		if (i == (1 << curr)) {
			curr++;
		}
		cout << curr << ' ';
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,sn;
    cin >> n >> sn;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n);
    map<ll,ll> day;
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--,b[i]--;
        day[a[i]]++,day[b[i]]++;
      day[b[i]+1]++;
    }
    ll si = day.size();
    map<ll,ll> dtoi;
    ll nowc = 0;
    for(auto i:day){
        dtoi[i.first] = nowc;
        nowc++;
    }
    vector<ll> itod;
    for(auto i:day){
        itod.push_back(i.first);
    }
    itod.push_back(itod[itod.size() - 1] + 1);

    vector<ll> sum(si+1,0);
    for(int i = 0;i < n;i++){
        ll ait = dtoi[a[i]];
        ll bit = dtoi[b[i]];
        sum[ait] += c[i],sum[bit + 1] -= c[i];
    }
//cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << " " << sum[4] << endl;

    for(int i = 1;i < si;i++)sum[i] += sum[i - 1];
    //cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << " " << sum[4] << endl;

    ll res = 0;
    for(int i = 0;i < si;i++){
        res += min(sn,sum[i]) * (itod[i + 1] - itod[i]);
    }
  //cout << itod[0] << " "<< itod[1] << " " << itod[2] << " " << itod[3] << " " << itod[4] << endl;
    cout << res << endl;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#define ll long long
#define MAXN 200005
#define uns unsigned
#define INF 0x3f3f3f3f
using namespace std;
inline ll read(){
	ll x=0;bool f=1;char s=getchar();
	while((s<'0'||s>'9')&&s>0){if(s=='-')f^=1;s=getchar();}
	while(s>='0'&&s<='9')x=(x<<1)+(x<<3)+s-'0',s=getchar();
	return f?x:-x;
}
int n,m,q,sr[55];
ll w[55],v[55],x[55];
bool vis[55];
inline bool cmp(int a,int b){
	return v[a]>v[b];
}
int main()
{
	n=read(),m=read(),q=read();
	for(int i=1;i<=n;i++)w[i]=read(),v[i]=read(),sr[i]=i;
	for(int i=1;i<=m;i++)x[i]=read();
	sort(sr+1,sr+1+n,cmp);
	while(q--){
		int l=read(),r=read();
		ll ans=0;
		for(int i=1;i<=m;i++)vis[i]=0;
		for(int i=1;i<=n;i++){
			int u=sr[i],y=0;
			for(int j=1;j<=m;j++){
				if(j>=l&&j<=r)continue;
				if(!vis[j]&&x[j]>=w[u]){
					if(!y)y=j;
					else if(x[j]<x[y])y=j;
				}
			}
			if(y)vis[y]=1,ans+=v[u];
		}
		printf("%lld\n",ans);
	}
	return 0;
}


#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stdio.h>
//end of libraries
#define lnf 3999999999999999999
#define inf 999999999
#define PI 3.14159265359
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define mkp(a,b) make_pair(a,b)
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define rsz(a,n) a.resize(n)
#define pii pair <int,int>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define drep(i,n) for(int i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(int i = x ; i < n ; i++)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

const int max_n = 300000;

using namespace std;
int n;

ll d[20] , f[20] , cnt[20];

bool game(vector <int> a,vector<int> b){
	crep(i,1,10) {d[i]=0;f[i]=0;}

	rep(i,sz(a)) {
		d[a[i]]++;
	}
	rep(i,sz(b)){
		f[b[i]]++;
	}

	int c1=0,c2=0;

	crep(i,1,10) {
		c1 += pow(10,d[i]) * i;
		c2 += pow(10,f[i]) * i;
	}

	if(c1>c2) return 1;
	return 0;

}

vector <int> a , b;

void read(){
	string s1,s2;
	cin >> s1 >> s2;
	rep(i,sz(s1)-1) {
		a.pb(s1[i]-'0');
	}
	rep(i,sz(s2)-1){
		b.pb(s2[i]-'0');
	}
}

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

	crep(x,1,10) {
		int d=0;
		rep(i,sz(a)) if(a[i]==x)d++;
		rep(i,sz(b)) if(b[i]==x)d++;

		cnt[x]=(n-d);

	}

	ll e=0,t=0;

	crep(x,1,10) {
		crep(y,1,10) {
			if(x==y and cnt[x] < 2) continue;
			a.pb(x);b.pb(y);
			bool g = game(a,b);
			a.pop_back();b.pop_back();
			if(g==1) {
				e+=(cnt[x]*(cnt[y]-(x==y)));
			}
			t+= (cnt[x]*(cnt[y]-(x==y)));
		}
	}

	long double e1 = e;
	long double t1 = t;
	cout << fixed<<setprecision(11);
	cout << e1/t1 << "\n";

/*
*/

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
static const ll INF=1000000000000000;
ll K;
ll sum0[10];
ll sum1[10];
ll Sum0[10];
ll Sum1[10];
string S,T;
int main(){
  cin>>K>>S>>T;
  for(ll i=0;i<4;i++){
  ll x=S[i]-'0';sum0[x]++;
  }for(ll i=0;i<4;i++){
  ll x=T[i]-'0';sum1[x]++;
  }ld ans=0;
  for(ll i=1;i<=9;i++)
    for(ll j=1;j<=9;j++){
    for(ll k=0;k<10;k++){
    Sum0[k]=sum0[k];Sum1[k]=sum1[k];
    }Sum0[i]++;Sum1[j]++;ll x0=0;ll x1=0;
      for(ll k=1;k<10;k++){
      x0+=k*pow(10,Sum0[k]);
        x1+=k*pow(10,Sum1[k]);
      }
    if(x1<x0){
      ld X=(9*K-8)*(9*K-9);
    if(i==j){
    ld Y=(K-sum0[i]-sum1[i])*(K-sum0[i]-sum1[i]-1);
      ans+=Y/X;

    }else{
    ld Y=(K-sum0[i]-sum1[i])*(K-sum0[j]-sum1[j]);
      ans+=Y/X;
    }
    }
    }cout<<fixed<<setprecision(10)<<ans<<endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main () {
    int N, X;
    cin >> N >> X;
    int t = 0;
    for (int i = 0; i < N; i++) {
        int v, p;
        cin >> v >> p;
        t += v * p;
        if (t > X * 100) {
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all> // g++ main.cpp -std=c++17 -I .
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
using ll=long long;

const int inf = INT_MAX / 2; const ll INF = 1LL << 60;
const ll MOD = 1000000007;
// const int MOD = 998244353;

// cout << fixed << setprecision(15) << ans << endl;
// using mint = modint1000000007;

////////////////////////////////////////////////////////////////////////////////////////////

int main() {
  ll n,k;cin>>n>>k;
  if(k<0) k = -k;
  vector<ll> v(2*n-1);
  rep(i, n) {
    v[i] = v[2*n-2-i] = i+1;
  }
  ll ans = 0;
  for(int i = 0; i+k <= 2*n-2; i++) {
    ans += v[i]*v[i+k];
  }
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define ll long long
#define print_mat(i,j,a,b,v) for(int i=0;i<a;i++){for(int j=0;j<b;j++)cerr<<v[i][j] << " "; cerr<<endl;}
#define sz(v)  (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pi pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vpi vector<pi>
#define pq priority_queue<int>
#define pqg priority_queue<int, vi, greater<int> >
#define fs first
#define sd second
#define pb push_back
#define eb emplace_back

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)
///////////////////////////////////////
// READING
template<class A> void read(vector<A>& v);
template<class A, size_t S> void read(array<A, S>& a);
template<class T> void read(T& x) {
	cin >> x;
}
void read(double& d) {
	string t;
	read(t);
	d=stod(t);
}
void read(long double& d) {
	string t;
	read(t);
	d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
	read(h);
	read(t...);
}
template<class A> void read(vector<A>& x) {
	EACH(a, x)
		read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
	EACH(a, x)
		read(a);
}
////////////////////////////////
// PRINTING
string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vector<bool> v) {
	string res;
	FOR(sz(v))
		res+=char('0'+v[i]);
	return res;
}

template<size_t S> string to_string(bitset<S> b) {
	string res;
	FOR(S)
		res+=char('0'+b[i]);
	return res;
}
template<class T> string to_string(T v) {
    bool f=1;
    string res;
    EACH(x, v) {
		if(!f)
			res+=' ';
		f=0;
		res+=to_string(x);
	}
    return res;
}

template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) {
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) {
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);
}
////////////////////////////////
// START PROGRAM
///////////////////////////////

void solve(){
    int a,b,c;
    read(a,b,c);

    if(a*a + b*b < c*c)
        print("Yes");
    else
        print("No");

}

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

    //int t;
    //read(t);
    //FOR(t){
        //write("Case #", i+1, ": ");
        //solve();
    //}

    solve();

    return 0;
}

#include<bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <chrono>
#include <complex>
using namespace std;
#define ll long long
#define ld long double
#define ui unsigned int
#define ull unsigned ll
#define mp                   make_pair
#define eb                   emplace_back
#define pb                   push_back
#define pf                   push_front
#define popb                 pop_back
#define popf                 pop_front
#define hashmap              unordered_map
#define hashset              unordered_set
#define lb                   lower_bound
#define ub                   upper_bound
#define all(a)               (a).begin(), (a).end()
#define rall(a)              (a).rbegin(), (a).rend()
#define ff                   first
#define ss                   second
#define foi(n) for(ll i=0;i<n;i++)
#define foj(n) for(ll j=0;j<n;j++)
#define fok(n) for(ll k=0;k<n;k++)
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define forrr(i,b,a) for(ll i=b;i>=a;i--)
#define forrrr(i,a,b,k) for(ll i=a;i<b;i=i+k)
#define graph          vector<vector<int>>
#define sz(v) v.size()
typedef pair<int, int> pii;
typedef pair<ll, ll>   pll;
typedef vector<int>         vi;
typedef vector<ll>          vll;
typedef vector<string>      vs;
typedef vector<double>      vd;
typedef vector<pii>         vpii;
typedef vector<pll>         vpll;
typedef pair< ll, pll>      plll;
typedef vector<plll>      vplll;
typedef  vector<string> 	     vs;
typedef  vector<char>	         vc;
typedef  vector<bool>            vb;
typedef  map<string, int>         msi;
typedef  map<int, int>	         mii;
typedef  map<ll, ll>             mll;
typedef  map<char, int>           mci;
typedef  map<int, string>	     mis;
typedef  pair<string, int>       psi;
typedef  pair<string, string>    pss;
typedef priority_queue <ll> pq;
typedef priority_queue<pii, vector<pii>, greater<pii> > pqq;
const ll MOD = 1000000007;
void solve();
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("error1.txt", "w", stderr);
	freopen("output1.txt", "w", stdout);
#endif

//	ll t ; cin >> t;
//	while (t--)
	{
		solve();
		cout << "\n";
	}

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
	return 0;
}
ll ceils(ll x, ll y) {
	return x / y + ((x % y) != 0);
}
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;

}
void solve() {
	ll t, n;
	cin >> t >> n;

	vll ans;
	for (ll i = 1; i <= 100; ++i) {
		ll a = (100 + t) * (i - 1) / 100;
		ll b = (100 + t) * i / 100;
		if (b - a == 2)
			ans.pb(a + 1);
	}
	n--;
	cout << (100 + t) * (n / t) + ans[n % t];

}


// 2021-03-28 11:22:37
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

// clang-format on
const int MX = 1010, inf = 1e9;
bool A[MX][MX];
int dist[MX][MX];
vector<int> G[MX][26];
using T = tuple<int, int, int>;
void answer() {
  int n, m;
  cin >> n >> m;
  rep(i, m) {
    int a, b, c;
    char c_;
    cin >> a >> b >> c_;
    a--;
    b--;
    c = c_ - 'a';
    A[a][b] = A[b][a] = true;
    G[a][c].push_back(b);
    G[b][c].push_back(a);
  }
  rep(i, n) rep(j, n) dist[i][j] = inf;
  dist[0][n - 1] = 0;
  int ans = inf;
  queue<T> que;
  que.emplace(0, n - 1, 0);
  while (!que.empty()) {
    auto [x, y, cost] = que.front();
    que.pop();
    if (dist[x][y] < cost) continue;
    if (x == y) {
      chmin(ans, cost * 2);
      continue;
    }
    if (A[x][y]) {
      chmin(ans, cost * 2 + 1);
      continue;
    }
    rep(z, 26) {
      for (auto x2 : G[x][z]) {
        for (auto y2 : G[y][z]) {
          int u = min(x2, y2);
          int v = max(x2, y2);
          if (dist[u][v] <= cost + 1) continue;
          dist[u][v] = cost + 1;
          que.emplace(u, v, cost + 1);
        }
      }
    }
  }
  if (ans == inf) ans = -1;
  cout << ans << '\n';
}

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

//12252024832524
#include <queue>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#define TT template<typename T>
using namespace std;

typedef long long LL;
const int MAXN = 1005;
int n,m;
int vis[MAXN][MAXN],woc[MAXN][MAXN];

LL Read()
{
	LL x = 0,f = 1;char c = getchar();
	while(c > '9' || c < '0'){if(c == '-')f = -1;c = getchar();}
	while(c >= '0' && c <= '9'){x = (x*10) + (c^48);c = getchar();}
	return x * f;
}
TT void Put1(T x)
{
	if(x > 9) Put1(x/10);
	putchar(x%10^48);
}
TT void Put(T x,char c = -1)
{
	if(x < 0) putchar('-'),x = -x;
	Put1(x); if(c >= 0) putchar(c);
}
TT T Max(T x,T y){return x > y ? x : y;}
TT T Min(T x,T y){return x < y ? x : y;}
TT T Abs(T x){return x < 0 ? -x : x;}

vector<int> E[30][MAXN];
void Add_Edge(int x,int y,int z)
{
    E[z][x].push_back(y);
}
void Add_Double_Edge(int x,int y,int z)
{
    vis[x][y] = vis[y][x] = z;
    Add_Edge(x,y,z);
    Add_Edge(y,x,z);
}
int gc()
{
    char c = getchar();
    while(c > 'z' || c < 'a'){c = getchar();}
    return c - 'a' + 1;
}
struct node
{
    int s,t,dis;
    node(){}
    node(int s1,int t1,int dis1){
        s = s1;
        t = t1;
        dis = dis1;
    }
};

int bfs()
{
    queue<node> q;
    q.push(node(1,n,0));
    woc[1][n] = 1;
    while(!q.empty())
    {
        node w = q.front(); q.pop();
        if(vis[w.s][w.t]) return w.dis * 2 + 1;
        for(int i = 1;i <= 26;++ i)
        {
            for(int j = 0,len1 = E[i][w.s].size();j < len1;++ j)
                for(int k = 0,len2 = E[i][w.t].size();k < len2;++ k)
                {
                    int tox = E[i][w.s][j],toy = E[i][w.t][k];
                    if(!woc[tox][toy])
                    {
                        woc[tox][toy] = 1;
                        if(tox == toy) return w.dis*2+2;
                        q.push(node(tox,toy,w.dis+1));
                    }
                }
        }
    }
    return -1;
}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    n = Read(); m = Read();
    for(int i = 1;i <= m;++ i)
    {
        int u = Read(),v = Read();
        Add_Double_Edge(u,v,gc());
    }
    Put(bfs());
	return 0;
}


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

const int maxn = 1 << 19;

int n, m;
long long dp[maxn]; bool ok[maxn];
int x[110], y[110], z[110];

int main()
{
    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= m; i++)
        scanf ("%d %d %d", x + i, y + i, z + i);
    int upp = 1 << n;
    dp[0] = 1;
    for (int sta = 0; sta < upp; sta++)
    {
        bool f = 1;
        int cnt = __builtin_popcount(sta);
        for (int i = 1; i <= m; i++)
        {
            if (cnt > x[i]) continue;
            int u = 1 << y[i]; u--;
            int v = u & sta;
            int c = __builtin_popcount(v);
            if (c > z[i]) f = 0;
        }
        if (!f) dp[sta] = 0;
        for (int o = 0; o < n; o++) if (!((1 << o) & sta)) dp[sta | (1 << o)] += dp[sta];
    }
    printf ("%lld\n", dp[upp - 1]);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define debug puts("WHAP")
const int N = 101;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    vector<pair<int,int> > a;
    int ans = 0;
    for(int i = 0; i < n; ++i){
    	int t,x,y; cin >> t >> x >> y;
    	x*=2;
    	y*=2;
    	if(t == 1){
    		a.push_back(make_pair(x,y));
    	}
    	else if(t == 2){
    		a.push_back(make_pair(x,y-1));
    	}
    	else if(t == 3){
    		a.push_back(make_pair(x+1, y));
    	}
    	else{
    		a.push_back(make_pair(x+1,y-1));
    	}

    }
    for(int i = 0; i < n; ++i){
    	for(int j = i+1; j < n; ++j){
    		if(a[i].second < a[j].first){
    			continue;
    		}
    		if(a[j].second < a[i].first){
    			continue;
    		}
    		++ans;
    	}
    }
    cout << ans << "\n";

	return 0;
}


#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define ALL(x) x.begin(), x.end()
typedef long long ll;

class dstream : public ostream {};

template <typename T>
dstream &operator<<(dstream &os, T v) {
#ifdef ATCODERDEBUG
  cout << v;
#endif
  return os;
}

ostream &endd(std::ostream &out) {
#ifdef ATCODERDEBUG
  out << std::endl;
#endif
  return out;
}
dstream dout;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[ ";
  for (auto const &x : v) {
    os << x;
    if (&x != &v.back()) {
      os << " : ";
    }
  }
  os << " ]" << endl;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  os << "[" << endl;
  for (auto const &x : v) {
    os << " ";
    print_vec(x);
  }
  os << "]" << endl;
  return os;
}

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {}) {
  if (comp(xmax, x)) {
    xmax = x;
    return true;
  }
  return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {}) {
  if (comp(x, xmin)) {
    xmin = x;
    return true;
  }
  return false;
}

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

  ll N, M, K, a, b, c, d;
  cin >> N >> M;
  vector<pair<ll, ll>> ablist;
  REP(i, M) {
    cin >> a >> b;
    a--;
    b--;
    ablist.push_back(make_pair(a, b));
  }
  cin >> K;
  vector<pair<ll, ll>> cdlist;
  REP(i, K) {
    cin >> c >> d;
    c--;
    d--;
    cdlist.push_back(make_pair(c, d));
  }

  ll ans = 0;
  for (unsigned long i = 0; i < pow(2LL, K); i++) {
    vector<ll> llist(N, 0);
    for (unsigned long j = 0; j < K; j++) {
      ll idx = 0;
      if ((i >> j) & 1)
        idx = cdlist[j].first;
      else
        idx = cdlist[j].second;

      llist[idx]++;
    }
    ll cnt = 0;
    REP(j, M) {
      if (llist[ablist[j].first] > 0 && llist[ablist[j].second] > 0) cnt++;
    }

    dout << cnt << " " << i << "" << llist << endd;
    chmax(ans, cnt);
  }

  // dout << ((2 >> 0) & 1) << endd;
  cout << ans << endl;
  // cout << std::fixed << std::setprecision(15) << sqrt(ans) << endl;
}

#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

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

const long long int mod = 998244353;
const long long int INF = 1e16;
const long double PI=3.14159265358979323;
const long long int pl=1100;
const long double eps =0.0000001;

long long int res=0,N,M,K,A[200200],B[200200],C[200200],D[200200],memo[200200]={};
int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>M;
    for (long long int  i = 0; i < M; i++)
    {
        cin>>A[i]>>B[i];

    }
    cin>>K;
    for (long long int  i = 0; i < K; i++)
    {
        cin>>C[i]>>D[i];

    }
    for (long long int i = 0; i < (1<<K); i++)
    {
        for (long long int j = 0; j <= N; j++)
        {
            memo[j]=0;
        }

        for (long long int j = 0; j < K; j++)
        {
            if((i&(1<<j))==0){
                memo[C[j]]=1;
            }else{
                memo[D[j]]=1;
            }
        }
        long long int tmp=0;
        for (long long int j = 0; j < M; j++)
        {
            if(memo[A[j]]==1&&memo[B[j]]==1){
                tmp++;
            }
        }
        res=max(res,tmp);
    }
    cout<<res<<endl;

}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

constexpr bool typetest = 0;
constexpr int N = 2e5 + 5;
constexpr ll mod = 1e9 + 7;
int n, dp[N][65][2];
vector<pair<int, ll>> adj[N];
ll ans(0);

void Read()
{
    cin >> n;
    for (int i = 2; i <= n; ++i)
    {
        int u, v;
        ll w;
        cin >> u >> v >> w;
        adj[u].emplace_back(v, w);
        adj[v].emplace_back(u, w);
    }
}

#define bit(i, x) (((x) >> (i)) & 1)

void dfs(int v, int par)
{
    for (int j = 0; j < 61; ++j)
    {
        ++dp[v][j][0];
        (ans += (1ll << j) % mod * dp[v][j][1] % mod) %= mod;
    }

    for (auto i : adj[v])
        if (i.first != par)
        {
            for (int j = 0; j < 61; ++j)
            {
                dp[i.first][j][1] += dp[v][j][!bit(j, i.second)];
                dp[i.first][j][0] += dp[v][j][bit(j, i.second)];
            }

            dfs(i.first, v);

            for (int j = 0; j < 61; ++j)
            {
                dp[v][j][1] = dp[i.first][j][!bit(j, i.second)];
                dp[v][j][0] = dp[i.first][j][bit(j, i.second)];
            }
        }
}

void Solve()
{
    dfs(1, 1);
    cout << ans;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t(1);
    if (typetest)
        cin >> t;
    for (int _ = 1; _ <= t; ++_)
    {
        Read();
        Solve();
    }
}

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define all(a) (a).begin(), (a).end()
#define mp make_pair

template<typename T1, typename T2>
inline void chkmin(T1& x, const T2& y) {
    if (y < x) x = y;
}

template<typename T1, typename T2>
inline void chkmax(T1& x, const T2& y) {
    if (x < y) x = y;
}

#define int ll

struct Fenwick{
    vector<int> tree;
    int n;
    Fenwick() {}
    Fenwick(int _n) {
        n = _n;
        tree.assign(n, 0);
    }
    void upd(int pos, int val) {
        for (; pos < n; pos |= pos + 1) {
            tree[pos] += val;
        }
    }
    int get(int r) {
        int ans = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1) {
            ans += tree[r];
        }
        return ans;
    }
    int get(int l, int r) {
        if (l > r) return 0;
        return get(r) - get(l - 1);
    }
};

struct Query{
    int t, x, y;
};

int ans = 0;
Fenwick treeA, treeB, cntA, cntB;

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cout.precision(20), cout.setf(ios::fixed);
    int n, m, q;
    cin >> n >> m >> q;
    vector<Query> queries(q);
    vector<int> coord;
    for (auto &i : queries) {
        cin >> i.t >> i.x >> i.y;
        --i.x;
        coord.push_back(i.y);
    }
    coord.push_back(0);
    sort(all(coord));
    coord.resize(unique(all(coord)) - coord.begin());
    vector<int> a(n + 1, 0);
    vector<int> b(m + 1, 0);
    treeA = Fenwick(coord.size());
    treeB = Fenwick(coord.size());
    cntA = Fenwick(coord.size());
    cntB = Fenwick(coord.size());
    for (int i = 0; i < n; ++i) {
        cntA.upd(0, 1);
    }
    for (int i = 0; i < m; ++i) {
        cntB.upd(0, 1);
    }
    for (auto [t, x, y] : queries) {
        // int posY = lower_bound(all(coord), y) - coord.begin();
        if (t == 1) {
            int posNow = lower_bound(all(coord), a[x]) - coord.begin();
            ans -= cntB.get(posNow) * a[x];
            ans -= treeB.get(posNow + 1, coord.size() - 1);
            treeA.upd(posNow, -a[x]);
            cntA.upd(posNow, -1);
            a[x] = y;
            posNow = lower_bound(all(coord), a[x]) - coord.begin();
            treeA.upd(posNow, a[x]);
            cntA.upd(posNow, 1);
            ans += cntB.get(posNow) * a[x];
            ans += treeB.get(posNow + 1, coord.size() - 1);
        } else {
            int posNow = lower_bound(all(coord), b[x]) - coord.begin();
            ans -= cntA.get(posNow) * b[x];
            ans -= treeA.get(posNow + 1, coord.size() - 1);
            treeB.upd(posNow, -b[x]);
            cntB.upd(posNow, -1);
            b[x] = y;
            posNow = lower_bound(all(coord), b[x]) - coord.begin();
            treeB.upd(posNow, b[x]);
            cntB.upd(posNow, 1);
            ans += cntA.get(posNow) * b[x];
            ans += treeA.get(posNow + 1, coord.size() - 1);
        }
        cout << ans << '\n';
    }
    return 0;
}


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

#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define fo(i,n) for(int i=0;i<n;++i)
#define fn(i,n) for(int i=1;i<=n;++i)
#define Fo(i,k,n) for(int i=k;i<=n;++i)

typedef long long int lli;

int32_t main(){
    FIO
    lli n, m; cin >> n >> m;
    lli l = m * m;
    lli a = 10;
    lli b = 1;
    while(n > 0){
            if(n % 2 > 0) b *= a;
            b %= l;
            a = a * a;
            a %= l;
            n /= 2;
    }
    b /= m;
    cout << b % m << endl;
}

//Don't act like a loser.
//This code is written by huayucaiji
//You can only use the code for studying or finding mistakes
//Or,you'll be punished by Sakyamuni!!!
//#pragma GCC optimize("Ofast","-funroll-loops","-fdelete-null-pointer-checks")
//#pragma GCC target("ssse3","sse3","sse2","sse","avx2","avx")
#include<bits/stdc++.h>
#define int long long
using namespace std;

int read() {
	char ch=getchar();
	int f=1,x=0;
	while(ch<'0'||ch>'9') {
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		x=x*10+ch-'0';
		ch=getchar();
	}
	return f*x;
}

int n,m;

int qpow(int x,int y) {
	int ret=1;
	while(y) {
		if(y&1) {
			ret=ret*x%(m*m);
		}
		x=x*x%(m*m);
		y>>=1;
	}
	return ret;
}

signed main() {
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);

	cin>>n>>m;
	cout<<qpow(10,n)/m<<endl;

	//fclose(stdin);
	//fclose(stdout);
	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 MOD 1000000007
#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()

int main()
{
	double x1,y,z;
	cin>>x1>>y>>z;
	ll ans=((y/x1)*1.0)*z;
	if(ans*x1==y*z)
		cout<<max(ans-1,0LL)<<endl;
	else
		cout<<ans<<endl;
	return 0;
}

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	float X, Y, Z;
	cin >> X >> Y >> Z;
	float a, b;
	a = Y / X;
	b = a * Z;
	if (b - floor(b) == 0)
	{
		cout << floor(b) - 1;

	}
	else
	{
		cout << floor(b);

	}
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define BE(x) x.begin(), x.end()

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

    int ans = 1;
    for (int i = 2; i <= b; i++) {
        if (b/i - (a-1)/i >= 2) ans = i;
    }

    cout << ans << endl;
}

#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

int main(void)
{
    ll s, p, div;

    scanf("%lld%lld", &s, &p);
    for (div = 1; div * div <= p; div++)
    {
        if (p % div == 0 && div + p / div == s)
        {
            printf("Yes\n");
            return (0);
        }
    }
    printf("No\n");

    return (0);
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <set>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

const int N = 1e5 + 10;
set<long long> s;
int st[N];
int primes[N];
int cnt;

void get_primes(int n)
{
    for (int i = 2; i <= n; i ++ ){
        if (!st[i])
            primes[cnt ++] = i;
        for (int j = 0; primes[j] <= n / i; j ++ ){
            st[primes[j] * i] = 1;
            if (i % primes[j] == 0)
                break;
        }
    }
}

int main()
{
    get_primes(100002);
    long long n;
    cin >> n;
    long long res = n;
    long long m = 1e5 + 2;
    //cout << st[2] << endl;
    for (long long i = 2; i <= 1e5 + 2; i ++ ){
            long long t = i * i;
            while (1){
                if (t > n){
                    break;
                }else{
                    s.insert(t);
                    //cout << t << endl;
                }
                t = t * i;
            }

    }
    long long k = s.size();
    cout << res - k << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#ifdef _DEBUG
#define line cout << "-----------------------------\n"
#define stop system("pause")
#endif
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }
template<class T>inline T sum(const vector<T>& a, int l, int r) { return a[r] - (l == 0 ? 0 : a[l - 1]); }
template<class T>inline void END(T s) { print(s); exit(0); }
void END() { exit(0); }

int main() {
    init();

    int n; cin >> n;
    FOR(i, 0, n)print(i * 2 % n + 1, (i * 2 + 1) % n + 1);

    return 0;
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq_max             priority_queue<int>
#define pq_min             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,s,n)        for(int i=s;i<n;i++)
#define all(x)              (x).begin(),(x).end()
#define allr(c)             (c).rbegin(), (c).rend()
#define sz(x) ((int)(x).size())
#define itr_v(v)                 for(int i=0;i<sz(v);i++)
#define itr_str(s)               for(int i=0;i<s.length();i++)
#define endl ("\n")
#define ip(v)               for(auto& i:v)    cin>>i;
#define ip_2d(a)            for(auto &v:a)  for(auto &x:v)  cin>>x;
#define sumv(a) accumulate(all(a),0)
#define yn(x) ((x)?"YES":"NO")
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ci(X)               int X; cin>>X
#define cii(X, Y)           int X, Y; cin>>X>>Y
#define ciii(X, Y, Z)       int X, Y, Z; cin>>X>>Y>>Z
#define ciiii(W, X, Y, Z)   int W, X, Y, Z; cin>>W>>X>>Y>>Z
template <typename T> void out(T t) { cout << t << endl; }

#define dbg(x)              cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y)           cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl;
#define dbg3(x,y,z)         cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w)       cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<" "<<#z<<"="<<(z)<<" "<<#w<<"="<<(w)<<endl;

void io()
{
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

long long binpow(long long val, long long deg, long long m) {
  if (!deg) return 1 % m;
  if (deg & 1) return binpow(val, deg - 1, m) * val % m;
  long long res = binpow(val , deg >> 1, m);
  return (res * res) % m;
}

// int fact[1000010];
// void initfact(int N) {
//   fact[0] = 1;
//   for (int i = 1; i < N; i++) {
//     fact[i] = (fact[i - 1] * i);
//     fact[i] %= mod;
//   }
// }

// long long nCr(int n, int i) {
//   long long res = fact[n];
//   long long div = fact[n - i] * fact[i];
//   div %= mod;  div = binpow(div, mod - 2, mod);
//   return (res * div) % mod;
// }

void print(vi a)
{
  for (int i = 0; i < sz(a); i++)
    cout << a[i] << " ";
  cout << endl;
}

void print_2d(vector<vi> &a)
{
  const int n = sz(a), m = sz(a[0]);
  f(i, 0, n)
  {
    f(j, 0, m)
    {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
}

bool isPrime(int n)
{
  if (n == 1) return false;
  if (n == 2) return true;
  if (n == 3) return true;
  f(i, 2, sqrt(n) + 1) if (n % i == 0) return false;
  return true;
}

void SieveOfEratosthenes(int n)
{
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));

  for (int p = 2; p * p <= n; p++)
  {
    if (prime[p] == true)
    {
      for (int i = p * p; i <= n; i += p)
        prime[i] = false;
    }
  }

  for (int p = 2; p <= n; p++)
    if (prime[p])
      cout << p;
}

void rotate_anti_2d(vector<vi> &a)
{
  const int n = sz(a), m = sz(a[0]);
  vector<vi> b(m, vi(n));
  int i, j;
  f(i, 0, n) f(j, 0, m) b[m - 1 - j][i] = a[i][j];
  a.swap(b);
}

void ap_18()
{
  ci(n);
  vi a(n);
  ip(a);
  mii m;
  for(int i=0;i<n;i++)
  {
    m[a[i]]++;
  }
  int ans=0;
  for(auto it:m)
  {
    ans+=((it.ss)*(n-it.ss));
  }
  out(ans/2);
}
int32_t main()
{
  io();
  ap_18();
  return 0;
}

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define inp(arr, n)                                                            \
  for (ll i = 0; i < (ll)n; i++)                                               \
    cin >> arr[i];
#define fori(i, a, b) for (ll i = a; i < (ll)b; i++)
#define forib(i, a, b) for (ll i = a; i >= (ll)b; i--)
#define printarr(i, n, arr)                                                    \
  for (ll i = 0; i < n; i++)                                                   \
    cout << arr[i] << " ";
#define test(x)                                                                \
  ull x;                                                                       \
  cin >> x;                                                                    \
  while (x--)
const ull mod = 1e9 + 7;
using namespace std;

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

  ull n;
  cin >> n;
  ull arr[n];
  fori(i, 0, n) cin >> arr[i];
  sort(arr, arr + n);
  vector<ll> countArr;
  ll count = 1;
  fori(i, 1, n) {
    if (arr[i] == arr[i - 1])
      count++;
    else {
      countArr.pb(count);
      count = 1;
    }
  }
  countArr.pb(count);
  count = n * (n - 1) / 2;
  for (auto i : countArr) {
    count -= (i * (i - 1) / 2);
  }
  cout << count;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

// a^n (mod.MOD)を求める。計算量はO(logn)
ll modpow(ll a, ll n, ll MOD = mod) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1, MOD))%MOD;
    }
    return (modpow(a, n/2, MOD) * modpow(a, n/2, MOD))%MOD;
}

// nCrをO(r)で求める。
ll Comb(ll n, ll r) {
    if(n < r) {
        return 0;
    }
    if(r > n-r) {
        return Comb(n, n-r);
    }
    ll Mul = 1;
    ll Div = 1;
    rep(i, r) {
        Mul *= (n-i);
        Div *= (i+1);
        Mul %= mod;
        Div %= mod;
    }
    ll res = Mul*modpow(Div, mod-2)%mod;
    return res;
}

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

    ll s = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        s += a;
    }

    out(Comb(n+m, n+s));
    re0;
}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
long double pie = acos(-1) ;
ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T &b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T &b){if(a>b) a = b ;}

// fac:階乗, inv:逆元, finv:階乗の逆元
vector<long long> fac,inv,finv ;

// nまでの配列を用意する
void nCr_set(int n){
    fac = inv = finv = vector<long long>(n+1,1) ;
	for(int i=2;i<=n;i++){
		fac[i] = fac[i-1]*i%mod ;
		inv[i] = mod-inv[mod%i]*(mod/i)%mod ;
		finv[i] = finv[i-1]*inv[i]%mod ;
	}
}

// nCrを計算して返す
ll nCr(int n,int r){
	if(n<0||r<0||n<r) return 0 ;
	if(n==r||r==0) return 1 ;
	return fac.at(n)*finv.at(n-r)%mod*finv.at(r)%mod ;
}

// nHrを計算して返す
ll nHr(int n,int r) {
	return nCr(n+r-1,n-1) ;
}

// Nが巨大なときにnCrをO(r)で計算して返す
ll nCr_big_n(ll n,ll r){
    ll res = 1 ;
    for(ll i=n-r+1;i<=n;i++) res = i%mod*res%mod ;
    return res*finv[r]%mod ;
}

int main(){
    ll n,m ;
    cin >> n >> m ;
    ll sum = 0 ;
    nCr_set(5e6) ;
    for(int i=0;i<n;i++){
        ll a ; cin >> a ;
        sum += a ;
    }
    if(m<sum){
        cout << 0 << endl ;
        return 0 ;
    }
    cout << nCr_big_n(m+n,sum+n) << endl ;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
#define endl '\n'
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    int n;
    cin >> n;
    vector<int> arr(n);
    vector<ll> pref(n), mx(n, -(1LL<<60));
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        if(i > 0){
            pref[i] = pref[i - 1] + 1LL * arr[i];
            mx[i] = max(mx[i - 1], pref[i]);
        }
        else{
            pref[i] = 1LL * arr[i];
            mx[i] = pref[i];
        }
    }
    ll ans = 0;
    ll cur = 0;
    for(int i = 0; i < n; ++i){
        ans = max(ans, cur + mx[i]);
        cur += pref[i];
    }
    cout << ans << endl;

}

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

    solve();
}

#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<ii> vii;
typedef vector<string> vs;
#define deb(x) cout << #x": " << (x) << endl;

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}
lli lcm(lli a, lli b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
int popcount(lli x) { return __builtin_popcountll(x); }

 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 int rnd(int n){return uniform_int_distribution<int>(0, n-1)(rng);}

lli poww(lli a, lli b){
	lli res =1;
	while(b){ if(b&1) res = res * a; a = a*a; b/=2; }
	return res;
}
bool isPrime(lli x){
	if(x==1 or (x%2==0 and x>2))return 0;
	for(lli i = 3; i*i<=x; i+=2)if(x%i==0)return 0;
	return 1;
}
vi sieve(int N){
	vi m(N+1,0);
	vi primes(1,2);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
	return primes;
}
int dx[4]={0,0,1,-1}, dy[4]={1,-1,0,0};
vvi graph(int n, int m, bool dir=1){
	vv(int,v,n+1,0);
	fore(i,0,m){
		int a,b; cin>>a>>b;
		v[a].pb(b);
		if(dir)v[b].pb(a);
	}
	return v;
}
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
// ---- コーディングはここから！ ('-')7

void solve(){
	int n; cin>>n;
	vl v(n); fore(i,0,n)cin>>v[i];
	vl pre(n+1,0); fore(i,0,n)pre[i+1]=pre[i]+v[i];
	lli sum =0;
	lli mx = 0;
	lli m = 0;
	fore(i,0,n){
		m = max(m,pre[i]);
		mx = max(mx,sum+m),sum=sum+pre[i+1];
	}
	mx=max(mx,sum);
	cout<<mx<<ENDL;

}

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


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define w(n) while (n--)
#define scl(n) scanf("%lld", &n)
#define scf(n) scanf("%lf", &n)
#define pfl(x) printf("%lld\n", x)
#define ps printf(" ")
#define INF 10000000
#define pb push_back
#define all(x) (x).begin(), (x).end()

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    float a, b;
    cin >> a >> b;

    cout << (a * b) / 100.0;
}

#define George_Plover
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <algorithm>
#define MAXN 1100000
#define LL long long
using namespace std;
int T;
int L,R;
int main()
{
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d%d",&L,&R);
        if(L+L>R)
        {
            printf("0\n");
            continue;
        }
        printf("%lld\n",(R-L-L+1)*1ll*(R-L-L+2)/2);
    }
    return 0;
}


/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define ld double
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define F(i,a,b) for(i=a;i<b;i++)
//#include <ext/pb_ds/assoc_container.hpp> // policy based data structure header files
//#include <ext/pb_ds/tree_policy.hpp> // policy based data structure header files
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
//using namespace __gnu_pbds; // for pbds
//#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> // have functions like order_of_key, find_by_order
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781641;
const ll M=1e9+7;
const ll MAXN=100200;
ll i,j,mask;
ll mod(ll x)
{
    return (x+M)%M;
}
ll add(ll a,ll b)
{
    return mod(mod(a)+mod(b));
}
ll mul(ll a,ll b)
{
    return mod(mod(a)*mod(b));
}
ll power(ll p,ll x)
{
    ll res=1;
    while(x>0) {
        if(x%2==1) {
            res=mul(res,p);
        }
        x/=2;
        p=mul(p,p);
    }
    return res;
}
void solve()
{
    ll n;
    cin>>n;
    ll sumMinus=0, sumPlus=0;
    vector<ll> v(n);
    F(i,0,n) {
        cin>>v[i];
    }
    if(n==1) {
        cout<<v[0];
    } else {
        sumMinus=add(v[0], -v[1]);
        sumPlus=add(v[0], v[1]);
        ll cntPlus=1;
        ll cntMinus=1;
        F(i,2,n) {
            ll mn=add(sumPlus, mul(-1,mul(v[i], cntPlus)) );
            ll mx=add(sumPlus, mul(cntPlus, v[i]) );
            mx=add(mx, add(sumMinus, mul(cntMinus, v[i]) ));
            sumMinus=mn;
            sumPlus=mx;
            ll tmp=cntPlus;
            cntPlus=add(cntPlus, cntMinus);
            cntMinus=tmp;
            //cout<<sumMinus<<" "<<sumPlus;nl
        }
//        nl
//        cout<<sumMinus<<" "<<sumPlus;nl
        ll ans=add(sumMinus, sumPlus);
        cout<<ans;
    }
}
int main()
{
    IOS
    /*#ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    ll t,test=1;
    //cin>>test;
    F(t,1,test+1) {
        //cout<<"Case #"<<t<<": ";
        solve();
        nl
    }
    return 0;
}

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

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

void solve(){
  int n;cin>>n;
  vector<int> v(n);
  REP(i,n)cin>>v[i];
  vector<int> ans;
  REP(i,n*n){
    if(i&1){
      for(int j=1;j<n-1;j+=2){//j:odd
        if(v[j]>v[j+1]){
          ans.push_back(j+1);
          swap(v[j],v[j+1]);
          j=n;
        }
      }
    }
    else{
      for(int j=0;j<n-1;j+=2){
        if(v[j]>v[j+1]){
          ans.push_back(j+1);
          swap(v[j],v[j+1]);
          j=n;
        }
      }
    }
    if(ans.size()<=i){
      bool ok=1;
      for(int j=0;j<n;j++)ok&=v[j]==j+1;
      if(ok)break;
      if((i&1)^((n-2)&1)){
        ans.push_back(n-2);
        swap(v[n-3],v[n-2]);
      }
      else{
        ans.push_back(n-1);
        swap(v[n-2],v[n-1]);
      }
    }
  }
  cout<<ans.size()<<endl;for(int p:ans)cout<<p<<" ";cout<<endl;
}

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


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long double k=0.6180339887498948482045;
ll x,y,tmp;
vector<int> ans;
int main(){
	scanf("%lld",&tmp);if(tmp==0) {printf("0\n");return 0;}
	//printf("%lf\n",((long double)tmp)*k-50);
	for(ll i=max((ll)(((long double)tmp)*k)-50,0ll);;i++){
		x=tmp;y=i;ans.clear();
		while(x&&y){
			if(x>y) ans.push_back(3),x=x-y;
			else ans.push_back(4),y=y-x;
			if(ans.size()>130) {break;}
		}
		if(ans.size()+max(x,y)<=130){
			if(x) for(int i=1;i<=x;i++) ans.push_back(1);
			else for(int i=1;i<=y;i++) ans.push_back(2);
			printf("%d\n",ans.size());
			for(int i=ans.size()-1;i>=0;i--) printf("%d\n",ans[i]);
			return 0;
		}
	}
	return 0;
}/*
47584759575744849
*/

#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define debug(output) if(debugFlag)cout<<#output<<"= "<<output<<endl
using lint = long long;
typedef pair<int,int> P;
const bool debugFlag=true;
const lint linf=1e18+7;
const lint inf=1e9+7;
const int MOD=1000000007;
signed main(){
  lint n;cin>>n;
  queue<int> que;
  vector<lint> dp={1,1,2};
  while(dp.back()<linf){
    int num=dp.size();
    dp.push_back(dp[num-1]+dp[num-2]);
  }
  lint buf=n;
  int num=0;
  for(int i=dp.size()-1;i>=0;--i){
    while(dp[i]<=buf){
      buf-=dp[i];
      que.push(i);
      num=max(num,i);
    }
  }
  vector<int> res;
  num+=num%2;
  int cnt=num;
  que.push(-inf);
  rep(i,num){
    while(que.front()==cnt){
      if(que.front()==cnt){
        que.pop();
        if(i%2==0)res.push_back(1);
        else res.push_back(2);
      }
    }
    if(i%2==0)res.push_back(4);
    else res.push_back(3);
    --cnt;
  }
  cout<<res.size()<<"\n";
  rep(i,res.size()){
    cout<<res[i]<<"\n";
  }
  return 0;
}


///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           nd(a,b,c)                   mp(mp(a,b),c)
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=2e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ses=min(a,b);
    ses=min(ses,c);
    ses=min(ses,d);
    cout<<ses<<"\n";
    return 0;

}

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+7;

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


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define int long long
#define sz(x) (ll)(x.size())
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

const int mod = 1e9+7;

int expo_pow(int x,int y){
 if(y == 0) return 1;
  y=y%(mod-1);
  x%=mod;
  if(y==0) y=mod-1;
  int res=1;
  while(y){
    if(y&1) res=(res*x)%mod;
    x=(x*x)%mod;
    y>>=1;
  }
  return res;
}

ll add()
{
    return 0;
}

template <typename T, typename... Types>
T add(T var1, Types... var2){
    return (((((ll)(var1)) % mod + (ll)(add(var2...))) % mod) + mod) % mod;
}

ll mul(){
    return 1;
}

template <typename T, typename... Types>
T mul(T var1, Types... var2){
    return (((ll)(var1)) % mod * (ll)(mul(var2...))) % mod;
}

int ncr(int n,int r) {
  if (n < r) return 0;
  int num = n*(n-1);
  return num/2;
}

int n,k;

int get(int x) {
  int ans = 0;
  for (int i = 3; i < x; ++i) {
    for (int msk = 0; msk < 8; ++msk) {
      int cnt = __builtin_popcount(msk);
      if (cnt%2 == 0) ans += ncr(i-3+2 - cnt*(n),2);
      else ans -= ncr(i-3+2 - cnt*(n),2);
    }
  }
  return ans;
}

int ncr2(int n,int r) {
  if (n < r) return 0;
  return n;
}

int get2(int x) {
  int ans = 0;
  for (int i = 0; i < 4; ++i) {
    int cnt = __builtin_popcount(i);
    if(cnt%2 == 0) ans += ncr2(x-2+1-cnt*n,1);
    else ans -= ncr2(x-2+1-cnt*n,1);
  }
  return ans;
}

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

  //cout << get(5) << "\n";

  // find beauty
  int st = 3;
  int end = 3*n;
  int tar_beauty = -1;
  while (end >= st) {
    int mid = (st + end)/2;
    int num_less = get(mid);
    if (num_less < k) {
      tar_beauty = mid;
      st = mid + 1;
    }
    else {
      end = mid - 1;
    }
  }
  int to_sub = get(tar_beauty);
  k -= to_sub;

  int be,ta,pop;
  for (int i = 1; i <= min(n,tar_beauty-2); ++i) {
    int req = tar_beauty - i;
    if (req > 2*n) continue;
    int tmp = get2(req);
    if (k <= tmp) {
      be = i;
      for (int i = 1; i <= n; ++i) {
        int tmp_pop = req - i;
        if (tmp_pop >= 1 and tmp_pop <= n) {
          k--;
        }
        if (k == 0) {
          cout << be << " " << i << " " << tmp_pop << "\n";
          return;
        }
      }
      break;
    }
    k-= tmp;
  }

}

signed main(){
  fast;
  int test = 1;
  int i=1;
  while(test--){
    solve();
  }
}

#include <bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 1000010;

LL f[4][3 * N], n, k;

int main(){
    cin >> n >> k;
    f[0][0] = 1;
    for (int i = 0; i < 3; i ++) {
        for (int j = 0; j <= i * n; j ++){
            f[i + 1][j + 1] += f[i][j];
            f[i + 1][j + n + 1] -= f[i][j];
        }
        for (int j = 1; j <= (i + 1) * n; j ++)
            f[i + 1][j] += f[i + 1][j - 1];
    }
    int it = 3;
    int sum = 3;
    while (k > f[3][it])    k -= f[3][it], sum ++, it ++;
    int a = 1, b, c;
    for (int i = 1; i <= n; i ++) {
        int maxd = min((int)n, sum - i - 1);
        int mind = max(1, (int)(sum - i - n));
        if (mind > maxd)    continue;
        if (k <= maxd - mind + 1)   {
            a = i;
            break;
        }
        k -= (maxd - mind + 1);

    }
    c = min((int)n, sum - a - 1) - (k - 1);
    b = sum - a - c;
    cout << a << ' ' << b << ' ' << c;

    return 0;
}


// Pratiyush Mishra

#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define bs(v, x) binary_search(v.begin(), v.end(), x)
#define mem1(a) memset(a, -1, sizeof(a))
#define popf pop_front
#define p() cout << '\n'
#define p0(x) cout << x << " "
#define p1(x) cout << x << '\n'
#define p2(x, y) cout << x << " " << y << '\n'
#define p3(x, y, z) cout << x << " " << y << " " << z << '\n'
#define printv(v)                   \
  for (ll i = 0; i < v.size(); ++i) \
    cout << v[i] << " ";            \
  cout << '\n'
#define pr1(x) cout << fixed << setprecision(15) << x << '\n'
#define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
#define mod 1000000007
#define mod1 998244353
#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define get(n) \
  ll n;        \
  cin >> n
#define getvec(v, n)         \
  vector<ll> v(n);           \
  for (ll i = 0; i < n; i++) \
    cin >> v[i];
#define getstr(s) \
  string s;       \
  cin >> s
#define all(x) x.begin(), x.end()
#define countBits(x) __builtin_popcount(x)
using namespace std;

//unordered_map < char, vector<pair<int, int>>> e;
vector<vector<pair<int, int>>> e(26);
vector<string> v;
int n, m, sx, sy, gx, gy;
vector<vector<int>> r = {{1, -1, 0, 0} , {0, 0, 1, -1}};
queue<pair<int, int>> q;
vector<int> visx(26);

void mainSolve()
{
  cin >> n >> m;
  for (int i = 0; i < n; i++)
  {
    getstr(s);
    v.pb(s);
    for (int j = 0; j < m; j++)
    {
      if (s[j] >= 'a' && s[j] <= 'z')
        e[s[j] - 'a'].pb({i, j});
      else if (s[j] == 'S')
      {
        sx = i;
        sy = j;
      }
      else if (s[j] == 'G')
      {
        gx = i;
        gy = j;
      }
    }
  }
  q.push({sx, sy});
  vector<vector<bool>> vis(n, vector<bool>(m, false));
  vis[sx][sy] = true;
  vector<vector<int>> dis(n, vector<int>(m, 0));
  while (!q.empty())
  {
    ll cx = q.front().first;
    ll cy = q.front().second;
    q.pop();
    if (v[cx][cy] >= 'a' && v[cx][cy] <= 'z' && !visx[v[cx][cy] - 'a'])
    {
      for (pair<int, int> it : e[v[cx][cy] - 'a'])
      {
        ll nx = it.first;
        ll ny = it.second;
        if (vis[nx][ny])
          continue;
        dis[nx][ny] = dis[cx][cy] + 1;
        vis[nx][ny] = true;
        q.push({nx, ny});
        //p2(nx, ny);
        if (nx == gx && ny == gy)
        {
          p1(dis[nx][ny]);
          return;
        }
      }
      visx[v[cx][cy] - 'a'] = true;
    }
    for (int j = 3; j >= 0; j--)
    {
      ll nx = cx + r[0][j];
      ll ny = cy + r[1][j];
      //p2(nx, ny);
      if (nx >= 0 && nx < n && ny >= 0 && ny < m && !vis[nx][ny] && v[nx][ny] != '#')
      {
        vis[nx][ny] = true;
        dis[nx][ny] = dis[cx][cy] + 1;
        q.push({nx, ny});
        //p2(nx, ny);
        if (nx == gx && ny == gy)
        {
          p1(dis[nx][ny]);
          return;
        }
      }
    }
  }
  p1(-1);
}

int main()
{
  fio;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  //get(t);
  ll t = 1;
  while (t--)
  {
    mainSolve();
  }
  return 0;
}

/*        _____ __  __
  /^--^\  | () )\ \/ /
  \____/  |_()_) |__|
 /      \ _____  _ __  __ ____  _     ____   ____  _____
|        || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_   _|
 \__  __/ |_|   |_|/_/\_\|____||____|\____)/__/\__\ |_|
|^|^\ \^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|
| | |\ \| | | | | | | | | | | | | | | | | | | | | | | | |
#####/ /#################################################
| | |\/ | | | | | | | | | | | | | | | | | | | | | | | | |
|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|*/
#pragma GCC optimize("O4,unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
#define int ll

#define For(i,a,b)  for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second

#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define mkp make_pair

#define MOD (long long)(998244353)
#define INF (1e15)
#define EPS (1e-6)

#ifdef LOCALMEOW
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ <<\
	" : ("#__VA_ARGS__ << ") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T> void _OUT(T x) { cerr << x << "\n"; }
template<typename T,typename...I>
void _OUT(T x,I ...tail) { cerr << x << ", "; _OUT(tail...); }
#else
#define debug(...)
#endif
void INIT(){ ios::sync_with_stdio(false); cin.tie(0); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	int ans=1,now=b;
	while(p){
		if(p&1) ans=ans*now%MOD;
		p/=2; now=now*now%MOD;
	}
	return ans;
}

double dp[110][110][110];

double go(int a,int b,int c){
	if(dp[a][b][c]>=0) return dp[a][b][c];
	if(a>=100 || b>=100 || c>=100) return dp[a][b][c]=0;
	double ans=1;
	ans+=(double)a/(a+b+c)*go(a+1,b,c);
	ans+=(double)b/(a+b+c)*go(a,b+1,c);
	ans+=(double)c/(a+b+c)*go(a,b,c+1);
	return dp[a][b][c]=ans;
}

char g[2010][2010];
bool vis[2010][2010];

int32_t main(){
	INIT();
	//code...
	int n,m; cin>>n>>m;
	pii s,t;
	vector<vector<pii>> vtp(26);
	For(i,0,n+1) For(j,0,m+1){
		if(i==0 || j==0 || i==n+1 || j==m+1) g[i][j]='#';
		else cin>>g[i][j];
		if(g[i][j]=='S') s=mkp(i,j);
		else if(g[i][j]=='G') t=mkp(i,j);
		else if(g[i][j]>='a' && g[i][j]<='z') vtp[g[i][j]-'a'].eb(i,j);
	}
	memset(vis,0,sizeof(vis));
	queue<pair<pii,int>> que;
	que.emplace(s,0);
	vis[s.F][s.S]=1;
	while(!que.empty()){
		pii p=que.front().F;
		int d=que.front().S;
		que.pop();
		if(g[p.F][p.S]=='#') continue;
		if(p==t){
			cout<<d<<"\n";
			return 0;
		}
		if(g[p.F][p.S]>='a' && g[p.F][p.S]<='z'){
			for(auto &i:vtp[g[p.F][p.S]-'a']){
				if(!vis[i.F][i.S]){
					vis[i.F][i.S]=1;
					que.emplace(i,d+1);
				}
			}
		}
		if(!vis[p.F+1][p.S]){vis[p.F+1][p.S]=1;que.emplace(mkp(p.F+1,p.S),d+1);}
		if(!vis[p.F-1][p.S]){vis[p.F-1][p.S]=1;que.emplace(mkp(p.F-1,p.S),d+1);}
		if(!vis[p.F][p.S+1]){vis[p.F][p.S+1]=1;que.emplace(mkp(p.F,p.S+1),d+1);}
		if(!vis[p.F][p.S-1]){vis[p.F][p.S-1]=1;que.emplace(mkp(p.F,p.S-1),d+1);}
	}
	cout<<"-1\n";
	return 0;
}


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

int main(){
    double X , Y , Z ;
    cin >> X >> Y >> Z ;

    int max_s = 0 ;
    for(int i = 0 ; i < 1000000  ; i++){
        double t = Y/X ;
        double s = (double)i/Z ;
        //cout <<fixed << setprecision(10) <<  s << endl;
        if( s < t) max_s = max(max_s , i) ;
        else{
            break ;
        }
    }

    cout << max_s << endl;
}

#include<bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define MP make_pair
#define PB emplace_back
using namespace std;
const int SIZE = 101;
double dp[SIZE][SIZE][SIZE];
bool visited[SIZE][SIZE][SIZE];
double f(int x, int y, int z) {
    if(visited[x][y][z]) { return dp[x][y][z]; }
    if(x == 100 || y == 100 || z == 100) { return 0; }
    visited[x][y][z] = true;
    dp[x][y][z] = 1 + 1. * x / (x + y + z) * f(x + 1 ,y , z) + 1. * y / (x + y + z) * f(x, y + 1, z) + 1. * z / (x + y + z) * f(x, y, z + 1);
    return dp[x][y][z];
}
void solve() {
    int A, B, C;
    cin >> A >> B >> C;
    printf("%.12f\n",f(A, B, C));

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


#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
using namespace std;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
const int N=1e4+5;
int n,a[2505],top=3;
int main(){
    int n=read();
    a[1]=6,a[2]=10,a[3]=15;
    rep(i,16,10000){
        if(i%6==0||i%10==0||i%15==0){
            a[++top]=i;
            if(top==n)break;
        }
    }
    rep(i,1,n)cout<<a[i]<<" ";
    return 0;
}

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

int main() {
	ll N; cin >> N;
	map<int, int> mp;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		mp[a]++;
	}
	ll res = N * N;
	for (auto m : mp) {
		ll n = m.second;
		res -= n * n;
	}
	cout << res / 2 << endl;
}


#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>

using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

typedef long long ll;
typedef long double ld;

void run_case();

int32_t main () {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(20);
    #ifndef ONLINE_JUDGE
    freopen("in", "r", stdin);
    #endif
    int t = 1;
    // cin >> t;
    while (t--) {
        run_case();
    }
    return 0;
}
const int N = 2e5 + 5;
int x[N], id[N];
int n;
set<int> s;
map<int, int> comp;
int pt[N][2];
int dp[N][2];
void run_case() {
    cin >> n;
    pt[0][0] = pt[0][1] = 0;
    for (int i = 1; i <= n; ++i) {
        pt[i][0] = 1e9 + 5;
        pt[i][1] = -1e9 - 5;
        cin >> x[i] >> id[i];
        s.insert(id[i]);
    }
    int cur = 0;
    for (auto i : s) comp[i] = ++cur;
    for (int i = 1; i <= n; ++i) id[i] = comp[id[i]], pt[id[i]][1] = max(pt[id[i]][1], x[i]), pt[id[i]][0] = min(pt[id[i]][0], x[i]);
    pt[(int) comp.size() + 1][0] = 0;
    pt[(int) comp.size() + 1][1] = 0;
    dp[0][0] = dp[0][1] = 0;
    for (int i = 1; i < N; ++i) dp[i][0] = dp[i][1] = 1e18;
    for (int i = 1; i <= (int) comp.size() + 1; ++i) {
        for (int prv = 0; prv < 2; ++prv) {
            for (int cur = 0; cur < 2; ++cur) {
                dp[i][cur] = min(dp[i][cur], dp[i - 1][prv] + llabs(pt[i - 1][prv] - pt[i][cur ^ 1]) + llabs(pt[i][cur ^ 1] - pt[i][cur]));
            }
        }
    }
    cout << dp[(int) comp.size() + 1][0];
}

#include <bits/stdc++.h>
using namespace std ;
using ll = long long;
#define ffor(n) for(ll i = 0; i < n; i++)
#define fffor(n) for(int j = 0; j < n; j++)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()

using ld = long double;

using pi = pair<int,int>;
using pl = pair<ll,ll>;

using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<ld>;

using vpi = vector<pair<int,int>>;

void solve(){
	ll n,q;
    cin>>n>>q;
	vl v(n);
	ffor(n)
	{
		ll a;cin>>a;
		v[i] = a;
	}
	sort(all(v));
	while(q--)
	{
		ll b;cin>>b;
		ll k=b;
		ll c = -1;
		ll it = -2;
		ll i = 0;
		while(!(c == it))
		{
		c = it;
		it = upper_bound(all(v),b)-v.begin();
		if(i)b += (it-c);
		else b += it;
		i++;
		}
		cout<<k+it<<"\n";

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


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

#define ll long long

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

/*
ll cutLog(ll);
ll sum(ll);
*/

ll cutLogNew(ll);

int main() {
	SET(n);
	if (n == 1 || n == 2)printf("1");
	else printf("%lld", n - cutLogNew(n) + 1);
	return 0;
}

/*
ll cutLog(ll n) {
	ll ans;
	REP(i, n + 1) {
		if (sum(i + 1) > n + 1) {
			ans = i;
			break;
		}
	}
	return ans;
}

ll sum(ll n) {
	ll sum = 0;
	REP(i, n) {
		sum += (i + 1);
	}
	return sum;
}
*/

ll cutLogNew(ll n) {
	ll ans = 0;
	ll m = n + 1;
	REP(i, n) {
		m -= (i + 1);
		if (m < 0) {
			ans = i;
			break;
		}
	}
	return ans;
}

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

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

int main() {

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

    ll x;
    cin >> x;

    if (x < 0)
        x = 0;

    cout << x;

    return 0;
}


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

void chmin(int& a, int b) {if (b<a) a=b;}

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), z(n);
  rep(i,n) cin >> x[i] >> y[i] >> z[i];
  vector<vector<int>> dist(n, vector<int>(n));
  rep(i,n) rep(j,n)
    dist[i][j] = abs(x[j]-x[i])+abs(y[j]-y[i])+max(0,z[j]-z[i]);
  vector<vector<int>> dp(1<<n, vector<int>(n,17*3*2000000));
  for (int i=1; i<n; i++) dp[1<<i][i]=dist[0][i];
  for (int i=0; i<(1<<n); i++) {
    int r = (1<<n)-1-i;
    while (r>0) {
      int j = -r&r; r -= j;
      int k = 0; while ((1<<k)!=j) k++;
      for (int l=0; l<n; l++)
        chmin(dp[i|j][k], dp[i][l]+dist[l][k]);
    }
  }
  cout << dp[(1<<n)-1][0] << endl;
}

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair <int,int> pi;
int n;
int a[300005],wi[300005],wi2[300005];
int t[2400005];

void update(int x,int l,int r,int wi) {
    if(wi < l||r < wi) return;
    if(l == r) {
        t[x] = 1; return;
    }
    int mid = (l + r) >> 1;
    update(x*2,l,mid,wi), update(x*2+1,mid+1,r,wi);
    t[x] = t[x*2]+t[x*2+1];
}

int query(int x,int l,int r,int rl,int rr) {
    if(rl > rr) return 0;
    if(rl <= l&&r <= rr) return t[x];
    if(rl > r||l > rr) return 0;
    int mid = (l + r) >> 1;
    return query(x*2,l,mid,rl,rr)+query(x*2+1,mid+1,r,rl,rr);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1;i <= n;i++) cin >> a[i], wi2[++a[i]] = i;
    for(int i = 1;i <= n;i++) {
        wi[i] = i;
    }
    ll ans = 0;
    for(int i = 1;i <= n;i++) {
        ans += query(1,1,2*n,n+wi[a[i]],2*n);
        update(1,1,2*n,n+wi[a[i]]);
    }
    vector <ll> Ans;
    for(int i = n;i >= 1;i--) {
        ans -= n-wi[a[i]];
        ans += wi[a[i]]-1;
        Ans.push_back(ans);
    }
    reverse(Ans.begin(),Ans.end());
    for(ll i : Ans) cout << i << '\n';
}