#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define int long long
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MAXIN(x) max_element(ALL(x)) - x.begin();
#define MIN(x) *min_element(ALL(x))
#define MININ(x) min_element(ALL(x)) - x.begin();
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000  //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265358979323846

using namespace std;

uintmax_t combination(unsigned int n, unsigned int r) {
    if (r * 2 > n) r = n - r;
    uintmax_t dividend = 1;
    uintmax_t divisor = 1;
    for (unsigned int i = 1; i <= r; ++i) {
        dividend *= (n - i + 1);
        divisor *= i;
    }
    return dividend / divisor;
}

signed main() {
    int n;
    cin >> n;
    vector<int> A(n);
    vector<int> B(200);
    REP(i, n) {
        cin >> A[i];
        B[A[i] % 200]++;
    }

    int ans = 0;
    for (int i = 0; i < 200; i++) {
        if (B[i] > 1) {
            //ans += comb(B[i], 2)[B[i]][2];
            ans += combination(B[i], 2);
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long long> remainder(200);
    for(int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        remainder[a % 200]++;
    }
    long long count = 0;
    for(int i = 0; i < 200; ++i) count += remainder[i] * (remainder[i] - 1) / 2;
    cout << count << endl;
    return 0;
}


#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using ll = int64_t;
using db = double;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define show(x) cout << #x << " = " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo {cout<<"Yes";}else{cout<<"No";}
#define YESNO {cout<<"YES";}else{cout<<"NO";}
#define v(T) vector<T>
#define vv(T) vector<vector<T>>

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class A, class B> istream& operator>>(istream& i, pair<A, B>& p) {
  return i >> p.first >> p.second;
}
template<class A, class B, class C> istream& operator>>(istream& i, tuple<A, B, C>& t) {
  return i >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
template<class T> ostream& operator<<(ostream& o, const pair<T, T>& v) {
  o << "(" << v.first << "," << v.second << ")";
  return o;
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T> ostream& operator<<(ostream& o, const set<T>& v) {
  for (auto e : v) {
    o << e << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

#if 1

struct E {
  int l = INT32_MAX, h = INT32_MIN;
};

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  v(E) es(N);
  F0R(i, N) {
    int x, c; cin >> x >> c;
    c--;
    chmin(es[c].l, x);
    chmax(es[c].h, x);
  }
  ll lx = 0, lt = 0;
  ll rx = 0, rt = 0;
  F0R(c, N) {
    auto [l, r] = es[c];
    if (l == INT32_MAX) continue;
    ll rx2 = es[c].h, lx2 = es[c].l;
    ll rt2 = min(lt + abs(lx - l) + abs(l - r), rt + abs(rx - l) + abs(l - r));
    ll lt2 = min(lt + abs(lx - r) + abs(r - l), rt + abs(rx - r) + abs(r - l));

    lx = lx2; rx = rx2;
    lt = lt2; rt = rt2;
  }
  cout << min(lt+abs(lx), rt+abs(rx)) << newl;
}
#endif

#include<bits/stdc++.h>
#define mod 998244353
#define INF LLONG_MAX
#define lli long long int
using namespace std;
#define PII pair<int, int>
#define PLL pair<lli, lli>
#define pub push_back
#define F first
#define S second
#define fastIO ios::sync_with_stdio(0); cin.tie(0);

int main() {
    //fastIO
    //freopen("IN.txt", "r", stdin);
    int n; cin>>n;
    vector<pair<int, int>> arr(n, {INT_MAX, INT_MIN});
    for(int i = 0; i<n; i++){
        int x, c; cin>>x>>c;
        arr[c-1].first = min(arr[c-1].first, x);
        arr[c-1].second = max(arr[c-1].second, x);
    }
    vector<vector<lli>> dp(n, vector<lli>(2));
    lli pos = 0, pos1 = 0;
    lli cost = 0, cost1 = 0;
    for(int i = 0; i<n; i++){
        if(arr[i].first == INT_MAX && arr[i].second == INT_MIN){
            continue;
        }
        dp[i][0] = min(abs(pos-arr[i].first) + cost, abs(pos1-arr[i].first) + cost1) + (arr[i].second-arr[i].first);
        //if(i != 0) dp[i][0] += dp[i-1][1];
        //if(i != 0) pos = arr[i-1].first;
        dp[i][1] = min(abs(pos-arr[i].second) + cost, abs(pos1-arr[i].second) + cost1) + (arr[i].second-arr[i].first);
        //if(i != 0) dp[i][1] += dp[i-1][0];
        cost = dp[i][0]; cost1 = dp[i][1];
        pos = arr[i].second; pos1 = arr[i].first;
    }
    cout<<min(cost + abs(pos), cost1 + abs(pos1))<<"\n";
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1010000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}

int main(){

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

    int N;
    cin >> N;

    ve<pii> A(N);
    rep(i,N) cin >> A[i].fi >> A[i].se;

    int ans = infi;

    rep(i,N) rep(j,N){
        if(i == j) chmin(ans, A[i].fi+A[i].se);
        else chmin(ans, max(A[i].fi,A[j].se));
    }

    cout << ans << endl;

    return 0;
}

#include <iostream>
#include <unordered_map>
#include <vector>
#include <bits/stdc++.h>
//#define int long long int
#define ll long long int
using namespace std;
void solve()
{
  ll n;
cin>>n;
ll a[n];
ll b[n];
for(int i=0;i<n;i++)
{
    int aa,bb;
    cin>>aa>>bb;
    a[i]=aa;
    b[i]=bb;
}

int index1=0;
ll min1=INT_MAX;
for(int i=0;i<n;i++)
{
   if(min1>a[i])
   {
       min1=a[i];
       index1=i;
   }
}

int index2=0;
ll min2=INT_MAX;
for(int i=0;i<n;i++)
{
   if(min2>b[i])
   {
       min2=b[i];
       index2=i;
   }
}

int min_final=INT_MAX;
for(int i=0;i<n;i++)
{
    if(index1==i)
    {
        if(min_final>(b[i]+min1))
        min_final=b[i]+min1;
    }
    else
    {
      if(min_final>(max(b[i],min1)))
        min_final=max(b[i],min1);
    }
}

for(int i=0;i<n;i++)
{
    if(index2==i)
    {
        if(min_final>(a[i]+min2))
        min_final=a[i]+min2;
    }
    else
    {
      if(min_final>(max(a[i],min2)))
        min_final=max(a[i],min2);
    }
}
cout<<min_final<<endl;

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

	int t=1;
//	cin>>t;
	while(t--)
	{
	    solve();
	    cout<<"\n";
	}
	return 0;
}


#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;

int main(){

  ll n;
  cin >> n;
std::vector<ll> p(n);
std::vector<ll> m(n);
std::vector<ll> v(200001);

  ll mi=0;

  rep(i,n) {
    cin >> p.at(i);
    v.at(p.at(i))=1;

    if(p.at(i)==mi){
      for(ll j=mi;j<200001;j++){
        if(v.at(j)==0){
          mi=j;
          break;
        }
      }
    }

    m.at(i)=mi;

    }

    rep(i,n) cout << m.at(i) << endl;
}

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

int main() {
  int n,k;
  k=0;
  cin>>n;
  vector<int>p(n);
  vector<int>a(200002);
  for(int i=0;i<200002;i++){
    a.at(i)=i;
  }
  for(int i=0;i<n;i++){
    cin>>p.at(i);
  }
  for(int i=0;i<n;i++){
    a.at(p.at(i))=-1;
    for(int j=k;j<200002;j++){
      if(a.at(j)!=-1){
        cout<<j<<endl;
        k=j;
        break;
      }
    }
  }

}


#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(), a.end()
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define fb(i,b,a) for(int i=b;i>=a;i--)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 200005;
const int inf = 1e9 + 5;

int n;
ll niz[maxn];

ll pref[maxn];
ll mx[maxn];

int main()
{
   ios::sync_with_stdio(false);
   cout.tie(nullptr);
   cin.tie(nullptr);
   cin >> n;
   ff(i,1,n)cin >> niz[i];
   ff(i,1,n){
      pref[i] = pref[i - 1] + niz[i];
      mx[i] = max(mx[i - 1], pref[i]);
   }
   ll najv = 0;
   ll pre = 0;
   ff(i,1,n){
      ll ima = pre + mx[i];
      najv = max(najv, ima);
      pre = pref[i] + pre;
   }
   cout << najv << endl;
   return 0;
}
/**

**/

#include <bits/stdc++.h>

using namespace std ;

#define i64 int64_t // typecast using i64(x)
#define int int64_t
#define ld long double
#define endl "\n"
#define f(i,a,b) for(int i=int(a);i<int(b);++i)

#define pr pair
#define ar array
#define fr first
#define sc second
#define vt vector
#define pb push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue

#define sz(x) ((int)(x).size())
#define all(a) (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))

// Input functions
// Use only for reading int, vectors, strings.
// Be careful that it reads the complete vector.
template<class A> void rd(vt<A>& v);
template<class T> void rd(T& x){ cin >> x; }
template<class H, class... T> void rd(H& h, T&... t) { rd(h) ; rd(t...) ;}
template<class A> void rd(vt<A>& x) { for(auto& a : x) rd(a) ;}

// DEBUG functions
template<typename T>
void __p(T a) {
  cout<<a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
  cout<<"{";
  __p(a.first);
  cout<<",";
  __p(a.second);
  cout<<"}\n";
}
template<typename T>
void __p(std::vector<T> a) {
  cout<<"{";
  for(auto it=a.begin(); it<a.end(); it++)
    __p(*it),cout<<",}\n"[it+1==a.end()];
}
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
  __p(a1);
  __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cout<<name<<" : ";
  __p(arg1);
  cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
  int bracket=0,i=0;
  for(;; i++)
    if(names[i]==','&&bracket==0)
      break;
    else if(names[i]=='(')
      bracket++;
    else if(names[i]==')')
      bracket--;
  const char *comma=names+i;
  cout.write(names,comma-names)<<" : ";
  __p(arg1);
  cout<<" | ";
  __f(comma+1,args...);
}

//Fast input output
void setIO(string s = "") {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin.exceptions(cin.failbit);
  if(sz(s)){
    freopen((s+".in").c_str(),"r",stdin);
    freopen((s+".out").c_str(),"w",stdout);
  }
}
void chmax(int &x,int y){x = max(x,y) ; return ;}
signed main(){
  setIO() ;
	int N, X; rd(N,X);
	vt<int> a(N+1);
	f(i,1,N+1) rd(a[i]) ;

	int ans = 1e18 ;
	const int _ = 105;
	int dp[_][_][_] ;
	//fixing remainder which is same as number of members here
	for(int count = 1; count <= N; count++){

		mem1(dp) ;

		dp[0][0][0] =  0 ;
		for(int i=0; i<N; i++){

			for(int j=0; j<=count; j++){
				for(int k=0; k<count; k++){
					chmax(dp[i+1][j][k],dp[i][j][k]) ;
				}
			}

			for(int j=0; j<=count; j++){
				for(int k=0; k<count; k++){
					if(dp[i][j][k] != -1){
						chmax(dp[i+1][j+1][(dp[i][j][k]+a[i+1])%count],dp[i][j][k] + a[i+1]) ;
					}
				}
			}

		}

		int res = X%count ;
		if(dp[N][count][res] != -1){
			int temp = X - dp[N][count][res];
			ans = min(ans, temp/count);
		}
	}

	cout << ans ;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;
typedef pair<int, int> P;

class E {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int R, C;
        cin >> R >> C;
        vector<vector<int>> A(R, vector<int>(C - 1));
        vector<vector<int>> B(R - 1, vector<int>(C));
        REP(i, R) REP(j, C - 1) cin >> A[i][j];
        REP(i, R - 1) REP(j, C) cin >> B[i][j];

        vector<int> dist(R * C * 2, INF);
        dist[0] = 0;
        priority_queue<P, vector<P>, greater<>> pq;
        pq.push({0, 0});
        while (!pq.empty()) {
            int cost, v;
            tie(cost, v) = pq.top();
            pq.pop();
            //cout << v << ":" << cost << endl;
            int x = v % R;
            int y = v / R;
            if (v >= R * C) {
                if (x - 1 >= 0) {
                    int nv = R * y + x - 1;
                    if (cost + 1 < dist[nv]) {
                        dist[nv] = cost;
                        pq.push({cost + 1, nv});
                    }
                }
                int nv = v - R * C;
                if (cost < dist[nv]) {
                    dist[nv] = cost;
                    pq.push({cost, nv});
                }
            } else {
                int nv = v + R * C;
                if (cost + 1 < dist[nv]) {
                    dist[nv] = cost + 1;
                    pq.push({cost + 1, nv});
                }
                if (y + 1 <= C - 1) {
                    nv = R * (y + 1) + x;
                    if (cost + A[x][y] < dist[nv]) {
                        dist[nv] = cost + A[x][y];
                        pq.push({cost + A[x][y], nv});
                    }
                }
                if (y - 1 >= 0) {
                    nv = R * (y - 1) + x;
                    if (cost + A[x][y - 1] < dist[nv]) {
                        dist[nv] = cost + A[x][y - 1];
                        pq.push({cost + A[x][y - 1], nv});
                    }
                }
                if (x + 1 <= R - 1) {
                    nv = R * y + x + 1;
                    if (cost + B[x][y] < dist[nv]) {
                        dist[nv] = cost + B[x][y];
                        pq.push({cost + B[x][y], nv});
                    }
                }
            }
        }
        cout << dist[R * C - 1] << endl;
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    E solver;
    solver.solve(in, out);
    return 0;
}

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

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int to_int(string s){
    bool f=false;
    if(s[0]=='-'){
        f=true;
        s=s.substr(1);
    }
    int cnt=4;
    int n=s.size();
    for(int i=0;i<n;i++){
        if(s[i]=='.'){
            s=s.substr(0,i)+s.substr(i+1);
            cnt-=(n-1-i);
            break;
        }
    }
    int res=stoi(s);
    for(int i=0;i<cnt;i++){
        res*=10;
    }
    if(f)res*=-1;
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    ll x,y,r;
    cin >> s; x=to_int(s);
    cin >> s; y=to_int(s);
    cin >> s; r=to_int(s);
    ll res=0;
    constexpr int N=10000;
    auto uo=[](ll x)->ll{
        if(x<=0){
            x-=(N-1);
            x+=abs(x)%N;
            return x;
        }
        x-=abs(x)%N;
        return x;
    };
    auto uoo=[](ll x)->ll{
        if(x<=0){
            x+=abs(x)%N;
            return x;
        }
        x+=(N-1);
        x-=abs(x)%N;
        return x;
    };
    for(ll i=-r;i<=r;){
        if(abs(y+i)%N!=0){
            i++; continue;
        }
        ll L=0,R=2e9;
        while(R-L>1){
            ll mid=(L+R)/2;
            if(mid*mid+i*i<=r*r){
                L=mid;
            }
            else{
                R=mid;
            }
        }
        // cout << i << endl;
        ll X=uo(x+L),XX=uoo(x-L);
        if(X>=XX)res+=(X-XX)/N+1;
        i+=N;
    }
    cout << res << endl;
}


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

int main(){
  string s;
  int i,count =0;

  cin >> s;
  for(i=0;i<12;i++){
      if(s[i] == 'Z'){
          if(s[i+1]=='O'){
              if(s[i+2]=='N'){
                  if(s[i+3]=='e'){
                      count++;
                      i+=3;
                  }
              }
          }
      }
  }
  cout << count << endl;
}

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

signed main(){
    int n;cin>>n;
    if(n%100!=0){
        cout<<n/100 + 1<<endl;
    }else{
        cout<<n/100<<endl;
    }
}


/**
*    author:  AdityaHulk
**/
#include "bits/stdc++.h"
using namespace std;
#define int                 long long
#define rep(i,a,b)          for(int i=a;i<b;++i)
#define rev(i,a,b)          for(int i=a;i>=b;--i)
#define nl                  '\n'
#define sz(x)               (int)((x).size())
#define pb                  push_back
#define ppb                 pop_back
#define pf(v,x)             v.insert(v.begin(),x)
#define ppf(v)              v.erase(v.begin());
#define ff                  first
#define ss                  second
#define all(x)              (x).begin(),(x).end()
#define uniq(v)             (v).erase(unique(all(v)),(v).end())
#define pii                 pair<int,int>
#define vi                  vector<int>
#define vii                 vector<vector<int>>
#define revsort(x)          sort(all(x),greater<int>())
#define map                 map<int,int>
#define umap                unordered_map<int,int>
#define input(n,a)          int n; cin>>n; vi a(n); rep(i,0,n){ cin>>a[i];}
#define output(n,a)         rep(i,0,n){ cout<<a[i]<<" ";}

void Solution(){
    // printf("Specilist Soon\n");
    vi a(3); rep(i,0,3){ cin>>a[i];}
    sort(all(a));
    cout<<((a[2]-a[1])==(a[1]-a[0])? "Yes":"No")<<nl;

}

signed main(){

    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int tc(1);
    // cin>>tc;
    for(int test=1; test<=tc; ++test){
        // printf("Case #%lld: ",test);
        Solution();
        }
    }

#include<bits/stdc++.h>
using namespace std;
int main(){
        int a[3];
        for(int i=0;i<3;i++)cin>>a[i];
        sort(a,a+3);
        if(a[0]+a[2]==2*a[1])puts("Yes");
        else puts("No");
        return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef long l;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vii;
typedef std::queue<int> qi;
typedef std::priority_queue<int, std::vector<int>, std::less<int>> pqi;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define repi(i, a, b) for(int i = a; i < (int)(b); ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define inf 2147483647
#define inf64 9223372036854775807
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;

void solution()
{
    int a[1005] = {};
    int b[1005] = {};
    int dp[1005][1005] = {};

    int n, m;
    cin >> n >> m;

    rep(i, n) {
        cin >> a[i];
        dp[i+1][0] = i+1;
    }
    rep(i, m){
        cin >> b[i];
        dp[0][i+1] = i+1;
    }

    repi(i, 1, n + 1) {
        repi(j, 1, m + 1) {
            dp[i][j] = min(dp[i-1][j]+1, dp[i][j-1]+1);
            dp[i][j] = min(dp[i][j], dp[i-1][j-1] + (a[i-1] != b[j-1]));
        }
    }

    cout << dp[n][m] << endl;
}

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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  for(ll a = 2; a <= 2 * n; a++) {
    ll b = a - k;
    if (b < 2 || b > 2*n) continue;
    if (a <=n) {
      if(b <=n) {
        ans += (a-1) * (b-1);
      } else {
        ans += (a-1) * (2 * n - b + 1);
      }
    } else {
      if(b <=n) {
        ans += (2 * n - a + 1) * (b-1);
      } else {
        ans += (2 * n - a + 1) * (2 * n - b + 1);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ll
#define HgS 1000000007
#define ll long long
#define reg register
#define opr operator
#define ret return
#define gc getchar
#define pc putchar
#define cst const
#define db double
#define il inline
il ll rd()
{
	reg ll res=0,lab=1;
	reg char ch=gc();
	while((ch<'0'||ch>'9')&&ch!=EOF)
	{if(ch=='-')lab=-lab;ch=gc();}
	while(ch>='0'&&ch<='9')
		res=(res<<3)+(res<<1)+(ch&15),ch=gc();
	return res*lab;
}
il void prt(ll x,char t='\n')
{
	static char ch[40];reg int tp=0;
	if(!x){fputs("0",stdout);if(t)pc(t);return;}
	if(x<0)pc('-'),x=-x;
	while(x)ch[++tp]=(x%10)^48,x/=10;
	while(tp)pc(ch[tp--]);
	if(t)pc(t);
}
il ll umax(ll a,ll b){return a>b?a:b;}
il ll umin(ll a,ll b){return a<b?a:b;}
il db umin(db a,db b){return a<b?a:b;}
il ll uabs(ll x){return x>0?x:-x;}
il ll qpow(ll n,ll e=HgS-2,ll p=HgS)
{
	reg ll res=1;
	while(e){if(e&1)res=res*n%p;n=n*n%p;e>>=1;}
	return res;
}
ll n,a[100005];
db f(db x)
{
	db res=0;
	for(int i=1;i<=n;++i)res+=x+a[i]-umin(a[i]*1.0,x*2);
	return res/n;
}
int main()
{
	db l=0,r=1e10,res=-1;
	n=rd();for(int i=1;i<=n;++i)a[i]=rd();
	for(int i=1;i<=100;++i)
	{
		db lm=(l*2+r)/3,rm=(l+r*2)/3,la=f(lm),ra=f(rm);
		if(la+1e-15<ra)r=rm,res=la;else l=lm,res=ra;
	}
	cout<<fixed<<setprecision(15)<<res<<endl;
	return 0;
}

#include <bits/stdc++.h>

// hardwork beats talent when tallent doent work hard...
#define ll long long
#define endl "\n"
ll m = 1000000000 + 7;
#define f(i, t) for (int i = 0; i < t; i++)
ll dp[3005][3005];
using namespace std;
double so(ll arr[], double o, int t)
{
    //  cout << t << endl;

    double o1 = 0;
    f(i, t)
    {
        if (arr[i] > 2 * o)
        {
            o1 += (double)(arr[i] - o);
        }
        else
        {
            o1 += (double)(o);
        }
        //  cout << o1 << " pp" << endl;
    }
    return o1;
}
int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    ll q;
    // cin >> q;
    q = 1;
    f(w, q)
    {
        ll t;
        cin >> t;
        ll s[t];
        long double o = 0, o1 = 0, o3 = 0, o4 = 0, o5 = 0, m = 0, o2 = 0;
        f(i, t)
        {
            cin >> s[i];
            o += s[i];
        }

        sort(s, s + t);
        if (t == 1)
        {
            cout << fixed << setprecision(10) << (double)s[0] / 2 << endl;
            return 0;
        }
        else
        {
            long double l = (double)s[0] / 2, r = s[t - 1];
            while (l != r)
            {
                m = (l + r) / 2;
                o1 = so(s, (double)(l + m) / 2, (int)t);
                o2 = so(s, (double)(r + m) / 2, (int)t);
                // cout << o1 << " " << (l + m) / 2 << endl;
                // cout << o2 << " " << (r + m) / 2 << endl;
                if (o1 <= o2)
                {
                    r = m;
                }
                else
                {
                    l = m;
                }
                if (o1 == o2)
                {
                    l = (l + m) / 2;
                    r = (l + m) / 2;
                }
            }
            // cout << l << endl;

            cout << fixed << setprecision(12) << ((so(s, l, (int)(t))) / t) << endl;
        }
    }
}


#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

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

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

void out(ll a, ll b, ll c, ll d) {
  cout << a << ' ' << b << ' ' << c << ' ' << d << endl;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N;
  cin >> N;
  rep(i, N) {
    ll x, y, r;
    cin >> x >> y >> r;

    // vll divi = divisor(r);
    // debug(r);
    // debugV(divi);
    // ll tate = divi[divi.size() / 2];
    // ll yoko = r / tate;
    // ll a = x - tate / 2;
    // ll b = x + tate / 2;
    // if (tate % 2 != 0) b++;
    // ll c = y - yoko / 2;
    // ll d = y + yoko / 2;
    // if (yoko % 2 != 0) d++;
    // out(a, b, c, d);

    out(x, y, x + 1, y + 1);
  }
  return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,7)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll T; cin >> T;
  rep(_,T) {
    ll L, R; cin >> L >> R;
    ll result = R>=2*L ? (R-2*L+1)*(R-2*L+2)/2 : 0;
    cout << result << endl;
  }
  return 0;
}


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

struct edge {
    int to, color;
};

vector<vector<edge>> graph;

int main() {
    ll N, M;
    cin >> N >> M;
    graph.resize(N);
    set<P> uset;
    rep(i, M) {
        int u, v, c;
        cin >> u >> v >> c;
        --u;
        --v;
        --c;
        if (uset.find(P(u, v)) == uset.end()) {
            graph[u].push_back(edge{v, c});
            graph[v].push_back(edge{u, c});
            uset.insert(P(u, v));
            uset.insert(P(v, u));
        }
    }
    vector<ll> ans(N);
    set<int> s;
    rep(i, N) {
        s.insert(i);
    }

    for (edge e : graph[0]) {
        s.erase(e.color);
    }
    ans[0] = *s.lower_bound(0);

    queue<int> q;
    vector<bool> already(N, false);
    q.push(0);
    already[0] = true;
    while (!q.empty()) {
        int parent = q.front();
        q.pop();

        for (edge e : graph[parent]) {
            if (already[e.to]) {
                continue;
            }
            if (e.color == ans[parent]) {
                ans[e.to] = (ans[parent] + 1) % N;
            } else {
                ans[e.to] = e.color;
            }
            q.push(e.to);
            already[e.to] = true;
        }
    }

    rep(i, N) {
        cout << ans[i] + 1 << "\n";
    }

    return 0;
}

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

using namespace std;
//using namespace atcoder;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using ld = long double;
using vld = vector<ld>;
using vb = vector<bool>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template <class T> bool chmin(T& a, T b) {
    if(a > b) { a = b; return true; }
    else return false;
}

template <class T> bool chmax(T& a, T b) {
    if(a < b) { a = b; return true; }
    else return false;
}

template <class T> ostream& operator<<(ostream& s, const vector<T>& a) {
    for(auto i : a) s << i << ' ';
    return s;
}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 62;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct mint {
    static const long long mod = 1000000007;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) {if ((x += a.x) >= mod) x -= mod; return *this;}
    mint& operator-=(const mint& a) {if ((x += mod - a.x) >= mod) x -= mod; return *this;}
    mint& operator*=(const mint& a) {(x *= a.x) %= mod; return *this;}

    friend const mint operator+(const mint& a, const mint& b) { mint ret = a; return ret += b; }
    friend const mint operator-(const mint& a, const mint& b) { mint ret = a; return ret -= b; }
    friend const mint operator*(const mint& a, const mint& b) { mint ret = a; return ret *= b; }
    friend ostream& operator<<(ostream& s, const mint& a) { return s << a.x; }

    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    friend const mint operator/(const mint& a, const mint& b) { mint ret = a; return ret /= b; }
};

void solve() {
    ll n;
    cin >> n;
    vector<vpll> g(n);
    rep(_, n-1) {
        ll u, v, w;
        cin >> u >> v >> w;
        --u, --v;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
    }

    using vi = vector<int>;
    using vvi = vector<vi>;
    vector<vvi> dp(n, vvi(60, vi(2)));   // 頂点、ビット、0か1

    // subtreeから計算するためのdfs
    function<void(ll, ll)> dfs = [&](ll v, ll p) -> void {
        for(auto [nv, w] : g[v]) {
            if(nv == p) continue;
            dfs(nv, v);
            rep(i, 60) {
                ll wb = (w >> i) & 1;
                ++dp[v][i][wb]; // nvとの辺の寄与
                rep(j, 2) {
                    ll nj = (j+wb)%2;
                    dp[v][i][nj] += dp[nv][i][j];
                }
            }
        }
    };
    dfs(0, -1);

    // 親から渡すためのdfs
    function<void(ll, ll)> dfs2 = [&](ll v, ll p) -> void {
        for(auto [nv, w] : g[v]) {
            if(nv == p) continue;
            rep(i, 60) {
                ll wb = (w >> i) & 1;
                rep(j, 2) {
                    ll dp_add = dp[v][i][j];
                    if(j == wb) --dp_add;
                    ll nj = (j+wb)%2;
                    dp_add -= dp[nv][i][nj];
                    dp[nv][i][nj] += dp_add;
                    if(nj == wb) ++dp[nv][i][nj];
                }
            }
            dfs2(nv, v);
        }
    };
    dfs2(0, -1);

    mint ans = 0;
    rep(bit, 60) {
        mint bitm = mint(1ll << bit);
        mint sum_dp = 0;
        rep(i, n) sum_dp += dp[i][bit][1];
        ans += bitm * sum_dp;
    }
    ans /= 2;
    cout << ans << endl;
    return;
}

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


#include <iostream>
#include <vector>
#include <map>
#include <bits/stdc++.h>
//#include <atcoder/dsu>
using namespace std;
//using namespace atcoder;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;

ll A[200006];
double dp[200006][2];

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

    rep(i, K){
        ll aa;
        cin >> aa;
        A[aa] = 1;
    }
    int r = 0;
    rep(i, N){
        if (A[i]){
            r++;
            if (r >= M){
                cout << -1;
                return 0;
            }
        } else {
            r = 0;
        }
    }
    double sum0 = 0.0, sum1 = 0.0;
    for (int i = N - 1; i >= 0; i--){
        if (A[i]){
            dp[i][0] = 0;
            dp[i][1] = 1;
        } else {
            dp[i][0] = sum0/M + 1.0;
            dp[i][1] = sum1/M;
        }
        //fprintf(stdout, "%d, %.3f, %.3f\n", i, dp[i][0], dp[i][1]);
        sum0 += dp[i][0] - dp[i + M][0];
        sum1 += dp[i][1] - dp[i + M][1];
    }
    double a = dp[0][0], b = dp[0][1];
    fprintf(stdout, "%.15f\n", a/(1.0 - b));
    return 0;
}

//@formatter:off
#include<bits/stdc++.h>
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(i,n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i,s,n) for (ll i = ll(s); i < ll(n); ++i)
#define rep3(i,s,n,d) for(ll i = ll(s); i < ll(n); i+=d)
#define rep(...) overload4(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep(i,n) for (ll i = ll(n)-1; i >= 0; i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define popcount(x) __builtin_popcount(x)
#define pb push_back
#define eb emplace_back
#ifdef __LOCAL
#define debug(...) { cout << #__VA_ARGS__; cout << ": "; print(__VA_ARGS__); cout << flush; }
#else
#define debug(...) void(0)
#endif
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
using LP = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vs = vector<string>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vp = vector<P>;
using vvp = vector<vector<P>>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
void scan(){}
template <class Head, class... Tail> void scan(Head& head, Tail&... tail){ cin >> head; scan(tail...); }
template<class T> void print(const T& t){ cout << t << '\n'; }
template <class Head, class... Tail> void print(const Head& head, const Tail&... tail){ cout<<head<<' '; print(tail...); }
template<class... T> void fin(const T&... a) { print(a...); exit(0); }
const string yes[] = {"no","yes"};
const string Yes[] = {"No","Yes"};
const string YES[] = {"NO","YES"};
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int dp[1 << 17][17];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    INT(n, m);
    vvi G(n);
    rep(i, m) {
        INT(a, b);
        a--, b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    INT(k);
    vi c(k);
    cin >> c;
    rep(i, k) c[i]--;
    vvi dist(k, vi(n, inf));
    rep(i, k) {
        dist[i][c[i]] = 0;
        queue<int> q;
        q.push(c[i]);
        while (q.size()) {
            int u = q.front();
            q.pop();
            for (int v : G[u]) {
                if (chmin(dist[i][v], dist[i][u] + 1)) q.push(v);
            }
        }
    }
    rep(i, 1 << k) rep(j, k) dp[i][j] = inf;
    rep(i, k) dp[1 << i][i] = 0;
    rep(bit, 1 << k) rep(i, k) {
            int now = dp[bit][i];
            if (now == inf) continue;
            rep(j, k) {
                if (bit >> j & 1) continue;
                if (dist[i][c[j]] == inf) continue;
                chmin(dp[bit | 1 << j][j], now + dist[i][c[j]]);
            }
        }
    int ans = inf;
    rep(i, k) chmin(ans, dp[(1 << k) - 1][i]);
    print(ans == inf ? -1 : ans + 1);
}


#include <iostream>
#include <vector>

using namespace std;

#define int long long

vector<int> get_prime(int max_n)
{
    vector<bool> is_prime(max_n + 1, true);
    vector<int> res;
    for (int i = 2; i < is_prime.size(); i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = i + i; j < is_prime.size(); j += i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

bool coprime(int n, int m, vector<int> prime)
{
    for (int p : prime)
    {
        if (n % p == 0 && m % p == 0)
        {
            return true;
        }
    }
    return false;
}

signed main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i];
    }

    vector<int> prime = get_prime(50);
    vector<int> used(prime.size(), false);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < prime.size(); j++)
        {
            if (x[i] % prime[j] == 0)
            {
                used[j] = true;
            }
        }
    }

    int ans = 614889782588491410;
    for (int i = 1; i < (1 << 15); i++)
    {
        bool ok = true;
        int tmp = 1;

        for (int j = 0; j < 15; j++)
        {
            if ((1 << j) & i)
            {
                tmp *= prime[j];
            }
        }

        for (int j = 0; j < n; j++)
        {
            if (!coprime(x[j], tmp, prime))
            {
                ok = false;
                break;
            }
        }

        if (ok)
        {
            ans = min(ans, tmp);
        }
    }

    cout << ans << endl;
}

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

#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;++i)
#define per(i,a,b) for(int i=(a),i##end=(b);i>=i##end;--i)

typedef long long ll;
int n,A[100];
int pri[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

int main(){
  cin>>n;
  rep(i,1,n)cin>>A[i];
  ll mx=-1;
  rep(S,0,(1<<15)-1){
    ll tp=1;
    rep(i,0,14)if(S>>i&1)tp*=pri[i];
    bool flg=1;
    rep(i,1,n)flg&=__gcd(1ll*A[i],tp)>1;
    if(flg)if(mx==-1||mx>tp)mx=tp;
  }
  cout<<mx<<endl;
  return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int res=0;
	bool zf=0;
	char c;
	while(((c=getchar())<'0'||c>'9')&&c!='-');
	if(c=='-')zf=1;
	else res=c-'0';
	while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
	return (zf?-res:res);
}
const int maxn=2e5+5;
int dta[maxn];
vector<int>lsh;
inline int getid(int x){
	return lower_bound(lsh.begin(),lsh.end(),x)-lsh.begin()+1;
}
long long sum[maxn<<2];
int cnt[maxn<<2];
inline long long calc(int x){
	long long res=0;
	for(;x;x-=x&-x)res+=sum[x];
	return res;
}
inline int calc2(int x){
	long long res=0;
	for(;x;x-=x&-x)res+=cnt[x];
	return res;
}
inline void modify(int x,long long v){
	for(;x<=lsh.size();x+=x&-x)sum[x]+=v,++cnt[x];
	return;
}
inline long long query(int x,int y){
	if(x>y)return 0ll;
	return calc(y)-calc(x-1);
}
inline int query2(int x,int y){
	if(x>y)return 0ll;
	return calc2(y)-calc2(x-1);
}
signed main(){
	int n=read();
	long long ans=0;
	for(register int i=1;i<=n;++i){
		dta[i]=read();
		lsh.push_back(dta[i]);
	}
	sort(lsh.begin(),lsh.end());
	lsh.erase(unique(lsh.begin(),lsh.end()),lsh.end());
	for(register int i=1;i<=n;++i){
		ans+=1ll*query2(1,getid(dta[i])-1)*dta[i]-query(1,getid(dta[i])-1)+query(getid(dta[i])+1,lsh.size())-1ll*query2(getid(dta[i]+1),lsh.size())*dta[i];
		modify(getid(dta[i]),dta[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

#ifdef LOCAL
#pragma warning(disable:4996)
#pragma warning(disable:4244)
#pragma warning(disable:4554)
#define gets gets_s

#endif
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<string>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<assert.h>
#include<unordered_map>
#include<ctime>
#define ll long long
#define cl(a,x) memset((a),(x),sizeof(a))
#define lson 2*i
#define rson 2*i+1
#define sf scanf
#define ull unsigned long long
#define lowbit(x) (x)&(-x)
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pdd pair<double,double>
#define ti tree[i]
#define mp make_pair
#define debug cerr <<"flag" << endl;
ll q_pow(ll x, ll n, ll mod) { ll ret = 1; while (n) { if (n & 1) ret = x * ret%mod; x = x * x%mod; n >>= 1; }return ret; }
ll __gcd(ll x, ll y) { if (!y) return x; return __gcd(y, x%y); }
ll getbit(ll now) { int cnt = 0; while (now) { cnt++; now -= lowbit(now); }return cnt; }
int dx[] = { -1,1,0,0 };//上下左右
int dy[] = { 0,0,-1,1 };//
using namespace std;
const ll maxn = 2e5 + 10;
const ll INF = 0x3f3f3f3f;
const ll IINF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
const int mod = 1e9 + 7;

int dp[maxn];
char s[maxn];

void solve() {
	sf("%s", s + 1);
	int n = strlen(s + 1);

	int cnt = n;
	ll ans = 0;
	int last = -INF;
	for (int i = 1; i <= n; i++) {
		if (s[i] == s[i + 1] and s[i] != s[i + 2] and last != s[i]) {
			if (last != s[i]) ans += n - i, last = s[i];
		}
		else if (last == s[i]) ans--;
	}

	printf("%lld\n", ans);
}

signed main(int argc, char *argv[]) {
	if (argc == 2 && strcmp("-debug", argv[1]) == 0) {
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}

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

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

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
int P = 1000000007;
#define F first
#define S second
#define pb push_back
#define mp make_pair

void solve () {
	int a, b; cin >> a >> b;
	int sum=0;
	if (a>=b) {
		for (int i=1; i<=a; ++i) {cout << i << " ";}
		for (int i=1; i<b; ++i) {cout << -i << " ";}
		cout << b*(b-1)/2-a*(a+1)/2;
	}
	else {
		for (int i=1; i<=b; ++i) {cout << -i << " ";};
		for (int i=1; i<a; ++i) {cout << i << " ";}
		cout << b*(b+1)/2-a*(a-1)/2;
	}
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
    int t = 1;
    // cin >> t;
    for (int _t=0; _t<t;++_t) {
        // cout << "Case #" << _t+1 << ": ";
        solve();
    }
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
signed main()
{
    vector<int>v;
    int n,x;
    cin>>n>>x;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]!=x)
            v.push_back(a[i]);
    }
    if(v.size()==0)
        cout<<""<<endl;
    else
    {
        for(int i=0;i<v.size();i++)
            cout<<v[i]<<" ";
        cout<<endl;
    }
}


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

void solve(){
	int n,m;cin>>n>>m;
	vector<vector<int>>a;
	for(int i=0;i<m;i++){
		int x, y;cin>>x>>y;
		a.push_back({x, y});
	}

	sort(a.begin(), a.end());
	map<int,int>look;
	look[n]++;

	for(int i=0;i<m;){

		int r = a[i][0];
		int j = i;
		map<int,int>cur;

		while(i<m && a[i][0] == r){
			if(look.find(a[i][1]-1) != look.end()){
				cur[a[i][1]]++;
			}
			if(look.find(a[i][1]+1) != look.end()){
				cur[a[i][1]]++;
			}
			i++;
		}
		while(j<m && a[j][0] == r){
			if(look.find(a[j][1]) != look.end()){
				look.erase(a[j][1]);
			}
			j++;
		}

		for(auto x:cur)	look[x.first]++;
	}
	cout<<look.size()<<"\n";
}

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


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n, m;
  cin >> n >> m;

  vector<ll> h(n);
  vector<ll> w(m);
  for (auto &x : h)
    cin >> x;
  for (auto &x : w)
    cin >> x;

  sort(h.begin(), h.end());

  vector<ll> even(n + 2);
  vector<ll> odd(n + 2);

  for (int i = 0; i < n; i += 2)
    even[i + 2] = even[i] + h[i + 1] - h[i];
  for (int i = 1; i < n; i += 2)
    odd[i + 2] = odd[i] + h[i + 1] - h[i];

  ll ans = 1e18;
  for (auto x : w) {
    int i = distance(h.begin(), upper_bound(h.begin(), h.end(), x));

    ll cur = 0;
    if (i % 2 == 0) {
      cur += even[i];
      cur += h[i] - x;
      cur += odd[n] - odd[i + 1];
    } else {
      cur += even[i - 1];
      cur += x - h[i - 1];
      cur += odd[n] - odd[i];
    }
    ans = min(ans, cur);
  }

  cout << ans << endl;

  return 0;
}

#include <bits/stdc++.h>

typedef long long LL;

const int MAXN = 2e5 + 10;

int n, m, tot;
int a[MAXN], b[MAXN];
LL pre[MAXN * 2], suf[MAXN * 2];
struct Node { int val, id, type; } q[MAXN * 2];
struct cmz { int id, ans; } dsy[MAXN];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i), q[i] = (Node) { a[i], i, 1 };
	for (int i = 1; i <= m; ++i) scanf("%d", b + i), q[i + n] = (Node) { b[i], i, 2 };
	std::sort(q + 1, q + n + m + 1, [](const Node &a, const Node &b) { return a.val < b.val; });
	for (int i = 1, lst = -1; i <= n + m; ++i) {
		if (q[i].type == 1) {
			if (~lst) pre[i] = pre[i - 1] + abs(q[i].val - lst), lst = -1;
			else lst = q[i].val, pre[i] = pre[i - 1];
		} else pre[i] = pre[i - 1];
	}
	for (int i = n + m, lst = -1; i; --i) {
		if (q[i].type == 1) {
			if (~lst) suf[i] = suf[i + 1] + abs(q[i].val - lst), lst = -1;
			else lst = q[i].val, suf[i] = suf[i + 1];
		} else suf[i] = suf[i + 1];
	}
	LL ans = 2333333333333333LL;
	for (int i = 1, lst = -1; i <= n + m; ++i) {
		if (q[i].type == 2) {
			if (~lst) ans = std::min(pre[i] + suf[i] + abs(q[i].val - lst), ans), ++tot;
		} else {
			if (~lst) lst = -1;
			else lst = q[i].val;
		}
	}
	for (int i = n + m, lst = -1; i; --i) {
		if (q[i].type == 2) {
			if (~lst) ans = std::min(pre[i] + suf[i] + abs(q[i].val - lst), ans), ++tot;
		} else {
			if (~lst) lst = -1;
			else lst = q[i].val;
		}
	}
	assert(tot == m);
	printf("%lld\n", ans);
	return 0;
}


/**
 *    author: chowgz
 *    created: 22/12/2020 02:09:09
**/
#include <bits/stdc++.h>

using namespace std;

#define p 1000000007

inline static long long invmod(long long a) {
	long long res = 1, b = p - 2;
	while (b != 0) {
		if (b & 1) {
			res = res * a % p;
		}
		a = a * a % p;
		b >>= 1;
	}
	return res;
}

inline static long long nCr(int n, int r) {
	long long num = 1, den = 1;
	r = min(r, n - r);
	n++;
	for (int i = 1; i <= r; i++) {
		num = num * (n - i) % p;
		den = den * i % p;
	}
	long long res = num * invmod(den) % p;
	if (res < 0) res += p;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	int arr[n], sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += arr[i];
	}
	if (m < sum) {
		cout << 0;
		return 0;
	}
	m += n;
	sum += n;
	cout << nCr(m, sum);
	return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> edge(n, 0);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edge.at(a) |= (1 << b);
    edge.at(b) |= (1 << a);
  }

  vector<int> dp(1 << n, 1001001001);
  dp.at(0) = 0;
  rep2(bit, 1, 1 << n) {
    rep(i, n) {
      if((bit & (1 << i)) != 0) {
        int j = bit - (1 << i);
        if(dp.at(j) <= 1 && ((edge.at(i) & j) == j)) {
          dp.at(bit) = 1;
        }
        break;
      }
    }
  }

  rep(bit, 1 << n) {
    for(int i = bit; i > 0; i = ((i-1) & bit)) {
      int j = bit - i;
      dp.at(bit) = min(dp.at(bit), dp.at(i) + dp.at(j));
    }
  }
  // rep(i, dp.size()) {
  //   cerr << (dp.at(i) == 1001001001 ? -1 : dp.at(i)) << " ";
  // }
  // cerr << endl;
  cout << dp.back() << endl;
  return 0;
}


#include <bits/stdc++.h>

#define int long long

#define fileopen(a, b) freopen(((std::string)a + ".inp").c_str(), "r", stdin); freopen(((std::string)b + ".out").c_str(), "w", stdout);
#define fileopen1(a) freopen(((std::string)a + ".inp").c_str(), "r", stdin); freopen(((std::string)a + ".out").c_str(), "w", stdout);

#ifdef PICHU_LOCAL_DEF
	#include <chrono>
#endif

using namespace std;

const int MAXN = 3e5 + 5;

int n, q;
int a[MAXN], IT[MAXN << 2], lazy[MAXN << 2];

void upd(int i, int val, int id = 1, int l = 1, int r = n) {
	if (r < i || l > i) return;
	if (l == r) {
		IT[id] = val;
		return;
	}

	int mid = l + r >> 1;

	upd(i, val, id << 1, l, mid);
	upd(i, val, id << 1 | 1, mid + 1, r);

	IT[id] = IT[id << 1] ^ IT[id << 1 | 1];
}

int sum(int u, int v, int id = 1, int l = 1, int r = n) {
	if (r < u || l > v) return 0;
	if (l >= u && r <= v) return IT[id];

	int mid = l + r >> 1;

	return sum(u, v, id << 1, l, mid) ^ sum(u, v, id << 1 | 1, mid + 1, r);
}

signed main() {
	#ifdef PICHU_LOCAL_DEF
		chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
	#endif

	#ifndef PICHU_LOCAL_DEF
		// fileopen1("LAH");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin >> n >> q;
	for (int i = 1; i <= n; i++) cin >> a[i], upd(i, a[i]);

	while (q--) {
		int t, x, y;
		cin >> t >> x >> y;
		if (t == 1) {
			a[x] ^= y;
			upd(x, a[x]);
		}
		else cout << sum(x, y) << '\n';
	}

	#ifdef PICHU_LOCAL_DEF
		chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
		std::cout << std::endl;
		std::cout << "Time difference = " << chrono::duration_cast<chrono::milliseconds> (end - begin).count() << "[ms]" << std::endl;
	#endif
}

#include<algorithm>
#include<cstdio>
#define rg register
#define ri rg int
#define defrog(A...) fprintf(stderr,A)

#define getchar() (p1==p2&&(p2=(p1=ibuf)+fread(ibuf,1,1<<15,stdin),p1==p2)?EOF:*p1++)
char ibuf[1<<15],*p1,*p2;
struct{
	inline operator int(){rg char c,f=0;while((c=getchar())<48||c>57)f|=c=='-';ri unsigned a=c&15;while((c=getchar())>=48&&c<=57)a=a*10+(c&15);return f?~a+1:a;}

}g90;

const int N=505,M=250250;
int p[N],a[M];

main(){
	for(int T=g90;T--;){
		int n=g90,m=0;
		for(int i=1;i<=n;i++)p[i]=g90;
		for(;;){
			++m;
			int flag=1;
			int pos=n-1;
			while(pos&&(p[pos]<=p[pos+1]||(pos^m)&1)){if(p[pos]>p[pos+1])flag=0;pos--;}
			if(!pos&&flag)break;
			if(!pos){
				if(m&1)pos=1;
				else pos=2;
			}
			std::swap(p[pos],p[pos+1]);
			a[m]=pos;
		}
		--m;
		printf("%d\n",m);
		for(int i=1;i<=m;i++)printf("%d ",a[i]);
		puts("");
	}
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define vl vector <ll>
#define pb push_back
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define mk make_pair
#define INF 2000000000000000000
#define INF32 2000000000
#define FOR(i, a, b) for(ll i = (ll)(a); i <= (ll)(b); i++)
#define ROF(i, a, b) for(ll i = (ll)(a); i >= (ll)(b); i--)
#define BOOST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define x first
#define y second

using namespace std;
bool comp(vector<ll> a, vector<ll> b)
{
    if(a[0] == b[0])
    {
        return a[1] < b[1];
    }
    return a[0] < b[0];
}
int main()
{
    BOOST;
    ll n, w;
    cin >> n >> w;
    vector < vector<ll> > p(2*n, vector<ll> (3, 0));
    FOR(i, 0, n-1)
    {
        ll a, b, c;
        cin >> a >> b >> c;
        p[i][0] = a;
        p[i][1] = 1;
        p[i][2] = c;
        p[n+i][0] = b;
        p[n+i][1] = -1;
        p[n+i][2] = c;
    }
    sort(all(p), comp);
    ll now = 0, ind = 0, ti = p[ind][0];
    while(ind <= 2*n-1)
    {
        now += p[ind][1]*p[ind][2];
        if(now > w)
        {
            cout << "No";
            return 0;
        }
        ind++;
    }
    cout << "Yes";
    return 0;
}

/* D - Water Heater */
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 2e5 + 10;
int n, m, maxv; ll a[N], d[N];

string solve(void)
{
	for (int k = 0; k <= maxv; ++k) a[k] = a[k - 1] + d[k];
	ll x = *max_element(a, a + maxv);
	return (x <= m) ? "Yes" : "No";
}

int main(int argc, char** argv)
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	#endif
	while (cin >> n >> m) {
		memset(a, 0, sizeof(a));
		memset(d, 0, sizeof(d));
		for (int k = 1; k <= n; ++k) {
			int l, r, c; cin >> l >> r >> c;
			d[l] += c;
			d[r] -= c;
			maxv = max(maxv, r);
		}
		cout << solve() << endl;
	}
	return 0;
}


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

int main(){
    ll N,M,T;
    cin>>N>>M>>T;

    vector<int>a;
    vector<int>b;
    ll tempa,tempb;

    ll bat=N;

    rep(i,M){
        cin>>tempa>>tempb;
        a.push_back(tempa);
        b.push_back(tempb);
    }

    rep(i,M){
        if(i==0){
            if(bat-a[i]<=0){cout<<"No";return 0;}
            bat-=a[i];
            bat+=b[i]-a[i];if(bat>N)bat=N;
            continue;
        }

        if(bat-(a[i]-b[i-1])<=0){cout<<"No";return 0;}
        bat-=(a[i]-b[i-1]);
        bat+=b[i]-a[i];if(bat>N)bat=N;
    }

    if(bat-(T-b[M-1])<=0){cout<<"No";return 0;}

    cout<<"Yes";
    return 0;
}

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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	ll n,m,t; cin>>n>>m>>t; ll arr[m+2][2]; ll maxi=n;
	for (ll i=1;i<m+1;i++) {
		cin>>arr[i][0]>>arr[i][1];
	}
	arr[0][1]=0; arr[m+1][0]=t;
	bool ans=1;
	for (ll i=1;i<m+1;i++) {
		n-=(arr[i][0]-arr[i-1][1]);
		if (n<=0) ans=0;
		n+=(arr[i][1]-arr[i][0]);
		if (n>maxi) n=maxi;
	}
	n-=(arr[m+1][0]-arr[m][1]);
	if (n<=0) ans=0;
	if (ans) cout<<"Yes";
	else cout<<"No";
}


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

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    for (int z = 0; z < Q; z++) {
        ll K;
        cin >> K;
        ll ans = K;
        while (true) {
            auto it = upper_bound(A.begin(), A.end(), ans);
            ll m = ans-(it-A.begin());
            if (m == K) break;
            ans += K-m;
        }
        cout << ans << "\n";
    }
    return 0;
}

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

