#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
T gcd(T a, T b)
{
    return b ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a,T b)
{
    return  a / gcd(a,b) * b;
}
#define MAX_N 100005

vector<int> prime;
bool is_prime[MAX_N];

void sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int main(){
    sieve(50);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    int m = prime.size();
    ll mi = (1LL<<60);
    rep(i,(1<<m)){
        ll X = 1;
        rep(j,m){
            if((i>>j)&1){
                X *= prime[j];
            }
        }
        bool ng = 0;
        rep(i,n){
            if(gcd(X,a[i])==1){
                ng = 1;
                break;
            }
        }
        if(!ng){
            chmin(mi,X);
        }
    }
    cout << mi << endl;
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
#define INF 3000000000000001 // 3e15
#define ll_max 9000000000000000000
#define PI 3.14159265358979323846L
#define fill(a, n, x) for(int i = 0; i < n; i++) a[i] = x;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll mod = 1000000007;
const ll N = 200110;
const ll M = log2(N) + 1;

struct point
{
    ll x, y;
};

template<typename T>
T fast_exp(T x,T n)
{
    if(n == 0) return 1;
    T ans = 1;
    if(n % 2 == 0)
    {
         ans = fast_exp(x, n / 2);
         ans = ans * ans % mod;
    }
    else ans = fast_exp(x, n - 1) * x % mod;
    return ans;
}

void update(ll BIT[], ll i, ll x, ll n)
{
    if(i <= 0) return;
    for(; i <= n; i += i & (-i))
        BIT[i] += x;
}

ll query(ll BIT[], ll l, ll r)
{
    l--;
    ll sum = 0;
    while(r > 0)
    {
        sum += BIT[r];
        r = r & (r - 1);
    }
    while(l > 0)
    {
        sum -= BIT[l];
        l = l & (l - 1);
    }
    return sum;
}

ll fact[2], infact[2];
void work()
{
    fact[0] = fact[1] = infact[0] = infact[1] = 1;
    for(ll i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i % mod;
        infact[i] = fast_exp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    if(r > n || r < 0) return 0;
    return fact[n] * infact[n - r] % mod * infact[r] % mod;
}

vector<int> p;
int smfactor[N + 1]; // smallest prime factor
void SoE(int n = N)
{
    bool Primes[n + 1];
    Primes[0] = Primes[1] = 0;
    for(int i = 2; i < n + 1; i++)
        Primes[i] = 1;
    for(int i = 2; i <= n; i++)
    {
       if(Primes[i] == 1)
       {
           p.push_back(i);
           for(int j = i; j <= n; j += i)
           {
               Primes[j] = 0;
               if(smfactor[j] == 0)
                    smfactor[j] = i;
           }
       }
    }
}

int main()
{
    fast;
    int _ = 1, test = 0;
    SoE(50);
    //cin >> _;
    while(_--)
    {
        test++;
        ll n, m = 0, x, y, ans = INF, k, q;
        cin >> n;
        m = p.size();
        ll a[n + 1];
        for(int i = 1; i <= n; i++)
        {
            cin >> a[i];
        }
        y = 1;
        for(int j = 0; j < m; j++) y = y * p[j];
        ans = y;
        for(ll i = 0; i < (1ll << m); i++)
        {
            y = 1;
            for(int j = 0; j < m; j++)
            {
                if(i & (1ll << j))
                {
                    y = y * p[j];
                }
            }
            bool flag = 1;
            for(int j = 1; j <= n; j++)
            {
                if(__gcd(y, a[j]) == 1)
                    flag = 0;
            }
            if(flag)
                ans = min(ans, y);
        }
        cout << ans << "\n";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

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

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

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

	int n, m;
	scanf("%d%d", &n, &m);
	if (n == 1) {
		if (m != 0) {
			printf("-1\n");
		} else {
			printf("1 2\n");
		}
		return 0;
	}
	if (m < 0 || m > n - 2) {
		printf("-1\n");
		return 0;
	}
	printf("1 10000000\n");
	int x = 2;
	int k = n - m - 2;
	for (int i = 0; i < k + 1; i++)
		printf("%d %d\n", x + i, x + k + 1 + i);
	x += 2 * (k + 1);
	for (int i = 0; i < m; i++) {
		printf("%d %d\n", x, x + 1);
		x += 2;
	}

	return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const ll mod = 998244353;
long long modpow(long long a, long long n){
  long long r = 1;
  while (n) {
    r = r * ( (n%2)?a:1 ) %mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}

int main(void){
    ll n,m,k;cin>>n>>m>>k;
    ll res=0;
    if(m==1){
        ll res=modpow(k,n);
        cout<<res<<endl;
        return 0;
    }
    else if(n==1){
        ll res=modpow(k,m);
        cout<<res<<endl;
        return 0;
    }
    rep(i,k){
        ll buf1=modpow(k-i,m),buf2=modpow(k-i-1,m);
        ll buf3=modpow(i+1,n);
        ll buf4=(((buf1-buf2+mod)%mod)*buf3)%mod;
        res+=buf4;
        res%=mod;
    }
    cout<<res<<endl;
}


//https://atcoder.jp/contests/arc108/tasks/arc108_a
//A - Sum and Product
//从 1 到 sqrt(P) 中枚举是否存在 N 和 M。
#include <bits/stdc++.h>

using namespace std;

//如果提交到OJ，不要定义 __LOCAL
//#define __LOCAL

int main() {
#ifndef __LOCAL
    //这部分代码需要提交到OJ，本地调试不使用
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    long long s,p;
    cin>>s>>p;

    long long t=sqrt(p);
    for (long long i=1; i<=t; i++) {
        long long n=i;
        long long m=s-i;
        if (n*m==p) {
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";

#ifdef __LOCAL
    //这部分代码不需要提交到OJ，本地调试使用
    system("pause");
#endif
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#define int long long

using namespace std;

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

int s, p;

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    s = read(), p = read();
    for (int i = 1; i * i <= p; ++ i)
    {
        if (p % i == 0)
        {
            if (i + p / i == s)
            {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}


#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <deque>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <stdio.h>
#include <time.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)

#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  ll b = 0;
  vector<ll> v1,v2;
  rep(i,0,n){
    ll a;
    cin>>a;
    v1.pb(a);
  }
  rep(i,0,n){
    ll a;
    cin>>a;
    v2.pb(a);
  }
  rep(i,0,n){
    b += v1[i]*v2[i];
  }
  if(b==0){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k,m;
  cin >> n >> k >> m;
  int sum=0;
  vector<int>a(n-1);
  for(int i=0;i<n-1;i++) {
    cin >> a.at(i);
    sum+=a.at(i);
    }
  int x=m*n-sum;
  if(x>k) {
    cout << -1 << endl;}
  else if (x<=k && x>=0) {
    cout << x << endl;}
  else {
    cout << 0 << endl;}

  return 0;
  }


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

int main(){
    int V, T, S, D;
    cin >> V >> T >> S >> D;

    string ans = "Yes";
    if(V*T <= D){
        if(V*S >= D){
            ans = "No";
        }
    }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define mapi map<int, int>
#define mapl map<ll, ll>
#define pb push_back
#define fast_cin()                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define tsolve(t) \
    int t;        \
    cin >> t;     \
    while (t--)   \
    {             \
        solve();  \
    }
void solve()
{
    double v, t, s, d;
    cin >> v >> t >> s >> d;
    double tt = d / v;
    //cout << tt << endl;
    if (t <= tt && tt <= s)
    {
        cout << "No";
        return;
    }
    cout << "Yes";
    return;
}
int main()
{
    fast_cin();
    // tsolve(t)
    solve();
    return 0;
}


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

vector<vector<int>> binoms(17,vector<int>(17,-1));

int binom(int n, int r){
    if(binoms[n][r] != -1) return binoms[n][r];
    int ans = 1;
    for(int i = 0; i < r; i ++){
        ans *= n-i;
        ans /= i+1;
    }
    return binoms[n][r] = ans;
}

int powmod(int a, int n){
    if(n == 0) return 1;
    int s = powmod(a,n/2);
    s = (s*s) % MOD;
    if(n % 2) return (a*s) % MOD;
    else return s;
}

int scent(int a, int k, int n){ //n digits, a already used
    if(n == 0) return (a == k ? 1 : 0);
    if(a > k) return 0;
    int ans = 0;
    int sign = 1;
    for(int j = k; j >= a; j --){
        ans = (ans + (sign*binom(k-a,j-a)*powmod(j,n)) % MOD + MOD) % MOD;
        sign *= -1;
    }
    return ans*binom(16-a,k-a) % MOD;
}

signed main(){
    string n; int k; cin >> n >> k;
    int s = n.size();
    vector<int> N(s); for(int i = 0; i < s; i ++) N[i] = (n[i] <= '9' ? n[i] - '0' : n[i] - 'A' + 10);
    int ans = 0;
    for(int i = 1; i < s; i ++){
        ans = (ans + 15*scent(1,k,i-1)) % MOD;
        //cout << scent(1,k,i-1) << " " << 1 << " " << k << " " << i-1 << "\n";
    }
    vector<bool> digs(16);
    int counter = 0;
    for(int i = 0; i < s; i ++){
        for(int j = 0; j < N[i]; j ++){
            if(i == 0 && j == 0) continue;
            int curcounter = counter;
            if(!digs[j]) curcounter ++;
            ans = (ans + scent(curcounter,k,s-i-1)) % MOD;
            //cout << scent(curcounter,k,s-i-1) << " " << curcounter << " " << k << " " << s-i-1 << "\n";
        }
        if(!digs[N[i]]) counter ++;
        digs[N[i]] = true;
    }
    if(counter == k) ans ++;
    cout << ans;
}

//in the name of god//
// SOBHET BEKHEIR JOOOOOOON E DEL

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define  mem(x,s)	memset(x,s,sizeof(x))
#define all(x)	x.begin(),x.end()
#define _ ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define endi return cout<<'\n',0
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 1e5 + 10;
const int maxn1 = 1e3 + 10;
const ll inf = 1e18;
map <ll,ll> dp;
ll f(ll a, ll b){
    if(a >= b)
        return a - b;

    if(dp.count(b))
		return dp[b];

    else{
        ll tmp = b - a;
        if(b & 1)
            tmp = min (tmp, min(f(a, (b + 1ll) / 2ll), f(a, (b - 1ll) / 2ll)) + 2ll);

        else
           tmp = min (tmp, f(a, b / 2) + 1);

        return dp[b] = tmp;
    }
}
int main(){
    ll x, y;
    cin >> x >> y;
    cout << f(x, y) << '\n';
	return 0;
}


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

using P = pair<int64_t, int64_t>;

int64_t my_abs(int64_t a) { return max(a, -a); }

int64_t gcd(int64_t a, int64_t b) {
  while (b != 0) {
    int64_t tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}

P calc(int64_t a, int64_t b) {
  int64_t aa = my_abs(a);
  int64_t ab = my_abs(b);
  int64_t ta = aa;
  int64_t tb = ab;
  map<int64_t, int64_t> m;
  m[ta] = 1;
  m[tb] = 0;
  while (tb != 1) {
    int64_t tmp = ta % tb;
    m[tmp] = m.at(ta) - m.at(tb) * (ta / tb);
    ta = tb;
    tb = tmp;
  }
  int64_t x = m.at(1);
  if (aa == -a) {
    x *= -1;
  }
  int64_t y = (1 - x * a) / b;
  return make_pair(x, y);
}

int64_t div_ceil(int64_t a, int64_t b) {
  if (a >= 0) {
    return (a + b - 1) / b;
  } else {
    return a / b;
  }
}

int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    int64_t N, S, K;
    cin >> N >> S >> K;
    int64_t g = gcd(N, K);
    if (S % g != 0) {
      cout << -1 << endl;
      continue;
    }
    int64_t n = N / g;
    int64_t s = S / g;
    int64_t k = K / g;
    int64_t tx, ty;
    tie(tx, ty) = calc(n, -k);
    tx *= s;
    ty *= s;
    int64_t m = max(div_ceil(1 - tx, k), div_ceil(1 - ty, n));
    cout << n * m + ty << endl;
  }
  return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

void init(){

}

long long int gcd(long long int a,long long int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    return gcd(b,a%b);
}

void solve(){
    LL n,m;
    int i,j,k;
    LL a,b,c;
    LL p,q;
    const LL B=4e4;
    cin>>n>>p>>q;
    map<LL,LL> m1;
    q%=n;
    a=q*B%n,b=0;
    for(i=0;i<B;i++,b-=a){
        if(b<0)b+=n;
        if(m1.find(b)!=m1.end())break;
        m1[b]=i;
    }
    LL s=0;
    a=p;
    for(i=0;i<B;i++,a+=q){
        if(a>=n)a%=n;
        if(m1.find(a)!=m1.end()){
            s=i+B*m1[a];
            break;
        }
    }
    if(i>=B){
        cout<<-1<<endl;
        return;
    }
    a=gcd(n,q);
    s%=n/a;
    cout<<s<<endl;
    return;
}

int main(){
    int n,i;
    init();
    cin>>n;
    for(i=0;i<n;i++){
        solve();
    }
}


//@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 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

double A[200010];
double B[200010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    INT(n, m, k);
    vi a(k);
    cin >> a;
    if (m <= k) {
        rep(i, k - m + 1) {
            bool ok = true;
            rep(j, m - 1) ok &= a[i + j] + 1 == a[i + j + 1];
            if (ok) fin(-1);
        }
    }
    cout << fixed << setprecision(10);
    rrep(i, n) {
        bool ok = true;
        rep(j, k) if (i == a[j]) ok = false;
        double na, nb;
        if (ok) {
            na = (A[i + 1] - A[i + m + 1]) / m;
            nb = (B[i + 1] - B[i + m + 1]) / m + 1;
        } else {
            na = 1, nb = 0;
        }
        A[i] = A[i + 1] + na;
        B[i] = B[i + 1] + nb;
    }
    double na = A[0] - A[1], nb = B[0] - B[1];
    // X = na * X + nb
    print(nb / (1 - na));
}

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

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

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

    vector< complex< double > > means(N);
    rep(i, K) {
        int a;
        cin >> a;
        means[a].imag(1);
    }

    complex< double > acc = 0;
    int l = 0;
    int suc_mass = 0;
    for(int k = N - 1; k >= 0; k--) {
        if(means[k].imag() == 0) {
            means[k] += M;
            means[k] += acc;
            means[k] /= M;
            suc_mass = 0;
        } else {
            ++suc_mass;
            if(suc_mass >= M)
                break;
        }
        acc += means[k];
        ++l;
        if(l > M) {
            acc -= means[k + M];
            --l;
        }
    }
    // cout << means[0].real() << ", " << means[0].imag() << endl;
    if(suc_mass >= M) {
        cout << -1 << endl;
    } else {
        double res = means[0].real();
        res /= (1.0 - means[0].imag());
        cout << res << endl;
    }
}


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

int gcd(int a, int b)
{
	if (b == 0) return a;
	return (gcd(b, a % b));
}

int a[MAX];
signed main(void)
{
	int n, ans, max, cnt;

	cin >> n;
	rep(i, n) cin>>a[i];
	max = 0;
	ans = -1;
	for (int g = 2; g <= 1000; g++)
	{
		cnt = 0;
		rep(i, n)
		{
			if (g == gcd(g, a[i]))
				cnt++;
		}
		if (max <= cnt)
		{
			ans = g;
			max = cnt;
		}
	}
	cout << ans << endl;
	return 0;
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define F first
#define S second
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 60;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;

int main(int argc, char const* argv[])
{
  int n; cin >> n;
  vector<ll> a(n); cin >> a;
  int maxi = 0, res = 0;
  for(int i = 2; i <= 1000; i++){
    int tmp = 0;
    rep(j, n){
      if(a[j] % i == 0)++tmp;
    }
    if(chmax(maxi, tmp))res = i;
  }
  cout << res << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
char t[300005];
void solve(){
	ll n;
	string s;
	cin>>n>>s;
	if(s=="1"){
		cout<<ll(2*pow(10,10));
		return;
	}
	ll j=0;
	while(j<300005){
		if(j%3==2)
			t[j]='0';
		else
			t[j]='1';
		j++;
	}
	for(ll i=0;i<3;i++){
		ll f=0;
		for(ll j=i;j<i+n;j++)
			if(s[j-i]!=t[j]){
				f=1;
				break;
			}
		if(!f){
			cout<<ll(pow(10,10))-(n+i-1)/3;
			return;
		}
	}
	cout<<0;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++)
        solve();
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

// #pragma GCC optimize(2)
// #include <random>
// #include <windows.h>
// #include <ctime>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <bitset>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define IO                       \
    ios::sync_with_stdio(false); \
    // cout.tie(0);
#define lson(x) (x << 1)
#define rson(x) (x << 1 | 1)
using namespace std;
// int dis[8][2] = {0, 1, 1, 0, 0, -1, -1, 0, 1, -1, 1, 1, -1, 1, -1, -1};
typedef unsigned long long ULL;
typedef long long LL;
typedef pair<int, int> P;
const int maxn = 2e5 + 10;
const int maxm = 1e7 + 10;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const LL mod = 998244353;
const double eps = 1e-8;
const double pi = acos(-1);
int dis[4][2] = {1, 0, 0, -1, 0, 1, -1, 0};
// int m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char s[maxn];
int main()
{
#ifdef WXY
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif
    // IO;
    int n;
    // cin >> n;
    scanf("%d", &n);
    scanf("%s", s + 1);
    LL temp = LL(pow(10, 10));
    if (n == 1)
    {
        if (s[1] == '1')
            cout << temp * 2;
        else
            cout << temp;
        return 0;
    }
    else if (n == 2)
    {
        if (s[1] == '0' && s[2] == '0')
            cout << 0;
        else if (s[1] == '1' && s[2] == '1')
            cout << temp;
        else if (s[1] == '0' && s[2] == '1')
            cout << temp - 1;
        else
            cout << temp;
        return 0;
    }
    int p = -1;
    for (int i = 1; i <= n; i++)
    {
        if (s[i] == '0')
        {
            p = i;
            break;
        }
    }
    if (p > 3 || (p == -1))
    {
        cout << 0;
        return 0;
    }
    for (int i = p; i <= n; i++)
    {
        if (s[i] == '0')
        {
            if (i == n)
                break;
            else if (i + 3 <= n && s[i + 1] == '1' && s[i + 2] == '1' && s[i + 3] == '0')
                continue;
            else if (i + 2 == n && s[i + 1] == '1' && s[i + 2] == '1')
                continue;
            else if ((i + 1 == n && s[i + 1] == '1'))
                break;
            else
            {
                cout << 0;
                return 0;
            }
        }
    }
    if (s[n - 1] == '0' && s[n] == '1')
        n += 2;
    else if (s[n - 1] == '1' && s[n] == '1')
        n += 1;

    if (p == 2)
        n += 1;
    if (p == 1)
        n += 2;

    LL cnt = n / 3;
    cout << LL(pow(10, 10)) - cnt + 1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++){
    cin >> p[i];
  }
  set<int> st;
  for (int i = 0; i <= 200000; i++){
    st.insert(i);
  }
  for (int i = 0; i < N; i++){
    if (st.count(p[i])){
      st.erase(p[i]);
    }
    cout << *st.begin() << endl;
  }
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; }
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define RFOR(i,l,r) for (int i = (r)-1; (l) <= i; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define CIN(c) cin >> (c)
#define COUT(c) cout << (c) << '\n'
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const int INF = (1 << 30) - 1;  // 1073741824 - 1
// static const ll INF = (1LL << 62) - 1;  // 4611686018427387904 - 1
// --------------------------------------------------------
// #include <atcoder/all>
// using namespace atcoder;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    int N; cin >> N;
    VI P(N); REP(i,N) cin >> P[i];

    const int MAX_P = 2e5;
    VB seen(MAX_P + 2, false);
    int min = 0;
    for (int p : P) {
        seen[p] = true;
        while (seen[min]) { min++; }
        COUT(min);
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long i64;
typedef unsigned long long ui64;
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef pair<i64, i64> pi;

#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)
inline void RI(i64 &i) {scanf("%lld", &(i));}
inline void RVI(vi &v) { for(i64 i=0;i<sz(v);++i) { RI(v[i]); } }
inline void RVVI(vvi &vv) { for(i64 i=0;i<sz(vv);++i) { RVI(vv[i]); } }
inline void WI(const i64 &i) {printf("%lld\n", i);}
inline void WVI(const vi &v, char sep=' ') { for(i64 i=0;i<sz(v);++i) { if(i != 0){ printf("%c", sep); } printf("%lld", v[i]);} printf("\n"); }
inline void WS(const string &s) { printf("%s\n", s.c_str()); }
inline void WB(bool b, const string &yes, const string &no) { if(b){ WS(yes);} else { WS(no);} }
inline void YESNO(bool b) { WB(b, "YES", "NO"); }
inline void YesNo(bool b) { WB(b, "Yes", "No"); }
#define BUF_LENGTH 1000000
inline void RS(string &s) {static char buf[BUF_LENGTH]; scanf("%s", buf); s = buf;}
template<typename T> inline bool IN(T &S, const typename T::key_type &key) {
  return S.find(key) != S.end();
}
template<typename T> inline bool ON(const T &b, i64 idx) {
  return ((T(1) << idx) & b) != 0;
}

int main(int argc, char *argv[]) {
  i64 i, j, k;
  i64 T, t; RI(T);
  REP(0, T, t) {
    i64 N; RI(N);
    vi p(N); RVI(p);
    vi p0 = p;
    for(auto &pp: p) {
      --pp;
    }

    unordered_set<i64> pos[2];
    REP(0, N-1, i) {
      if(p[i] > p[i+1]) {
        pos[i%2].insert(i);
      }
    }

#if 0
    WVI(p);
    cerr << "pos: ";
    for(auto &pp: pos[0]) { cerr << pp << " "; }
    for(auto &pp: pos[1]) { cerr << pp << " "; }
    cerr << endl;
#endif

    vi ans;
    i64 cur = 0;
    while(!pos[0].empty() || !pos[1].empty()) {
      //cerr << endl;
      i64 pr = -1;
      if(pos[cur%2].empty()) {
        pr = cur % 2;
      }
      else {
        pr = *pos[cur%2].begin();
      }
      ans.pb(pr+1);

      //cerr << "swap " << pr << " " << pr + 1 << endl;
      swap(p[pr], p[pr+1]);
      for(i64 i=pr-1;i<=pr+1;++i) {
        if(0 <= i && i < N - 1) {
          if(p[i] > p[i+1]) {
            pos[i%2].insert(i);
          }
          else {
            auto it = pos[i%2].find(i);
            if(it != pos[i%2].end()) {
              pos[i%2].erase(it);
            }
          }
        }
      }
      ++cur;

#if 0
      WVI(p);
      cerr << "pos: ";
      for(auto &pp: pos[0]) { cerr << pp << " "; }
      for(auto &pp: pos[1]) { cerr << pp << " "; }
      cerr << endl;
#endif
    }

    REP(0, N, i) {
      if(p[i] != i) {
        WVI(p0);
        WVI(p);
      }
      assert(p[i] == i);
    }
    assert(sz(ans) <= N * N);
    WI(sz(ans));
    WVI(ans);
  }

  return 0;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    long long arr[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>arr[i][j];
        }
    }
    int dif[n];
    int min=arr[0][0],minindex=0;
    for(int i=1;i<n;i++){
        if(arr[i][0]<min){
            min=arr[i][0];
            minindex=i;
        }
    }

    for(int i=0;i<n;i++){
        dif[i]=arr[i][0]-arr[minindex][0];
        for(int j=0;j<n;j++){
            if( ( arr[i][j] - arr[minindex][j] ) != dif[i] ){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    for(int i=0;i<n;i++){
        cout<<dif[i]<<" ";
    }
    cout<<endl;
    for(int i=0;i<n;i++){
        cout<<arr[minindex][i]<<" ";
    }
    cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef double db;
int main()
{
	int n,dm,hm;
	cin>>n>>dm>>hm;
	int d,h;
	db ans=1.0*hm/dm;
	while(n--)
	{
		scanf("%d %d",&d,&h);
		ans=min(ans,1.0*(hm-h)/(dm-d));
	}
	printf("%.15lf",hm-dm*ans);
	return 0;
}

// DeNsE - EcLiPsE //
// WHAT is DEAD may NEVER die //

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstring>
#include <stack>
#include <sstream>
#include <queue>
#include <unordered_set>
#include <cstdlib>

using namespace std;

#define nitro ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define double long double
#define endl " \n"

const int inf = (1ll << 62) - 1;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
const double pi = 3.14159265358979323846;

int bPow(int a, int b){
    int res = 1;
    while(b) {
        if (b & 1) {
            res = (res * a) % mod;
        }
        b >>= 1;
        a = (a * a) % mod;
    }
    return res % mod;
}

int gcd(int a, int b)
{
    if(a < b)
        swap(a, b);
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

vector<int> fact(N, 0ll);
void factorial(){
    fact[0] = 1, fact[1] = 1;
    for(int i = 2; i < N; i++){
        fact[i] = (fact[i - 1] * i) % mod;
    }
}

int ncr(int n, int r){
    if(r > n)
        return 0;
    int ans = fact[n] % mod;
    ans *= bPow(fact[r], mod - 2) % mod;
    ans %= mod;
    ans *= bPow(fact[n - r], mod - 2) % mod;
    ans %= mod;
    return ans;
}

vector<int> primes(N, -1);
void sieve(){
    iota(primes.begin(), primes.end(), 0);
    for (int i = 2; i * i <= N; ++i) {
        if(primes[i] == i){
            for (int j = 2 * i; j < N; j += i) {
                primes[j] = i;
            }
        }
    }
}

bool check(vector<pair<double, double> > a, double y1, double x2, double y2){
    double slope = (double) (y2 - y1) / (double) x2;
    for (auto & i : a) {
        double x3 = i.first, y3 = i.second;
        double temp = (double) (y3 - y1) / (double) x3;
        if(temp >= slope){
            return false;
        }
    }
    return true;
}

void solve() {
    int n;
    double b, h;
    cin >> n >> b >> h;
    vector<pair<double, double>> obs;
    for (int i = 0; i < n; ++i) {
        double x, y;
        cin >> x >> y;
        obs.emplace_back(x, y);
    }
    double l = 0.0, r = 1000.0, ans = 0.0;
    while (l < r){
        double mid = (l + r) / 2.0;
        if(check(obs, mid, b, h)){
            ans = mid;
            r = mid - 0.00001;
        }else{
            l = mid + 0.00001;
        }
    }
    cout << ans << endl;
}

signed main(){
    nitro
    int tc = 1, test = 1;
    //cin >> tc;
    while(tc--){
        //cout << "Case #" << test++ << ": ";
        solve();
    }
}


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

bool check(long long k, long long middle, vector<vector<long long>> &b){
  if(k >= b[middle][2]){return (true);}
  else{return (false);}
}

int main(){
  int n, q; cin >> n >> q;
  vector<long long> a(n+1), k(q);
  for(int i = 0; i < n; ++i){cin >> a[i];}
  a[n] = 1LL<<60;

  vector<vector<long long>> b;
  long long s = 1, ccount = 1;
  for(int i = 0; i <= n; ++i){
    long long e = a[i];
    if(e - s == 0){s = e + 1;}
    else{
      vector<long long> tmp = {s, e-1, ccount};
      ccount += e - s;
      b.emplace_back(tmp);
      s = e + 1;
    }
  }

  for(int i = 0; i < q; ++i){
    long long k; cin >> k;
    long long bottom = 0, top = b.size(), middle;
    while(top - bottom > 1){
      middle = (bottom + top)/2;
      if(check(k, middle, b) == true){bottom = middle;}
      else{top = middle;}
    }
    int p = bottom;
    cout << b[p][0] + k - b[p][2] << endl;
  }
}

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

// https://www.geeksforgeeks.org/ordered-set-gnu-c-pbds/
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,s,e) for(int i=s ; i < e ; i++)
#define rrep(i,s,e) for(int i=s ; i > e ; i--)
#define srep(i,s,e,j) for(int i=s ; i < e ; i+=j)
#define tr(i,x) for(auto i : x)
#define vinp(a) for(int i=0 ; i<a.size() ; i++)cin>>a[i]
#define ainp(a,n) for(int i=0; i<n; i++)cin>>a[i]
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vb vector<bool>
#define vpi vector<pii>
#define maxpqi priority_queue<int>
#define minpqi priority_queue <int, vector<int>, greater<int> >
#define pii pair<int,int>
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define pf push_front
#define endl '\n'
#define gcd(a,b) __gcd(a,b)
#define clr(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define lb lower_bound
#define ub upper_bound
#define npos string::npos
#define all(x) x.begin(),x.end()
#define sayyes cout << "YES" << endl
#define sayno cout << "NO" << endl

string a="ALICE",b="BOB";

void solve(){
    int n,q;cin>>n;cin>>q;
    int a[n+1];a[0]=0;
    int b[n+1];b[0]=0;
    rep(i,1,n+1){
        cin>>a[i];
        b[i] = a[i]-i;
    }
    // int q;cin>>q;
    while(q--){
        int k;cin>>k;
        // cout << "findng " << k << "th" << endl;

        // auto it = lb(b, b+)
        int pos = lb(b,b+n+1,k)-b;
        // cout << "pos : " << pos << endl;
        pos--;
        // cout << "pos--" << endl;
        // cout << "b[pos] : " << b[pos] << endl;
        cout << a[pos]+k-b[pos] << endl;
        // cout << "--> " << a[pos]+k-b[pos] << endl;
    }
    // cout<<endl;
}

int32_t main()
{
    fastio
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    solve();
    return 0;
}


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

int main(){
  int n,w;
  cin>>n>>w;
  vector<ll> a(200005,0),b(200005,0);
  rep(i,n){
    int s,t,p;
    cin>>s>>t>>p;
    a[s]+=p;
    a[t]-=p;
  }
  ll now=0;
  bool ok=true;
  rep(i,200005){
    now+=a[i];
    b[i]=now;
    if(b[i]>w) ok=false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

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

    ll curr [200005];
    memset( curr , 0 , sizeof(curr ) );
    for(int i=0;i< n;i++)
    {
        ll s , t, p;
        cin>>s>>t>>p;
        curr[s] += p;
        curr[t] += -p;
    }

    for(int i=0;i<200004;i++)
    {
        curr[i+1] +=curr[i];
        if( curr[i] > w )
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}


#include<bits/stdc++.h>
using namespace std;
#define int long long //delete if causing problems
#define F first
#define dbg(x)  cout<<#x<<" "<<x<<endl;
#define S second
#define setbit(n) __builtin_popcount(n)
#define all(x) x.begin() , x.end()
#define clr(x) memset(x,0,sizeof(x))
#define fast  ios_base::sync_with_stdio(0); cin.tie(0);
#define endl "\n" //delete if interactive
#define MOD 1000000007
const int inf = 1e18;
int power(int a, int b);

signed   main()
{
	fast
	int t = 1;
	//cin >> t;
	while (t--)
	{
		int n;
		cin >> n;

		int a[n], b[n];

		for (int i = 0; i < n; i++) cin >> a[i];
		for (int i = 0; i < n; i++) cin >> b[i];

		int sum = 0;

		for (int i = 0; i < n; i++)
		{
			sum += (a[i] * b[i]);
		}

		if (sum == 0) cout << "Yes";
		else cout << "No";

	}
	return 0;
}

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

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}

ll GCD(ll a, ll b){
	if(b==0) return a;

	return GCD(b, a%b);
}

ll ext_gcd(ll a, ll b, ll &x, ll &y){
	if(b==0){
		x = 1;
		y = 0;
		return a;
	}

	ll d = ext_gcd(b, a%b, y, x);
	y -= a/b * x;
	return d;
}

void solve(){
	ll n,s,k;
	cin >> n >> s >> k;

	ll x,y;

	ll egcd = ext_gcd(n,k,x,y);

	cerr << x <<" "<< y << endl;
	if(s%egcd==0){
		ll ans = -1*y*(s/egcd);
		ll di = n/GCD(n,k);

		cout << ((ans%di)+di)%di << endl;
	}else{
		cout << "-1\n";
	}

}

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

	return 0;
}


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

int main() {
    ll A, B;
    cin >> A >> B;
    vector<int> primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
    int K = primes.size();
    vector<ll> from(1<<K, 0), to(1<<K, 0);
    from[0] = 1;
    for (ll i = A; i <= B; i++) {
        fill(to.begin(), to.end(), 0);
        ll mask = 0;
        for (int j = 0; j < K; j++) {
            if (i%primes[j] == 0) mask |= (1<<j);
        }
        for (int j = 0; j < (1<<K); j++) {
            to[j] += from[j];
            if ((j&mask) == 0) to[j|mask] += from[j];
        }
        swap(from, to);
    }
    ll ans = 0;
    for (ll n : from) ans += n;
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &x) {
	x= 0;
	char c= getchar();
	while(!isdigit(c)) c= getchar();
	while(isdigit(c)) x= x * 10 + (c & 15), c= getchar();
}
#define N 74
int n, prime[]= {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71}, p[N];
long long a, b, t[N], f[1 << 20], ans;
signed main() {
	read(a), read(b);
	for(long long i= a; i <= b; i++) t[++n]= i;
	for(int i= 1; i <= n; i++)
		for(int j= 0; j < 20; j++)
			if(t[i] % prime[j] == 0) p[i]|= 1 << j;
	f[0]= 1;
	for(int j= 1; j <= n; j++)
		for(int i= 0; i < (1 << 20); i++) {
			if(i & p[j]) continue;
			f[i | p[j]]+= f[i];
		}
	for(int i= 0; i < (1 << 20); i++) ans+= f[i];
	printf("%lld", ans);
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int n,i,a=0,b=1001,t;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> t;
    if(t>a) a=t;
  }
  for(i=0;i<n;i++){
    cin >> t;
    if(t<b) b=t;
  }
  cout << max(b-a+1,0) << endl;
  return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<pill, ll>
#define pinode pair<node*, node*>
#define quadra pair<pill, pill>
#define ld long double
using namespace std;

const ll N = 1e5 + 100;
const ll M = 3e5 + 101;
const ll big = 1e17;
const ll hsh2 = 1964325029 ;
const long long mod = 1e9 + 7;
const long double EPS = 1e-10;
const ll block = 1e7;
const ll shift = 2e3;
const ld pi = acos(-1.0);

ll n, a[N];
vector<ll> z;
int main() {
	speed;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i], z.pb(a[i]);
	sort(a + 1, a + n + 1);
	ll ans = 1, lst = 0;
	for(int i = 1; i <= n; i++) {
		ans = (ans * ( a[i] - lst + 1)) % mod;
		lst = a[i];
	}
	cout << ans << '\n';

}

/*
*/


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

#define ll long long
#define cin std::cin
#define cout std::cout
#define endl "\n"
#define mod 1000000007
#define pi 3.141592653589793238462643
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define ff first
#define ss second
#define rep(i,n) for(int i=0; i<n; ++i)
#define round(n,i) fixed<<setprecision(i)<<n

void solve(){
    ll n; cin>>n;
    if (n <= 100) cout<<1<<endl;
    else if (n % 100 == 0)
        cout << n/ 100 <<endl;
    else
        cout << n/ 100 + 1 <<endl;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
	ll t=1;
	// cin>>t;
	for(ll i=1; i<=t; ++i){
        solve();
    }
}

#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    cout << n / 100 + (n % 100 != 0) << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

int popcount(int a){
  a = (a&0x55555555) + ((a>>1)&0x55555555);
  a = (a&0x33333333) + ((a>>2)&0x33333333);
  a = (a&0x0f0f0f0f) + ((a>>4)&0x0f0f0f0f);
  a = (a&0x00ff00ff) + ((a>>8)&0x00ff00ff);
  return (a & 0xffff) + (a>>16);
}

int N,M;
vector<vector<pair<int,int>>> Resteictions;
vector<ull> dp;

int main(){
  scanf("%d%d",&N,&M);
  Resteictions.resize(N+1);
  rep(i,M){
    int x,y,z; scanf("%d%d%d",&x,&y,&z);
    Resteictions[y].push_back({(1<<x)-1,z});
  }
  dp.assign(1<<N,0);
  dp[0] = 1;
  rep(j,1<<N){
    int c = popcount(j);
    for(auto q : Resteictions[c]){
      if(popcount(j & q.first) > q.second) dp[j] = 0;
    }
    rep(k,N){
      if((j&(1<<k)) != 0) continue;
      dp[j|(1<<k)] += dp[j];
    }
  }
  printf("%llu\n",dp[(1<<N)-1]);
  return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define rrep1(i, n) for (int i = n; i >= 1; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define eb emplace_back
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
typedef long long int ll;
typedef pair<int, int> P;
// typedef modint1000000007 mint;

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

void speedUpIO() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
}
/*--------------------------------------------------*/

void solve() {
    int n, m;
    cin >> n >> m;
    V<int> a(n);
    rep(i, n) cin >> a[i];
    V<int> cnt(n + 1);
    rep(i, m) cnt[a[i]]++;
    int ans = n;
    rep(i, n) {
        if (cnt[i] == 0) {
            ans = i;
            break;
        }
    }
    for (int i = 1; i <= n - m; i++) {
        int l = i - 1;
        int r = i + m - 1;
        // if (cnt[a[l]] == 0) chmin(ans, a[l]);
        cnt[a[l]]--;
        cnt[a[r]]++;
        if (cnt[a[l]] == 0) chmin(ans, a[l]);
    }
    rep(i, n) {
        if (cnt[i] == 0) {
            chmin(ans, i);
            break;
        }
    }
    cout << ans << "\n";
}

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


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<iomanip>
#define _GLIBCXX_DEBUG
using namespace std;

int main() {
	int A, B;
	double ans;
	cin >> A >> B;
	ans = (double)A * (double)B / 100;
	cout << ans << endl;
}

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
#define all(v) v.begin(), v.end()
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, b) for (ll i = a; i < b; ++i)
#define rep_down(i, a, b) for (ll i = a; i > b; --i)

#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second

#define vvvvll vector<vector<vector<vector<ll>>>>
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>

#define vvvvdo vector<vector<vector<vector<double>>>>
#define vvvdo vector<vector<vector<double>>>
#define vvdo vector<vector<double>>
#define vdo vector<double>

#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
// constexpr ll mod = 998244353;
// constexpr ll mod = 67280421310721;
// constexpr ll mod = 1e18+3;
constexpr ll mod = 1000000007;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
void pt(T val) {
    cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];

        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}
template <typename T>
void pt_vvll(vector<vector<T>> &v) {
    ll vs = v.size();
    rep(i, vs) pt_vll(v[i]);
}

ll gcd(ll a, ll b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll x, ll n, ll M) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % M;
        x = x * x % M;
        n >>= 1;
    }
    return ret;
}
// ll minv(ll a, ll m) { return modpow(a, m - 2); }

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

    ll N, M;
    cin >> N >> M;
    pt(modpow(10, N, M * M) / M);
    return 0;
}


#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for(int i = 1; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i > 0; --i);
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RREP(i, a, b) for(int i = (int)(b) - 1; i >= (int)(a); --i)

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

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    set<int> sa, sb;
    rep(i, n) {
        cin >> a[i];
        sa.insert(a[i]);
    }
    rep(i, m) {
        cin >> b[i];
        sb.insert(b[i]);
    }
    vector<int> ans;
    rep(i, n) {
        if (sb.count(a[i]) == 0) ans.push_back(a[i]);
    }
    rep(i, m) {
        if (sa.count(b[i]) == 0) ans.push_back(b[i]);
    }
    sort(ans.begin(), ans.end());
    for (int i : ans) cout << i << " ";
    cout << endl;
}

#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
#include <string>
#include <map>
#include <cmath>
#include <random>
#include <tuple>
#include <set>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
  ll n;
  ll m;
  cin >> n;
  cin >> m;
  vector<ll> a(n);
  vector<ll> b(m);
  map<ll,int> c;
  rep(i,n){
    cin >> a[i];
    c[a[i]] ++;
  }
  rep(i,m){
    cin >> b[i];
    c[b[i]]++;
  }

  for(auto x:c){
    ll p = x.first;
    ll q = x.second;
    if(q == 1){
      cout << p << ' ';
    }
  }
  cout << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define N 214514
const ll mod = 1e9 + 7;
const ll inf = 1000000000000000000;
ll a[N], b[N];
ll par[N], num[N];
bool used[N];
int main() {
    ll n;
    cin >> n;
    vector<vector<ll>> v(n + 1);
    for (int i = 1; i < n; i++) {
        cin >> a[i] >> b[i];
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    par[1] = -1;
    used[1] = 1;
    queue<ll> que;
    que.push(1);
    while (!que.empty()) {
        ll x = que.front();
        que.pop();
        for (ll y : v[x]) {
            if (used[y]) continue;
            used[y] = 1;
            par[y] = x;
            que.push(y);
        }
    }
    ll q;
    cin >> q;
    while (q--) {
        ll t, e, x;
        cin >> t >> e >> x;
        if (t == 1) {
            if (par[a[e]] == b[e])
                num[a[e]] += x;
            else {
                num[1] += x;
                num[b[e]] -= x;
            }
        } else {
            if (par[b[e]] == a[e])
                num[b[e]] += x;
            else {
                num[1] += x;
                num[a[e]] -= x;
            }
        }
    }
    que.push(1);
    for (int i = 2; i <= n; i++) used[i] = 0;
    while (!que.empty()) {
        ll x = que.front();
        que.pop();
        for (ll y : v[x]) {
            if (used[y]) continue;
            used[y] = 1;
            num[y] += num[par[y]];
            que.push(y);
        }
    }
    for (int i = 1; i <= n; i++) cout << num[i] << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

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

struct edge{int to, cost, id;};

class Graph
{
public:
    int N;
    vector<vector<edge>> G;
    vec par, val;
    int offset = 0;

    Graph(int N): N(N){
        G = vector<vector<edge>>(N, vector<edge>(0));
        par = vec(N, -1);
        val = vec(N, 0);
    }

    void add_Directed_edge(int from, int to, int cost = 1, int id = 0){
        G[from].push_back(edge({to, cost, id}));
    }

    void add_Undirected_edge(int v1, int v2, int cost = 1, int id = 0){
        add_Directed_edge(v1, v2, cost, id);
        add_Directed_edge(v2, v1, cost, id);
    }

    void dfs1(int v, int p = -1){
        par[v] = p;
        for(auto e: G[v]) if(e.to != p) dfs1(e.to, v);
    }

    void dfs2(int v, int p = -1){
        for(auto e: G[v]) if(e.to != p){
            val[e.to] += val[v];
            dfs2(e.to, v);
        }
        val[v] += offset;
    }

};

signed main(){

    int N; cin >> N;
    vec a(N - 1), b(N - 1);
    Graph G(N);
    REP(i, N - 1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        G.add_Undirected_edge(a[i], b[i]);
    }
    G.dfs1(0);

    int Q; cin >> Q;
    REP(i, Q){
        int t, e, x; cin >> t >> e >> x;
        t--; e--;
        int u = a[e], v = b[e];

        if(G.par[v] != u){
            swap(u, v);
            t ^= 1;
        }

        if(t == 1) G.val[v] += x;
        else{
            G.offset += x;
            G.val[v] -= x;
        }
    }
    G.dfs2(0);
    Out(G.val);

    return 0;
}


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

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

const double PI = acos(-1);
const int inf = 1001001001;
const int mod = (int)1e9+7;
//const ll inf = 1e15;
//const ll mod = 1e9+7;

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

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

    int ans = 4;
    if (a+b >= 15 && b >= 8) ans = 1;
    else if (a+b >= 10 && b >= 3) ans = 2;
    else if (a+b >= 3) ans = 3;
    cout << ans << endl;
}

#include<iostream>
using namespace std;
int A, B;

int main(void){
  cin >> A >> B;
  if( A + B >= 15 ){
    if( B >= 8 ){
      cout << 1 << endl;
    }
    else if( B >= 3 ){
      cout << 2 << endl;
    }
    else{
      cout << 3 << endl;
    }
  }
  else if( A + B >= 10){
    if( B >= 3 ){
      cout << 2 << endl;
    }
    else{
      cout << 3 << endl;
    }
  }
  else if( A + B >= 3){
    cout << 3 << endl;
  }
  else{
    cout << 4 << endl;
  }
  return(0);
}


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

#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
using P = pair<ll,ll>;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

int main(){
    int a, b, c;    cin >> a >> b >> c;
    string ans;
    if(c == 0){
        if(a > b)ans = "Takahashi";
        else    ans = "Aoki";
    }else{
        if(a < b) ans = "Aoki";
        else    ans = "Takahashi";
    }
    print(ans);
}

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

using ll = long long;
using ull = unsigned long long;
ull INF = 1000000000000000001;

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  vector<vector<vector<double>>> dp(101, vector<vector<double>> (101, vector<double> (101, 0.0)));

  double sum;
  double pa, pb, pc;
  double Am, Bm, Cm;
  for(int a = 99; a >= 0; a--){
    for(int b = 99; b >= 0; b--){
      for(int c = 99; c >= 0; c--){
        sum = a + b + c;
        pa = a / sum;
        pb = b / sum;
        pc = c / sum;
        Am = dp.at(a+1).at(b).at(c);
        Bm = dp.at(a).at(b+1).at(c);
        Cm = dp.at(a).at(b).at(c+1);
        dp.at(a).at(b).at(c) += (Am + 1) * pa + (Bm + 1) * pb + (Cm + 1) * pc;
      }
    }
  }

  //cout << dp.at(A).at(B).at(C) << endl;
  cout << fixed << setprecision(15) << dp.at(A).at(B).at(C) << endl;
}


#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define int ll
#define each(i, a) for (auto &&i : (a))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using vp = vector<P>;
using int128 = __int128_t;//cin coutはできない
template <class T>
using greater_queue = priority_queue<T, vector<T>, greater<T>>;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a, b) * b;};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template <class T>
void CVEC(const T &v) {
	int c = v.size() - 1;
	for (int i = 0; i < c; i++) cout << v[i] << ' ';
	if (c > -1) cout << v[c];
	cout << '\n';
}

#pragma endregion header

signed main(){
    int n; cin >> n;
	vi a(n), b(n);
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	int mi = *max_element(ALL(a));
	int mx = *min_element(ALL(b));
	cout << max(mx - mi + 1, 0LL) << endl;
}

#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 1000000007
#define INF 1000000007
#define EPS 0.0000000001
#define CHAINS 18
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

int main()
{
    int n,i;
    scanf("%d",&n);
    int a=0,b=1000;
    for(i=0;i<n;i++)
    {
        int c;
        scanf("%d",&c);
        a=max(a,c);
    }
    for(i=0;i<n;i++)
    {
        int c;
        scanf("%d",&c);
        b=min(b,c);
    }
    if(b<a)
    {
        printf("0");
    }
    else
    {
        printf("%d",b-a+1);
    }
    return 0;
}


#include <bits/stdc++.h>

#define rep(i, end) for (auto i = 0; i < end; ++i)
#define ALL(a) a.begin(), a.end()

using namespace std;

using ll = long long int;

const int MOD_NUM = 1e9 + 7;

vector<int> bits_to_indexes(const bitset<8>& bits) {
    vector<int> indexes;
    rep(i, 8) if (bits[i]) indexes.emplace_back(i);

    return indexes;
}

int sum_by_indexes(const vector<int>& indexes, const vector<int>& A) {
    int sum_a = 0;
    for (int i : indexes) sum_a += A[i];

    return sum_a;
}

void output_indexes(const vector<int>& indexes) {
    cout << indexes.size();
    for (int i : indexes) cout << ' ' << i + 1;
    cout << endl;
}

int main() {
    // Input
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    // Process
    rep(i, N) A[i] %= 200;

    vector<int> bits_memory(200, 0);
    bool judge = false;
    int b, c;
    rep(i, pow(2, N)) {
        bitset<8> bits(i);

        int sum_a = sum_by_indexes(bits_to_indexes(bits), A) % 200;

        if (bits_memory[sum_a] == 0) {
            bits_memory[sum_a] = i;
        } else {
            b = bits_memory[sum_a];
            c = i;
            judge = true;
            break;
        }
    }

    // Output
    if (judge) {
        cout << "Yes" << endl;

        vector<int> B = bits_to_indexes((bitset<8>)b);
        output_indexes(B);

        vector<int> C = bits_to_indexes((bitset<8>)c);
        output_indexes(C);
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll mod = 1e9+7;
ll mul(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
ll sum(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
ll sub(ll a,ll b){return ((a%mod)-(b%mod))%mod;}
ll power(ll a,ll b){
	ll res = 1;
	while(b){
		if(b&1)res = mul(res,a);
		b >>= 1;
		a = mul(a,a);
	}
	return res;
}
const int maxn = 19;
const int oo = 1e9;
int N,M,memo[1<<maxn],seen[maxn][maxn],chido[1<<maxn];

int dp(int mask){
	if(mask == (1<<N)-1)return 0;
	int &res = memo[mask];
	if(res != -1)return res;
	res = oo;
	int maskinv = 0;
	forn(i,0,N)if(!(mask&(1<<i)))maskinv |= (1<<i);

	for(int newmask = maskinv; newmask; newmask=(newmask-1)&maskinv){
		int can = chido[newmask];
		if(can)res = min(res,1+dp(newmask|mask));
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	forn(i,0,(1<<maxn))memo[i] = -1;
	cin >> N >> M;
	forn(i,0,M){
		int u,v; cin >> u >> v; u--; v--;
		seen[u][v] = seen[v][u] = 1;
	}
	forn(i,0,(1<<N)){
		vi act;
		forn(j,0,N)if(i&(1<<j))act.pb(j);
		int can = 1;
		forn(j,0,(int)act.size()){
			forn(k,j+1,(int)act.size()){
				int u = act[j];
				int v = act[k];
				if(seen[u][v] || seen[v][u])continue;
				can = 0;
			}
		}
		chido[i] = can;
	}
	int res = dp(0);
	cout << res << '\n';

	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/

#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() {
    int H, W, N, M;
    cin >> H >> W >> N >> M;
    int mat[H][W];
    rep(i, H) rep(j, W) {
        mat[i][j] = 0;
    }
    vector<P> light;
    rep(i, N) {
        int p1, p2;
        cin >> p1 >> p2;
        light.push_back((P){p1-1, p2-1});
    }
    rep(i, M) {
        int p1, p2;
        cin >> p1 >> p2;
        mat[p1-1][p2-1] = -1;
    }
    int count = 0;
    for(auto p : light) {
        if(mat[p.first][p.second] == 0) {
            count++;
            mat[p.first][p.second] = 1;
            int i = 1;
            while(p.first+i < H && mat[p.first+i][p.second] != -1) {
                mat[p.first+i][p.second] = 1;
                count++;
                i++;
            }
            i = 1;
            while(p.first-i >= 0 && mat[p.first-i][p.second] != -1) {
                mat[p.first-i][p.second] = 1;
                count++;
                i++;
            }
        }
    }
    for(auto p : light) {
        if(mat[p.first][p.second] == 2) continue;
        int i = 1;
        while(p.second+i < W && mat[p.first][p.second+i] != -1) {
            if(mat[p.first][p.second+i] == 0) count++;
            mat[p.first][p.second+i] = 2;
            i++;
        }
        i = 1;
        while(p.second-i >= 0 && mat[p.first][p.second-i] != -1) {
            if(mat[p.first][p.second-i] == 0) count++;
            mat[p.first][p.second-i] = 2;
            i++;
        }
    }
    cout << count << endl;
}


#pragma GCC optimize("O2")
#pragma GCC target("avx")
#include <cstdio>
#include <functional>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
#define shift 30

inline int get_digit() {
    int x = 0, f = 1;
    char c = getchar();
    while(c > '9' || c < '0') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        x = (x * 10) + (c ^ 48);
        c = getchar();
    }
    return x * f;
}

int main() {
    int R = get_digit(), C = get_digit();
    int A[250000], B[250000];
    int dist[500000], cost, pt, to_hide = R * C;
    vector<ll> s;
    s.reserve(2 * R * C);
    priority_queue<ll, vector<ll>, greater<ll>> queue(s.begin(), s.end());
    for(int i = 0; i < R * C; ++i) {
        if(i % C != C - 1) A[i] = get_digit();
        dist[i] = 0;
    }
    for(int i = 0; i < (R - 1) * C; ++i) B[i] = get_digit();
    dist[0] = -10000000;
    queue.push((ll)(-10000000) << shift);
    while(queue.size()) {
        pt = queue.top() & ((1 << shift) - 1);
        if(pt == to_hide - 1) break;
        cost = queue.top() >> shift;
        queue.pop();
        if(pt < to_hide) {
            if(pt % C != C - 1 & cost + A[pt] < dist[pt + 1]) {
                dist[pt + 1] = cost + A[pt];
                queue.push(((ll)dist[pt + 1] << shift) | (pt + 1));
            }
            if(pt % C != 0 & cost + A[pt - 1] < dist[pt - 1]) {
                dist[pt - 1] = cost + A[pt - 1];
                queue.push(((ll)dist[pt - 1] << shift) | (pt - 1));
            }
            if(pt < to_hide - C & cost + B[pt] < dist[pt + C]) {
                dist[pt + C] = cost + B[pt];
                queue.push(((ll)dist[pt + C] << shift) | (pt + C));
            }
            if(cost + 1 < dist[pt + to_hide]) {
                dist[pt + to_hide] = cost + 1;
                queue.push(((ll)dist[pt + to_hide] << shift) | (pt + to_hide));
            }
        } else {
            if(to_hide < pt - C && cost + 1 < dist[pt - C]) {
                dist[pt - C] = cost + 1;
                queue.push(((ll)(cost + 1) << shift) | (pt - C));
            }
            if(cost < dist[pt - to_hide]) {
                dist[pt - to_hide] = cost;
                queue.push(((ll)cost << shift) | (pt - to_hide));
            }
        }
    }
    printf("%d\n", dist[to_hide - 1] - dist[0]);
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define sz(v) (int)(v).size()
typedef long long LL;
typedef double db;
template<class T>bool ckmax(T&x,T y){return x<y?x=y,1:0;}
template<class T>bool ckmin(T&x,T y){return x>y?x=y,1:0;}
#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define per(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
const int V = 1005;
const int N = 500005;
const int M = 12 * V * V;
struct edge {
	int nx, to, vl;
} e[M];
int hed[N], et;
inline void adde(int u, int v, int d) {
//	cerr << u << ' ' << v << ' ' << d << '\n';
	e[++et].nx = hed[u], e[et].to = v, e[et].vl = d, hed[u] = et;
}
int n, m, a[V][V], b[V][V], dis[N];
bool vis[N];
inline int id(int x, int y) {
	return (x - 1) * m + y;
}
inline void Dij() {
	priority_queue<pair<int, int> >pq;
	memset(dis, 0x3f, sizeof dis);
	pq.push(mkp(dis[1] = 0, 1));
	while(!pq.empty()) {
		int u = pq.top().se; pq.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		for(int i = hed[u]; i; i = e[i].nx) {
			int v = e[i].to;
			if(ckmin(dis[v], dis[u] + e[i].vl)) {
				pq.push(mkp(-dis[v], v));
			}
		}
	}
}
signed main() {
	n = read(), m = read();
	rep(i, 1, n) rep(j, 1, m - 1) a[i][j] = read();
	rep(i, 1, n - 1) rep(j, 1, m) b[i][j] = read();
	rep(i, 1, n) {
		rep(j, 1, m - 1) {
			adde(id(i, j), id(i, j + 1), a[i][j]);
		}
		rep(j, 2, m) {
			adde(id(i, j), id(i, j - 1), a[i][j - 1]);
		}
		if(i < n) {
			rep(j, 1, m) adde(id(i, j), id(i + 1, j), b[i][j]);
		}
		rep(j, 1, m) {
			adde(id(i, j), id(i, j) + n * m, 1);
			adde(id(i, j) + n * m, id(i, j), 0);
			if(i > 1) adde(id(i, j) + n * m, id(i - 1, j) + n * m, 1);
		}
	}
	Dij();
	cout << dis[id(n, m)] << '\n';
}


#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std; //using namespace atcoder;
template<typename T>  using ve=vector<T>;
using ll=long long; using ld=long double; using str=string; using pint=pair<ll,ll>;
using vll=ve<ll>; using vd=ve<ld>; using vs=ve<str>; using vll2=ve<ve<ll>>;
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define b2e(v) v.begin(),v.end()
#define p2a(v, p) v[p.first][p.second]
#define rep(i,n)  for(ll i=0;i<(n);i++)
#define repi(i,n) for(ll i=(n-1);i>=0;i--)
#define repe(e,v) for(auto e:v)
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;
//const int MOD=998244353;

ll divceil (ll x, ll div) { return (x/div) + (x%div>0); }
ll divfloor(ll x, ll div) { return (x/div) - (x%div<0); }
int main() {
    ll kn; cin >> kn;
    ll nn; cin >> nn;
    ll mn; cin >> mn;

    vll a1(kn);
    rep(i,kn) {
        ll x;
        cin >> x; a1[i]=x;
    }

    // 1. 剰余なしの値を設定B=(floor(MA/N))
    ll ct=0;
    vll b1(kn);
    ve<ld> lb1(kn, 0);
    rep(i,kn) {
        b1[i]  =divfloor(mn*a1[i],nn);
        if(a1[i]) lb1[i] =(ld)(mn*a1[i])/(ld)nn;
        ct+=b1[i];
    }

    // 2. 誤差とidxのpairの配列を作成(floorなしB-B)
    vector<pair<ld,ll>> vp1;
    rep(i,kn) {
        vp1.push_back({lb1[i]-(ld)b1[i],i});
    }

    // 3. 配列を誤差で降順ソート
    sort( vp1.begin(), vp1.end(), greater<pair<ld,ll>>() );

    // 4. 剰余分を更新
    rep(i,mn-ct) {
        b1[vp1[i].second]++;
    }

    rep(i,kn) {
        cout << b1[i] << " ";
    }
    cout << endl;

}

#include<iostream>
#include<cstring>

using namespace std;
int a,b;
int x[100010];

int main()
{
		cin>>a>>b;
		if(a==b)
		{
			for(int i=1;i<=a;i++) x[i]=i;
			for(int i=1+a;i<=a+b;i++) x[i]=-(i-a);
		}else if(a>b)
		{
			for(int i=1;i<=a;i++) x[i]=i;
			for(int i=1+a;i<=a+b-1;i++) x[i]=-(i-a);
			int sum=0;
			for(int i=b;i<=a;i++)
			{
				sum+=-x[i];
			}
			x[a+b]=sum;
		}else if(a<b)
		{
			for(int i=1;i<=b;i++) x[i]=-i;
			for(int i=1+b;i<=a+b-1;i++) x[i]=(i-b);
			int sum=0;
			for(int i=a;i<=b;i++)
			{
				sum+=x[i];
			}
			x[a+b]=-sum;
		}
		for(int i=1;i<=a+b;i++) cout<<x[i]<<" ";
	return 0;
}


/*ver 7*/
#include <bits/stdc++.h>
using namespace std;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pll = pair<ll,ll>;
using mll = map<ll,ll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
#define each(x,v) for(auto& x : v)
#define reps(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
const ll INF = 1LL << 60;
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<=b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){}
template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
template <typename T> void in1(T &s) {rep(i,s.size()){in(s[i]);}}
template <typename T> void in2(T &s,T &t) {rep(i,s.size()){in(s[i],t[i]);}}
template <typename T> void in3(T &s,T &t,T &u) {rep(i,s.size()){in(s[i],t[i],u[i]);}}
template <typename T> void in4(T &s,T &t,T &u,T &v) {rep(i,s.size()){in(s[i],t[i],u[i],v[i]);}}
template <typename T> void in5(T &s,T &t,T &u,T &v,T &w) {rep(i,s.size()){in(s[i],t[i],u[i],v[i],w[i]);}}
void out(){cout << endl;}
template <typename T,class... U> void out(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; out(u...);}
void die(){cout << endl;exit(0);}
template <typename T,class... U> void die(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; die(u...);}
template <typename T> void outv(T s) {rep(i,s.size()){if(i!=0)cout<<" ";cout<<s[i];}cout<<endl;}
template <typename T> void out1(T s) {rep(i,s.size()){out(s[i]);}}
template <typename T> void out2(T s,T t) {rep(i,s.size()){out(s[i],t[i]);}}
template <typename T> void out3(T s,T t,T u) {rep(i,s.size()){out(s[i],t[i],u[i]);}}
template <typename T> void out4(T s,T t,T u,T v) {rep(i,s.size()){out(s[i],t[i],u[i],v[i]);}}
template <typename T> void out5(T s,T t,T u,T v,T w) {rep(i,s.size()){out(s[i],t[i],u[i],v[i],w[i]);}}
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
template <typename T> T allSum(vector<T> a){T ans=T();each(it,a)ans+=it;return ans;}
ll ceilDiv(ll a,ll b) {return (a+b-1)/b;}
ld dist(pair<ld,ld> a, pair<ld,ld> b){return sqrt(abs(a.fi-b.fi)*abs(a.fi-b.fi)+abs(a.se-b.se)*abs(a.se-b.se));} // ２点間の距離
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
#define YES(n) ((n) ? "YES" : "NO"  )
#define Yes(n) ((n) ? "Yes" : "No"  )
#define yes(n) ((n) ? "yes" : "no"  )

int main(){
    init();
    inl(a,b);
    out(100-(double)b/a*100);
    return 0;
}

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

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

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

	ll F[140];
	F[0] = 1;
	F[1] = 1;
	rep(i, 130) {
		F[i + 2] = F[i] + F[i + 1];
	}
	rep(i, 130) {
		cesp(i);
		ce(F[i]);
	}

	ll N;
	cin >> N;
	int f[100] = {}, saisho = 0;
	for (int i = 90; i >= 0; i--) {
		if (N >= F[i]) {
			f[i] = 1;
			N -= F[i];
			if (saisho == 0) saisho = i;
		}
	}
	vector<int> kotae;

	for (int i = saisho; i >= 1; i--) {
		if (f[i]) kotae.pb(1 + (i % 2));
		kotae.pb(4 - (i % 2));
	}

	co(kotae.size());
	rep(i, kotae.size()) co(kotae[i]);

	Would you please return 0;
}


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=1e5+5;
int n,m,tp[N],a[N],b[N];
long long ans;

void GG(){
	write(-1);
	exit(0);
}

signed main(){
	read(n,m);
	for(int i=1;i<=n;i++) read(tp[i]),a[i]=tp[i]-tp[i-1]-1;a[n+1]=m-tp[n];
	for(int i=1;i<=n;i++) read(tp[i]),b[i]=tp[i]-tp[i-1]-1;b[n+1]=m-tp[n];n++;
	for(int i=1,j=1;i<=n;i++) if(b[i]){
		while(!a[j]) j++;
		int cur=0,l=j;
		while(j<=n&&cur<b[i]) cur+=a[j++];
		if(cur>b[i]) GG();
		ans+=max(i-l,0)+max(j-1-i,0);
	}
	write(ans);
}

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

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

template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}

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

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

template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template<typename T = int64>
vector<T> make_v(size_t a) {
  return vector<T>(a);
}

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
  t = v;
}

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template<typename F>
struct FixPoint : F {
  FixPoint(F &&f) : F(forward<F>(f)) {}

  template<typename... Args>
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward<Args>(args)...);
  }
};

template<typename F>
inline decltype(auto) MFP(F &&f) {
  return FixPoint<F>{forward<F>(f)};
}

int main() {
  int N, L;
  cin >> N >> L;
  vector< int > A(N + 2), B(N + 2);
  for(int i = 1; i <= N; i++) cin >> A[i];
  for(int i = 1; i <= N; i++) cin >> B[i];
  A[N + 1] = L + 1;
  B[N + 1] = L + 1;
  for(int i = 0; i < N + 2; i++) A[i] -= i;
  for(int i = 0; i < N + 2; i++) B[i] -= i;

  map< int, int > ls, rs;
  for(int i = 0, j; i < N + 2; i = j) {
    for(j = i; j < N + 2 and A[i] == A[j]; j++) ;
    ls[A[i]] = i;
    rs[A[i]] = j;
  }
  int64 ret = 0;
  for(int i = 0, j; i < N + 2; i = j) {
    for(j = i; j < N + 2 and B[i] == B[j]; j++) ;
    if(!ls.count(B[i])) {
      cout << -1 << endl;
      exit(0);
    }
    ret += max(ls[B[i]] - i, 0);
    ret += max(j - rs[B[i]], 0);
  }
  cout << ret << endl;
}


/*
"An anomaly, I'm Muhammad Ali
  Cause I know one day I'm gonna be the"
                - Greatest, Eminem
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#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;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;

int main(){
    Shazam;
    long double a, b; cin >> a >> b;
    cout << fixed << setprecision(10) << a * b / 100.0 << endl;
    return 0;
}

//#define _GLIBCXX_DEBUG
//#include "atcoder/all"
//using namespace atcoder;
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define Dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

string S;

void solve() {
}

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

    cin >> S;
    int cnt[3] = {};
    for (auto& c : S)
        cnt[(c - '0') % 3]++;

    int SUM = cnt[1] + cnt[2] * 2;
    int ans = 0;
    if (SUM % 3 == 0) {
        ans = 0;
    } else if (SUM % 3 == 1) {
        if (cnt[1])
            ans = 1;
        else if (cnt[2] >= 2)
            ans = 2;
        else
            ans = -1;
    } else {
        if (cnt[2])
            ans = 1;
        else if (cnt[1] >= 2)
            ans = 2;
        else
            ans = -1;
    }
    if (ans == cnt[1] + cnt[2] + cnt[0])
        ans = -1;
    cout << ans << endl;

    solve();
    return 0;
}


// atcoder/arc106/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

class UnionFind {
public:
  UnionFind(int n) {
    r.resize(n, 0);
    p.resize(n, -1);
  }
  void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (a == b) return ;
    if (r[a] > r[b]) {
      p[a] += p[b];
      p[b] = a;
    } else {
      p[b] += p[a];
      p[a] = b;
      if(r[a] == r[b]) r[b]++;
    }
    return ;
  }
  int find(int a) {
    return (p[a] < 0) ? a : p[a] = find(p[a]);
  }
  bool same(int a, int b) {
    return find(a) == find(b);
  }
  size_t size(int n) {
    return -p.at(find(n));
  }
private:
  vector<int> r, p;
};

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n, m;
  while (cin >> n >> m) {
    vec<lli> a(n);
    vec<lli> b(n);
    cin >> a >> b;

    UnionFind uf(n);
    for (int i = 0; i < m; ++i) {
      int x, y;
      cin >> x >> y;
      --x;
      --y;
      uf.unite(x, y);
    }
    for (int i = 0; i < n; ++i) {
      uf.find(i);
    }

    map<int, lli> sum_a, sum_b;
    for (int i = 0; i < n; ++i) {
      sum_a[uf.find(i)] += a[i];
      sum_b[uf.find(i)] += b[i];
    }
    bool f = true;
    for (int i = 0; i < n; ++i) {
      f = f && (sum_a[i] == sum_b[i]);
    }
    cout << (f ? "Yes" : "No") << endl;
  }

  return 0;
}

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

#define endl '\n'
#define int long long

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

	int n, m; cin >> n >> m;
	vector<int> initial(n), final(n);
	for(int &i : initial) cin >> i;
	for(int &i : final) cin >> i;
	vector< vector<int> > adj(n);
	for(int i = 0; i < m; i ++) {
		int u, v; cin >> u >> v;
		u --, v --;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	vector<int> vis(n, false);
	function<int (int)> dfs = [&] (int u) {
		vis[u] = true;
		int diff = final[u] - initial[u];
		for(int v : adj[u]) {
			if(!vis[v])
				diff += dfs(v);
		}
		return diff;
	};
	bool ok = true;
	for(int i = 0; i < n; i ++) {
		if(!vis[i]) {
			ok &= (!dfs(i));
		}
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

using namespace std;
using ll = int64_t;
using P = pair<int, int>;

const ll INF_L = 1LL << 60;
const int INF_I = 1 << 30;
const int MOD = (int)1e9 + 7;
const double PI = acos(-1);
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

int main()
{
    int n;
    cin >> n;
    complex<double> a, b;
    double x, y;
    cin >> x >> y;
    a = {x, y};
    cin >> x >> y;
    b = {x, y};

    auto m = (a + b) / 2.0;
    auto r = m + (a - m) * polar(1.0, PI * 2.0 / n);

    printf("%.10f\n%.10f", r.real(), r.imag());
    return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>

#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
#define MOD2 998244353

const double PI = 3.14159265359;
using namespace std;

int main(){
    int N;
    cin >> N;
    double x0,y0, x2,y2;
    cin >> x0 >> y0 >> x2 >> y2;

    double xc = (x0+x2)/2;
    double yc = (y0+y2)/2;

    double theta = (2*PI)/N;

    double xd = x0-xc;
    double yd = y0-yc;
    double x1, y1;
    x1 = xd*cos(theta) - yd*sin(theta);
    y1 = xd*sin(theta) + yd*cos(theta);
    x1 += xc;
    y1 += yc;

    cout << fixed << setprecision(10) << x1 << " " << y1;

    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 endl "\n"
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define rsz resize
#define ins insert
#define pqueue priority_queue
#define ar array
#define vt vector

#define for_base(i, a, b, x) for (int i=((a)<(b))?(a):(a)-1; ((a)<(b))?i<(b):i>=(b); ((a)<(b))?i+=(x):i-=(x))
#define FOR1(a) for_base(i, 0, a, 1)
#define FOR2(i, a) for_base(i, 0, a, 1)
#define FOR3(i, a, b) for_base(i, a, b, 1)
#define FOR4(i, a, b, x) for_base(i, a, b, x)
#define FIFTH(a, b, c, d, e, ...) e
#define FOR(...) FIFTH(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define trav(a, x) for (auto& a: x)
#define FIT(i, x) for (auto i=(x).begin(); i!=(x).end(); ++i)
#define RIT(i, x) for (auto i=(x).rbegin(); i!=(x).rend(); ++i)
#define finish(...) return void(print(__VA_ARGS__))

typedef long long ll;
typedef long double ld;
typedef string str;

template<class T> using mqueue = pqueue<T, vector<T>, greater<T>>;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.f >> p.s; }
template<class A, size_t S> void read(array<A, S>& x) { trav(a, x) read(a); }
template<class T> void read(vector<T>& v) { trav(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream &operator<<(ostream &o, pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class H, class T> ostream &operator<<(ostream &o, vector<pair<H, T>> &v) { string s; trav(i, v) o << s << i, s = "\n"; return o; }
template<class T, size_t S> ostream &operator<<(ostream &o, array<T, S> &a) { string s; trav(i, a) o << s << i, s = " "; return o; }
template<class T, size_t S> ostream &operator<<(ostream &o, vector<array<T, S>> &v) { string s; trav(i, v) o << s << i, s = "\n"; return o; }
template<class T> ostream &operator<<(ostream &o, vector<T> &v) { string s; trav(i, v) o << s << i, s = " "; return o; }
template<class T> ostream &operator<<(ostream &o, vector<vector<T>> &v) { string s; trav(i, v) o << s << i, s = "\n"; return o; }
template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H &h, const T &...t) { write(h); write(t...); }
void print() { write('\n'); }
template<class H, class... T> void print(const H &h, const T &...t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << h; if(sizeof...(t)) cerr << ", "; DBG(t...); }
#ifdef local
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

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

void solve() {
    ll n;
    read(n);

    set<ll> ans;
    for(ll i=1; i*i<=n; ++i) {
        if(n%i==0) {
            ans.ins(i);
            ans.ins(n/i);
        }
    }

    trav(x, ans)
        print(x);
}

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

    int T = 1;
    /* read(T); */
    for(int tc=1; tc<=T; ++tc) {
        /* write("Case #", tc, ": "); */
        solve();
    }
    return 0;
}

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

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> cnt(405);
    rep(i, n) {
        cnt[a[i]+200]++;
    }
    ll ans = 0;
    for (int i = -200; i <= 200; i++) {
        for (int j = i + 1; j <= 200; j++) {
            ans += cnt[i + 200] * cnt[j + 200] * (i - j) * (i - j);
        }
    }
    cout << ans << endl;

}