#define INF  						1e15
#define EPS   						1e-9
#define MOD 						1000000007
#define Pi 							3.14159265358979323846264338327950288419716939937510

#define umap 						unordered_map
#define uset 						unordered_set
#define fi 							first
#define se 							second
#define ll 							long long
#define vi 							vector<int>
#define pii 						pair<int,int>
#define vll 						vector<ll>
#define pll							pair<ll,ll>
#define vvll						vector<vector<ll>>
#define pb 							push_back
#define pob 						pop_back
#define pf 							push_front
#define pof 						pop_front
#define maxE(a,n) 					*max_element(a,a+n);
#define minE(a,n) 					*min_element(a,a+n);
#define all(x) 						x.begin(), x.end()
#define rev(x)						reverse(all(x))
#define endl						"\n"

#define fast 						ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define rep(i,n)					for (ll  i=0;i<n;i++)
#define repd(i,n)					for (ll  i = n-1;i>=0;i--)
#define fori(i,a,n) 				for (ll  i=a;i<n;i++)
#define ford(i,a,n) 				for (ll  i=n-1;i>=a;i--)
#define trav(x,a)					for(auto x:a){cout<<x<<" ";}cout<<endl;

ll gcd(ll a, ll b) {	return __gcd(a, b);}
ll lcm(ll a, ll b) {return (a * b) / gcd(a, b);}
ll power(ll x, ll b, ll m) {ll p = 1; while (b > 0) {if (b & 1) {p = p * x; p %= m;} b >>= 1; x *= x; x %= m;} return p % m;}
void dbg(string s) {cout << s << endl;}

/*PBDS*/
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> PBDS;

// pbds.find_by_order(k) (return iterator to kth largest element(from 0))
// pbds.order_of_key(k) (return number of elements in set which are strictly less than k)

void solve() {

	ll n, q;
	cin >> n >> q;

	vll a(n);
	rep(i, n)	cin >> a[i];

	vll pre(n, 0);
	pre[0] = a[0] - 1;
	fori(i, 1, n) {
		pre[i] = pre[i - 1] + (a[i ] - a[i - 1] - 1);
	}

	while (q--) {
		ll k;
		cin >> k;

		auto pos = lower_bound(all(pre), k);
		if (pos == pre.end()) {
			cout << a[n - 1] + (k - pre[n - 1]) << endl;
		}
		else {
			ll idx = pos - pre.begin();
			cout << idx + k << endl;
		}
	}

}

int main() {

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

	fast;
	ll t = 1;

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


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n;
	set<int> k;
	cin>>n;
	int p[n+1];
	for(int i=1;i<=n;i++){
		cin>>p[i];
	}
	for(int i=0;i<=200005;i++){
		k.insert(i);
	}
	for(int i=1;i<=n;i++){
		if(k.find(p[i])!=k.end()){
			k.erase(k.find(p[i]));
		}
		set<int>::iterator ite;
		ite=k.begin();
		cout<<*ite<<endl;
	}

	return 0;
}

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

int main() {
  int N; cin>>N;
  vi cnt(200005,0),p(N);
  vi ans;
  rep(i,N) {
    cin>>p[i];
    cnt[p[i]]++;
  }
  int min;
  rep(i,200005) {
    if(cnt[i]==0) {
      min=i;
      break;
    }
  }

  for(int i=N-1;i>=0;i--) {
    ans.pb(min);
    cnt[p[i]]--;
    if(cnt[p[i]]==0&&p[i]<min) min=p[i];
  }
  for(int i=N-1;i>=0;i--) cout<<ans[i]<<endl;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<string>
#include<stack>
#include<map>
#define pf printf
#define pfn printf("\n");
#define wsa while(~scanf("%d",&a))
#define forba for(b=0;b<a;b++)
#define st scanf("%d",&t);
#define wt while(t--)
#define scdx scanf("%d",&x[b]);
#define sclldx scanf("%lld",&x[b]);
#define inf 0x3f3f3f3f;
using namespace std;
int main()
{
    int a,b,c,d,e,f,g;
    map<int,long long> mp;
    cin>>a;
    forba
    {
        cin>>c;
        mp[c%200]++;
    }
    long long sum;
    sum=0;
    for(auto x:mp)
    {
        sum+=x.second*(x.second-1)/2;
    }
    cout<<sum;
}

#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <vector>

#pragma region macros
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) _range(i, 0, n)
#define _range(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__)
#define _rrep(i, n) _rrange(i, n, 0)
#define _rrange(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)
#define rrep(...) _overload(__VA_ARGS__, _rrange, _rrep, )(__VA_ARGS__)
#pragma endregion macros

using namespace std;

template <class T> bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T> bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

using ll    = long long;
using R     = long double;
const R EPS = 1e-9L;  // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R &r) {
    return (r > EPS) - (r < -EPS);
}
inline R sq(R x) {
    return sqrt(max(x, 0.0L));
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);

    vector<int> cnt(200, 0);

    rep(i, n) {
        cin >> a[i];
        a[i] %= 200;
        cnt[a[i]]++;
    }

    ll ans = 0LL;
    rep(i, 200) {
        const int k = cnt[i];
        ans += 1LL * k * (k - 1) / 2LL;
    }

    cout << ans << endl;

    return 0;
}


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

using ll = long long int;
using ull = unsigned long long int;
using P = pair<ll, ll>;
using P3 = pair<int,P>;
using PP = pair<P, P>;
constexpr int INF32 = 1 << 30;
constexpr ll INF64 = 1LL << 60;
constexpr ll MOD = 1000000007;
// constexpr ll MOD = 998244353;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr int di8[] = {0, 1, 1, 1, 0, -1, -1, -1};
constexpr int dj8[] = {1, 1, 0, -1, -1, -1, 0, 1};
constexpr double EPS = 1e-10;
const double PI = acos(-1);

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

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    double l=0,r=INF32;
    REP(t,100){
        double x = l+(r-l)/3, y = r-(r-l)/3;
        double ex = x, ey = y;
        REP(i,n) ex += max(double(a[i])-x*2,0.)/n;
        REP(i,n) ey += max(double(a[i])-y*2,0.)/n;
        if(ex < ey){
            r = y;
        }else{
            l = x;
        }
    }
    double ans = l;
    REP(i,n) ans += max(double(a[i])-l*2,0.)/n;
    printf("%.9lf\n", ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,count=0,i,j,sum,x,y;
  cin>>t;
  for(i=0;i<t;i++)
  {
      //sum=0;
      cin>>x>>y;
      sum=y*(y+1)/2-x*(x+1)/2+x;

  count=count+sum;
  }
  cout<<count<<endl;

}


#include "bits/stdc++.h"
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=1e10;

void solve(){
	int n;
	string t;
	cin >> n >> t;
	if(t == "0"){
		cout << N;
		return;
	}
	if(t == "1"){
		cout << 2 * N;
		return;
	}
	string s = "110";
	rep(i,0,3){
		bool ok = 1;
		rep(j,0,n){
			if(t[j] != s[(j + i) % 3]) ok = 0;
		}
		if(ok){
			// int r = (n + 2) / 3;
			int r = (i + n + 2) / 3;
			int ans = N - r + 1;
			// if(k > r) ans --;
			cout << ans;
			return;
		}
	}
	cout << 0;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define F first
#define S second
#define um map <ll,ll>
#define rep(i,z,n)  for(int i=z;i<n;i++)
#define repi(i,z,n) for(int i=z;i<=n;i++)
#define repn(i,z,n) for(int i=n-1;i>=z;i--)
#define vec vector<ll>
#define vecp vector<pair<ll,ll>>
#define pi (double)3.14159265358979323846
#define ld long double
#define all(z) z.begin(),z.end()

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; if (a == 0) return 0; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }
ll modInverse(ll a, ll m) {return power(a, m - 2, m);}
ll binpow(ll a, ll b) {ll res = 1; while (b > 0) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll binlog2(ll n) {ll logValue = -1; while (n) {logValue++; n >>= 1;} return logValue;}
ll ceil(ll t1, ll t2) {ll ans = (t1 + t2 - 1) / t2; return ans;}
void print(vec a) {rep(i, 0, a.size())cout << a[i] << " "; cout << endl;}
const ll mod = 1e9 + 7;
const ll N = 1e5 + 5;
const ll inf = 2e18;

void solve() {
    ll n, x;
    cin >> n >> x;
    vec a(n);
    rep(i, 0, n)
    cin >> a[i];

    rep(i, 0, n) {
        if (a[i] == x)
            continue;

        cout << a[i] << " ";
    }

    cout << endl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    speed;
    int test = 1;
    // init();
    // cin >> test;
    // ll t1 = 1;

    while (test--) {
        // cout << "Case #" << t1 << ": ";
        solve();
        // t1++;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define brn                "\n"
#define ss                second
#define mk                make_pair
#define int               long long
#define pb                push_back
#define ps(x,y)           fixed<<setprecision(y)<<x
#define w(x)              int x; cin>>x; while(x--)
#define FOR(i,a,b)        for(int i=(a);i<(b);i++)
#define ROF(i,a,b)        for(int i=(a);i>=(b);i--)
#define so(a,n)           sort(a,a+n)
#define rso(a,n)          sort(a,a+n),reverse(a,a+n)
#define all(v)            (v).begin(),(v).end()
#define ps(x,y)           fixed<<setprecision(y)<<x
#define sz                size();
#define p_sieve           10000007
const int                 maxn = 1e3 + 5;
const int                 modulo = 1000000007;
#define mod               1000000009;
const double              pi = 3.14159;
#define INF               1000001000
#define imx                9999999999999999
#define imi               -9999999999999999
//check n==1 and base cases//

//********************************---------always check array boundness-----------****************
// factorial ncr
// int printNcR(int n, int r)
// {
//     if(n<r)return 0;
//     long long p = 1, k = 1;
//     if (n - r < r)
//         r = n - r;
//     if (r != 0) {
//         while (r) {
//             p *= n;
//             k *= r;
//             long long m = __gcd(p, k);
//             p /= m;
//             k /= m;

//             n--;
//             r--;
//         }
//     }
//     else p = 1;
//     return p;
// }

// int power(int x, unsigned int y)
// {
//     int res = 1;
//     x = x % modulo;
//     if (x == 0) return 0;
//     while (y > 0)
//     {
//         if (y & 1) res = (res*x);
//         y = y>>1;
//         x = (x*x);
//     }
//     return res;
// }

void solve()
{
  int n;cin>>n;
  int a[n],b[n],c[n];
  FOR(i,0,n)cin>>a[i];
  FOR(i,0,n)cin>>b[i];
  int maxi1=a[0];
  int maxi2=a[0]*b[0];
  cout<<maxi2<<'\n';
  FOR(i,1,n)
  {
  	maxi1=max(maxi1,a[i]);
    int tt=max(a[i]*b[i],max(maxi1*b[i],maxi2));
    cout<<tt<<'\n';
    maxi2=max(maxi2,tt);

  }

}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//prime_sieve();
	//w(t)
	solve();
}


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include<numeric>//gcd(,),lcm(,)
#include<cmath>//sin(),cos(),tan()  kodoho
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 10000000;
using ll = long long;
using graph = vector<vector<int>>;

int main() {
	int si, sj;
	cin >> si >> sj;
	vector<vector<int>>t(50,vector<int>(50));
	vector<vector<int>>p(50,vector<int>(50));
	for (int i = 0; i < 50; i++) {
		for (int h = 0; h < 50; h++) {
			cin >> t[i][h];
		 }
	}
	for (int i = 0; i < 50; i++) {
		for (int h = 0; h < 50; h++) {
			cin >> p[i][h];
		}
	}
	set<int>watched;
	watched.insert(t[si][sj]);
      	while (true) {
			bool remain = false;
			int r, l, u, d;
			r = 0;
			l = 0;
			u = 0;
			d = 0;
			if (sj < 49) {
				if (!watched.count(t[si][sj + 1])) {
					r = p[si][sj + 1];
					remain = true;
				}
				else {
					r = -1;
				}
			}
			else {
				r = -1;
			}
			if (sj > 0) {
				if (!watched.count(t[si][sj - 1])) {
					l = p[si][sj - 1];
					remain = true;
				}
				else {
					l = -1;
				}
			}
			else {
				l = -1;
			}
			if (si > 0) {
				if (!watched.count(t[si - 1][sj]) ) {
					u = p[si - 1][sj];
					remain = true;
				}
				else {
					u = -1;
				}
			}
			else {
				u = -1;
			}
			if (si <49) {
				if (!watched.count(t[si +1][sj])) {
					d = p[si + 1][sj];
					remain = true;
				}
				else {
					d = -1;
				}
			}
			else {
				d = -1;
			}
		if (remain == false) {
			break;
		}
		if (max(l, r) == l && max(l, d) == l && max(l, u) == l) {
			cout << "L";
			watched.insert(t[si][sj-1]);
			sj = sj - 1;
			continue;
		}
		if (max(r, l) == r && max(r, d) == r && max(r, u) == r) {
			cout << "R";
			watched.insert(t[si][sj+1]);
			sj = sj + 1;
			continue;
		}
		if (max(u, l) == u && max(u, d) == u && max(r, u) == u) {
			cout << "U";

			watched.insert(t[si-1][sj]);
			si = si - 1;
			continue;
		}
		if (max(d, l) == d && max(r, d) == d && max(d, u) == d) {
			cout << "D";

			watched.insert(t[si+1][sj]);
			si = si + 1;
			continue;
		}
	}
}

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

int main() {
  vector<int> tileID(50 * 50);
  vector<int> steped(50 * 50);
  int x, y;
  string ans = "";
  cin >> y >> x;
  rep(i,50 * 50) {
    cin >> tileID[i];
  }
  steped[0] = tileID[50 * y + x];
  int i = 0;
  while(true) {
    if (*find(steped.begin(), steped.end(), tileID[50 * (y - 1) + x]) != tileID[50 * (y - 1) + x] && y != 0) {
      y -= 1;
      ans += 'U';
    } else if (*find(steped.begin(), steped.end(), tileID[50 * y + x - 1]) != tileID[50 * y + x - 1] && x != 0) {
      x -= 1;
      ans += 'L';
    } else if (*find(steped.begin(), steped.end(), tileID[50 * (y + 1) + x]) != tileID[50 * (y + 1) + x] && y != 49) {
      y += 1;
      ans += 'D';
    } else if (*find(steped.begin(), steped.end(), tileID[50 * y + x + 1]) != tileID[50 * y + x + 1] && x != 49) {
      x += 1;
      ans += 'R';
    } else {
      break;
    }
    i++;
    steped[i] = tileID[50 * y + x];
  }
  cout << ans << endl;
  return 0;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<random>
#include<iomanip>
#include<queue>
#include<stack>
#include<assert.h>
#include<time.h>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 2330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; 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;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight(int n) {
	int ans = 1;
	while (n >= 10) {
		n /= 10;
		ans++;
	}
	return ans;
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
signed main() {
	int a, b;
	cin >> a >> b;
	rep(i, max(a, b)) {
		if (max(a, b) == a)cout << i + 1 << " ";
		else cout << -(i + 1) << " ";
	}
	rep(i, min(a, b) - 1) {
		if (max(a, b) == a)cout << -i - 1 << " ";
		else cout << (i + 1) << " ";
	}
	int cc = (1 + max(a, b)) * max(a, b) / 2;
	int dd = min(a, b) * (min(a, b) - 1) / 2;
	if (max(a, b) == a)cout << -(cc - dd) << endl;
	else cout << cc - dd << endl;
	ggr
}

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

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

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

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
    cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

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

    if(x==y) cout << x << endl;
    else cout << (3-x-y)%3 << endl;
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

string calcpath(int si, int sj, int ti, int tj) {
  int i = ti - si;
  int j = tj - sj;

  char v = 'D';
  if(i < 0) {
    v = 'U';
  }
  char h = 'R';
  if(j < 0) {
    h = 'L';
  }

  string path = "";

  for(int x = 0; x < abs(i); x++) {
    path += v;
  }
  for(int x = 0; x < abs(j); x++) {
    path += h;
  }

  string random_path = "";

  while(path.size() > 0) {
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand100(0, path.size() - 1);
    int r = rand100(mt);
    random_path += path[r];
    path = path.erase(r, 1);
  }

  return random_path;
}

int main()
{
  int si;
  int sj;
  int ti;
  int tj;

  int path_length;

  for(int loop = 0; loop < 1000; loop++) {
    cin >> si;
    cin >> sj;
    cin >> ti;
    cin >> tj;

    int i = ti - si;
  	int j = tj - sj;

    string path = calcpath(si, sj, ti, tj);

    cout << path << endl;
    cin >> path_length;
  }

  return 0;
}

//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define bit(n) (1LL<<(n))
#define FIX(d) fixed << setprecision(d)
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const ll LINF = (1LL<<60);

int di[] = {-1, 1, 0, 0};
int dj[] = {0, 0, -1, 1};
const int H = 30, W = 30;

struct edge
{
  int to;
  int cost;

  edge(int _to, int _cost){
    to = _to;
    cost = _cost;
  }
};
using Graph = vector<vector<edge>>;

// 経路復元用
vector<ll> dijkstra(int s, const Graph &G, vector<int> &prev)
{
  int n = G.size();
  priority_queue<P, vector<P>, greater<P>> que;
  vector<ll> d(n, INF);
  prev.resize(n, -1);
  d[s] = 0;
  que.emplace(0, s);

  while (!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first) continue;

    for(auto nv: G[v]){
      if (d[nv.to] > d[v] + nv.cost){
        d[nv.to] = d[v] + nv.cost;
        prev[nv.to] = v;
        que.emplace(d[nv.to], nv.to);
      }
    }
  }
  return d;
}

string get_path(const vector<int> &prev, int t) {
  vector<int> path;
  for (int cur = t; cur != -1; cur = prev[cur]) {
    path.push_back(cur);
  }
  reverse(path.begin(), path.end());

  string pathString = "";
  REP(i,path.size()-1){
    if(path[i]-path[i+1]==1) pathString.push_back('L');
    else if(path[i]-path[i+1]==-1) pathString.push_back('R');
    else if(path[i]-path[i+1]==W) pathString.push_back('U');
    else pathString.push_back('D');
  }

  return pathString;
}

unsigned int xor128(){
  static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
  unsigned int t = (x^(x<<11));
  x=y; y=z; z=w;
  return( w=(w^(w>>19))^(t^(t>>8)) );
}

void init(Graph &G){
  REP(i,H) REP(j,W){
    int cur = i*W+j;
    REP(k,4){
      int ni = i+di[k];
      int nj = j+dj[k];
      if(ni<0 || ni>=H || nj<0 || nj>=H) continue;
      int next = ni*W+nj;
      G[cur].push_back(edge(next, 1000));
      G[next].push_back(edge(cur, 1000));
    }
  }
}

int main() {
  Graph G(H*W);
  init(G);

  REP(q,1000){
    int si, sj, ti, tj;
    cin >> si >> sj >> ti >> tj;
    int sp = si*W+sj;
    int tp = ti*W+tj;
    vector<int> prev;
    auto dist = dijkstra(sp, G, prev);
    string path = get_path(prev, tp);
    cout << path << endl;

    int score;
    cin >> score;
    double e = (9.0 + double(xor128() % 3)) * 0.1;
    score = round((double)score / e);
    int score_per = score / path.size();
    int cur = tp;
    while(cur!=sp){
      int next = prev[cur];
      for(auto &eg: G[cur]){
        if(eg.to!=next) continue;
        //chmax(eg.cost, score_per);
        eg.cost = score_per;
      }
      for(auto &eg: G[next]){
        if(eg.to!=cur) continue;
        //chmax(eg.cost, score_per);
        eg.cost = score_per;
      }
      cur = next;
    }
  }

  return 0;
}


#include <iostream>
using namespace std;

int main()
{
  double A, B;
  cin >> A >> B;
  cout << (1 - B / A) * 100.0 << endl;
  return 0;
}

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

#define LONG long int
#define ULONG unsigned long int
#define rep(r) for(int i = 0; i < r; ++i)
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"

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


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=17,M=(1<<17)+1,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int n,x[N],y[N],z[N];
ll dp[M][N];
il ll d(int a,int b){
	return abs(x[a]-x[b])+abs(y[a]-y[b])+max(0,z[b]-z[a]);
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&x[i],&y[i],&z[i]);
	}
	mst(dp,0x3f);
	dp[0][0]=0;
	for(int i=1;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if((i>>j)&1){
				for(int k=0;k<n;k++)
					dp[i][j]=min(dp[i][j],dp[i-(1<<j)][k]+d(k,j));
			}
		}
	}
	printf("%lld\n",dp[(1<<n)-1][0]);
	return 0;
}

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

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

int A[200200], B[200200];
const int mod = 998244353;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

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

	int N = getint();
	rep1(i, N) A[i] = getint();

	int kotae = 0;
	rep1(i, N) {
		if (B[i]) continue;
		int k = i;
		while (B[k] == 0) {
			B[k] = i;
			k = A[k];
		}
		kotae += (B[k] == i);
	}

	co(modpow(2, kotae) - 1);

	Would you please return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ms(x,a) memset(x,a,sizeof x)
typedef long long ll;
const int mod=1e9+7, seed=131, MAXN=0;

bool vis[12];

int main(){
    cin.tie(0)->sync_with_stdio(0);
    ll l, ans=1; cin >> l;
    for (int i=l-1;i>=l-11;--i){
        ans*=i;
        for (int j=1;j<=11;++j){
            if (vis[j]) continue;
            if (ans%j==0) vis[j]=1, ans/=j;
        }
    }
    cout << (ll)ans << '\n';
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
int main() {
    ll t;
    t = 1;
    while(t--){
  	    ll l,i,j;
  	    cin>>l;
  	    ll dp[201][12];
  	    for(i=0;i<200;i++)
  	    	dp[i][0] = 1;
  	    for(i=0;i<201;i++){
  	    	for(j=1;j<12;j++){
  	    		if(i>j)
  	    			dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
  	    		else if (i==j)
				  	dp[i][j] = 1;
				else
					dp[i][j] = 0;
			}
		}
		cout<<dp[l-1][11];
	}
   	return 0;
}


// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 11/01/20 20:25:34
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll a,b; cin>>a>>b;
    ans += b*(b+1)/2;
    ans -= (a-1)*a/2;
  }
  cout << ans << endl;

  return 0;
}

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

#include<cstdio>
#include<cstring>

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

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

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

	int N = getint();
	ll kotae = 0;

	rep(i, N) {
		int a = getint(), b = getint();
		kotae += ll(b - a + 1) * (b + a);
	}

	printf("%lld\n", kotae / 2);

	Would you please return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
const double pi = 2.0 * asin(1.0);
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
typedef vector<ll> vec;
typedef vector<vec> mat;
//A*Bの計算
mat mul(mat &A, mat &B)
{
    mat C(A.size(), vec(B[0].size()));
    for (ll i = 0; i < A.size(); i++)
    {
        for (ll k = 0; k < B.size(); k++)
        {
            for (ll j = 0; j < B[0].size(); j++)
            {
                C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
            }
        }
    }
    return C;
}

//A^nの計算
mat pow(mat A, ll n)
{
    mat B(A.size(), vec(A.size()));
    for (ll i = 0; i < A.size(); i++)
    {
        B[i][i] = 1;
    }
    while (n > 0)
    {
        if (n & 1)
            B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}
ll modpow(ll a, ll n, ll mod)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a % mod * (a % mod) % mod;
        n >>= 1;
    }
    return res;
}
int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    vector<ll> x(m), y(m);
    vector<ll> d[n];
    rep(i, m)
    {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
        d[x[i]].emplace_back(y[i]);
        d[y[i]].emplace_back(x[i]);
    }
    mat A(n, vec(n));
    rep(i, n)
    {
        rep(j, d[i].size())
        {
            A[i][d[i][j]] = modpow(2 * m, MOD - 2, MOD);
        }
        A[i][i] = (2 * m - d[i].size()) * modpow(2 * m, MOD - 2, MOD) % MOD;
    }
    A = pow(A, k);
    vector<ll> ans(n);
    rep(i, n)
    {
        rep(j, n)
        {
            ans[i] = (ans[i] + a[j] * A[j][i]) % MOD;
        }
    }
    rep(i, n)
    {
        cout << ans[i] << endl;
    }
}

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

int A,B;
long long K, dp[61][31];

int main() {
    scanf("%d %d %lld", &A, &B, &K);
    memset(dp,0,sizeof(dp));
    for (int i = 0; i <= A+B; ++i) for (int j = 0; j <= A && j <= i; ++j) {
        if (j == 0) dp[i][j] = 1;
        else dp[i][j] = dp[i-1][j] + dp[i-1][j-1];
    }
    int a = A;
    for (int i = A+B; i > 0; --i) {
        if (a != 0 && dp[i-1][a-1] >= K) {
            printf("a");
            a--;
        }
        else {
            printf("b");
            K -= dp[i-1][a-1];
        }
    }

    return 0;
}


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

int main(){
    int X;
    cin>>X;
    if(X<0){
        cout<<0<<endl;
    }else{
        cout<<X<<endl;
    }
}

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

int main(){
    int c;
    cin >> c;
    cout << max(0,c) << endl;
}


#include <cassert>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <fstream>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <time.h>
#include <chrono>
#include <random>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#define UI unsigned int
#define LL long long
#define ll long long
#define GT(it,v) for(auto it:v)
#define FU(i,a,b) for(int i=(a);i<(b);i++)
#define FD(i,a,b) for(int i=(a);i>(b);i--)
#define LD long double
#define PI 3.1415926535897932384626
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VLL vector<long long >
#define VVLL vector<vector<long long > >
#define VPLL vector<pair<long long, long long>>
#define VVPLL vector<vector<pair<long long, long long>>>
#define VD vector<double>
#define VVD vector<vector<double> >
#define VPD vector<pair<double,double> >
#define MP make_pair
#define PB push_back
#define FI first
#define SE second
#define SORT(v) std::sort(v.begin(),v.end())
#define GSORT(v,T) sort(v.begin(),v.end(),greater<T>)
#define UNIQUE(v) decltype(v.begin()) it = unique(v.begin(),v.end()); v.resize(distance(v.begin(),it))
using namespace std;
LL inp, Inp; LL i1, i2, i3, i4, i5, i6, i7, i8;
LL MOD = 998244353, MOD1 = (LL)1e9 + 7, MOD2 = (LL)1e9 + 9; long long MOD3 = (long long)1e9 + 21 /*33*/;  double eps = 1e-9;
LL TMP = (chrono::high_resolution_clock::now().time_since_epoch().count() % MOD + MOD) % MOD;
auto STTMP = chrono::steady_clock::now();//auto ENTMP = chrono::steady_clock::now();
//ELTIME = double(chrono::duration_cast<chrono::milliseconds>(ENTMP - STTMP).count());
//time_t result = time(NULL); char SS[26]; ctime_s(SS, sizeof SS, &result);
//transform(SS, SS + 26, SS, [](char ch) {return ch == ' ' ? '_' : ch; }); printf("%s", SS);;

int main() {
    ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(20);
    srand((unsigned int)TMP);
    LL T; cin >> T;
    FU(t, 0, T) {
        LL N; cin >> N;
        if (N % 4 == 0) {
            cout << "Even\n";
        }
        else if (N % 2 == 0) {
            cout << "Same\n";
        }
        else {
            cout << "Odd\n";
        }
    }

    return 0;
}

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

int main() {
  int64_t T, count;
  cin >> T;
  vector<int64_t> c(T);
  for (int i = 0; i < T; i++) {
    cin >> c.at(i);
    count = 0;
    while (c.at(i) > 0) {
      if (c.at(i) % 2 > 0) {
        break;
      }
      c.at(i) = c.at(i) / 2;
      count++;
    }
    if (count < 1) {
      cout << "Odd" << endl;
    }
    else if (count > 1) {
      cout << "Even" << endl;
    }
    else {
      cout << "Same" << endl;
    }
  }
}


// Coder: @SumitRaut
#include <bits/stdc++.h>
#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
using namespace std;

#define debug1(x) cout<<#x<<' '<<x<<'\n'
#define debug2(x,y) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<'\n'
#define debug3(x,y,z) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<'\n'
#define ll long long

#ifndef ONLINE_JUDGE
class Timer { chrono::high_resolution_clock::time_point start_t, end_t; public: Timer() { start_t=chrono::high_resolution_clock::now(); } ~Timer() { end_t = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(end_t-start_t); cerr<<"\nRunTime: "<<duration.count()<<"ms"<<'\n'; } };
#endif
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for(auto& it:v)
        is>>it;
    return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (auto &it : v)
        os << it << ' ';
    return os;
}

void solve() {
    int a,b;
    cin>>a>>b;
    cout<<((a+b)>>1)<<' '<<((a-b)>>1)<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    Timer timer;
    #endif
    speedup;
    // int t; cin>>t; while(t--)
    solve();
    // system("pause");
    return 0;
}

#include <bits/stdc++.h>
#include <cmath>
#define ll long long
#define m 1000000007

using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int x,y;
	x = (a+b)/2;
	y = a-x;
	cout<<x<<" "<<y;
}