#pragma once

#include <iostream>
#include <string>

#include <algorithm>
#include <memory>
#include <functional>
#include <mutex>

#include <cmath>
#include <numeric>

#include <unordered_map>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <array>

#include <chrono>

#define forange(counter, end) forstep(counter, 0, end)
#define forstep(counter, begin, end) forstep_type(int, counter, begin, end)
#define forange_type(type, counter, end) forstep_type(type, counter, 0, end)
#define forstep_type(type, counter, begin, end) for (type counter = begin, forstep_type_end_##counter = end; counter < forstep_type_end_##counter; counter++)

#define _nodiscard [[nodiscard]]
#define cast_size(v) static_cast<size_t>(v)

constexpr size_t Size = 10'000;

struct Point {
	using Type = short;

	Type x = -1;
	Type y = -1;

	constexpr Point() {}
	constexpr Point(Type _x, Type _y) : x(_x), y(_y) {}

	constexpr inline bool operator==(const Point p) const {
		return this->x == p.x && this->y == p.y;
	}

	constexpr Point operator+(const Point p) const {
		return Point(this->x + p.x, this->y + p.y);
	}

	constexpr void operator+=(const Point p) {
		this->x += p.x;
		this->y += p.y;
	}

	constexpr bool operator<(const Point p) const {
		if (this->y != p.y)
			return this->y < p.y;
		return this->x < p.x;
	}

	std::string toString()const {
		return "{" + std::to_string(this->x) + ", " + std::to_string(this->y) + "}";
	}

};

std::ostream& operator<<(std::ostream& os, const Point& p) {
	os << p.x << " " << p.y;
	return os;
}

struct Rect {

	using Type = Point::Type;
	/**
	 * @brief 左上
	*/
	Point tl;

	/**
	 * @brief 右下
	*/
	Point br;

	constexpr Rect() {}
	constexpr Rect(Type _l, Type _t, Type _r, Type _b) : tl(_l, _t), br(_r, _b) {}
	constexpr Rect(Point tl, Point br) : tl(tl), br(br) {}

	/**
	 * @brief 面積
	 * @return 面積
	*/
	constexpr int getArea() const {
		return (br.x - tl.x) * (br.y - tl.y);
	}
	/**
	 * @brief 範囲確認
	 * @param p 希望座標
	 * @return 含有有無
	*/
	constexpr bool inside(const Point p) const {
		return tl.x < p.x&& br.x&& tl.y < p.y&& br.y;
	}

	std::string toString()const {
		return tl.toString() + "-" + br.toString();
	}

};

std::ostream& operator<<(std::ostream& os, const Rect r) {
	os << r.tl << " " << r.br;
	return os;
}

/**
 * @brief 面積からスコアを算出する
 * @param r 要求面積
 * @param rect 提供範囲
 * @return スコア
*/
inline double clacScore(const int r, const Rect rect) {

	const auto s = rect.getArea();
	const double d = 1 - (static_cast<double>(std::min(r, s)) / static_cast<double>(std::max(r, s)));
	const double p = 1 - (d * d);

	return p;
}
/**
 * @brief 面積からスコアを算出する
 * @param p 希望箇所
 * @param r 要求面積
 * @param rect 提供範囲
 * @return スコア
*/
inline double clacScore(const Point p, const int r, const Rect rect) {

	if (rect.inside(p))
	{
		return clacScore(r, rect);
	}

	return 0;
}

int main() {

	int n;

	std::cin >> n;

	std::vector<Point> input(n);
	forange(i, n)
	{
		int x, y, r;
		std::cin >> x >> y >> r;
		input[i].x = x;
		input[i].y = y;
	}

	forange(i, n)
	{
		Rect rect(input[i].x, input[i].y, input[i].x + 1, input[i].y + 1);
		std::cout << rect << std::endl;
	}

}

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli, lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define s  second
#define f first
#define INF 1000000001
#define inf1 1000000000000000001
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int tc;cin>>tc;while(tc--)
#define clean(x) memset(x,0,sizeof(x))

template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
	cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
	cin >> p.first;
	return cin >> p.second;
}
/// RULESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS////
/// READ THEM ALOUD......................................................................................................
/// 1. Read the problem at least twice
/// 2. Brute force if contraints r low
/// 3. Check base cases or break case if found any T-T
/// 4. :D

lli const mod = 2e32;
lli const maxn= 2e3+7;

int main()
{
    char a,b;cin>>a>>b;
    if(a=='N')cout<<b<<endl;
    else
    {
        if(b>='A' and b<='Z'){}
        else b+=-32;
        cout<<b<<endl;
    }
}


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

int N;
vi G[101010];

pair<pi, bool> f(int now) {  //first : 先手が取る石の数(先手は道を選べない方), second : 後手が取る石の数(最大化したいのはこれ) //最後 true:同じ, false:変わる
    vp V_same, V_chg;
    for (auto& nxt : G[now]) {
        auto p = f(nxt);
        if (p.second)
            V_same.emplace_back(p.first);
        else
            V_chg.emplace_back(p.first);
    }
    pi ret{1, 0};

    vp V_rem;
    for (auto& p : V_same) {
        if (p.second > p.first) {
            ret.first += p.first;
            ret.second += p.second;
        } else {
            V_rem.emplace_back(p);
        }
    }

    sort(all(V_chg), [](pi a, pi b) { return a.second - a.first > b.second - b.first; });
    for (int i = 0; i < V_chg.size(); i++) {
        auto p = V_chg[i];
        if (i % 2 == 0) {
            ret.first += p.first;
            ret.second += p.second;
        } else {
            ret.first += p.second;
            ret.second += p.first;
        }
    }

    bool player_same = V_chg.size() % 2 == 0;

    for (auto& p : V_rem) {
        if (player_same) {
            //後手が後手のまま
            ret.first += p.first;
            ret.second += p.second;
        } else {
            ret.first += p.second;
            ret.second += p.first;
        }
    }

    //cout << now << " : " << ret.first << " " << ret.second << endl;
    return {ret, !player_same};
}

void solve() {
    cout << f(0).first.first << endl;
}

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

    cin >> N;
    for (int i = 1; i < N; i++) {
        int p;
        cin >> p;
        p--;
        G[p].emplace_back(i);
    }

    solve();
    return 0;
}

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

#pragma GCC optimize("O3")
#ifdef LOCAL
#include "/Users/lbjlc/Desktop/coding/debug_utils.h"
#else
#define print(...) ;
#define printn(...) ;
#define printg(...) ;
#define fprint(...) ;
#define fprintn(...) ;
#endif

#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define maxi(x, y) x = max(x, y)
#define mini(x, y) x = min(x, y)
// long long fact(long long n) { if(!n) return 1; return n*fact(n-1); }
// #define endl '\n'
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int get_random() {
    static uniform_int_distribution<int> dist(0, 1e9 + 6);
    return dist(rng);
}
const vector<pair<int,int>> eight_directions = {{1,1},{1,0},{1,-1},{0,1},{0,-1},{-1,1},{-1,0},{-1,-1}};
const vector<pair<int,int>> four_directions = {{1,0},{0,1},{0,-1},{-1,0}};
#define solve_testcase int T;cin>>T;for(int t=1;t<=T;t++){solve(t);}

typedef unsigned long long ull;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<long long> vll;
#define bd(type,op,val) bind(op<type>(), std::placeholders::_1, val)

template<class T>
void make_unique(T & v) {
    sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());
}
int geti() { int x; cin >> x; return x; }
long long getll() { long long x; cin >> x; return x; }
double getd() { double x; cin >> x; return x; }
// pair<int, int> a(geti(), geti()) does not work
// pair<int, int> a({geti(), geti()}) works, since it uses initializer.

const int MAXN = 3e5 + 100;

void solve(int tt) {
    // cout<<"Case #"<<tt<<": ";
}

int n;
vi graph[MAXN];
int cnt[MAXN] = {}, coins[MAXN] = {};

int dfs0(int i, int p) {
	cnt[i] = 1;
	for(auto j: graph[i]) {
		if(j != p) {
			cnt[i] += dfs0(j, i);
		}
	}
	return cnt[i];
}

int dfs1(int i, int p) {
	vi tmp1, tmp0;
	for(auto j:graph[i]) {
		if(j == p) continue;
		int tmp = dfs1(j, i);
		if(cnt[j] % 2) tmp1.pb(tmp);
		else tmp0.pb(tmp);
	}
	int res = 1;
	int sign = tmp1.size() % 2 == 1 ? -1 : 1;
	for(auto x:tmp0) {
		if(x <= 0) res += x;
		else res += sign * x;
	}
	sort(all(tmp1));

	for(int i = 0; i < tmp1.size(); i++) {
		res += tmp1[i] * (i % 2 == 0 ? 1 : -1);
	}

	coins[i] = res;
	return res;
}

int main(int argc, char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // solve_testcase;

    cin>>n;
    int tmp;
    rep(i,2,n + 1) {
    	cin>>tmp;
    	graph[i].pb(tmp);
    	graph[tmp].pb(i);
    }

    dfs0(1,-1);
    dfs1(1, -1);

    printn(coins+1,n);
    cout<<(coins[1] + cnt[1]) / 2<<endl;

    return 0;
}


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

int n;
mt19937 mt;
const int TRIES = 750;
const int SHUFFLES = 0;

bool check(string s, vector<vector<char>>& a, int i, int j) {
    bool isOk = true;
    for (int k = 0; k < s.size() && isOk; ++k) {
        if (s[k] != a[i][(j + k) % n]) {
            isOk = false;
        }
    }
    if (isOk) {
        return true;
    }
    for (int k = 0; k < s.size() && isOk; ++k) {
        if (s[k] != a[(i + k) % n][j]) {
            isOk = false;
        }
    }
    return isOk;
}

int calc(vector<string>& v, vector<vector<char>>& a) {
    int cnt = 0;
    for (string& s : v) {
        bool found = false;
        for (int i = 0; i < n && !found; ++i) {
            for (int j = 0; j < n && !found; ++j) {
                if (check(s, a, i, j)) {
                    found = true;
                }
            }
        }
        cnt += found;
    }
    return cnt;
}

pair<int, vector<vector<char>>> gen(vector<string>& v) {
    shuffle(v.begin(), v.end(), mt);
    vector<vector<char>> a(n, vector<char>(n));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            a[i][j] = char(mt() % 8 + int('A'));
        }
    }
    int i = 0, j = 0;
    for (auto s : v) {
        if (j + s.size() >= n) {
            j = 0;
            ++i;
        }
        if (i >= n) {
            break;
        }
        for (int k = 0; k < s.size(); ++k, ++j) {
            a[i][j] = s[k];
        }
    }
    pair<int, vector<vector<char>>> res = {calc(v, a), a};
    for (int i = 0; i < SHUFFLES; ++i) {
        auto curr = res;
        shuffle(curr.second.begin(), curr.second.end(), mt);
        curr.first = calc(v, curr.second);
        if (curr.first > res.first) {
            res = curr;
        }
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    mt.seed(time(nullptr));
    int m;
    cin >> n >> m;
    vector<string> v(m);
    for (auto& i : v) {
        cin >> i;
    }
    pair<int, vector<vector<char>>> res = gen(v);
    for (int i = 0; i < TRIES; ++i) {
        auto curr = gen(v);
        if (curr.first > res.first) {
            res = curr;
        }
    }
    for (auto& i : res.second) {
        for (auto& j : i) {
            cout << j;
        }
        cout << '\n';
    }
	return 0;
}

#include<bits/stdc++.h>
#define N 105
using namespace std;
int n,a[N],ans=1e9;
char s[N];
int Abs(int x) {
	return x<0?-x:x;
}
int main() {
	scanf("%d%s",&n,s+1);
	for(int i=0; i<=n; ++i) {
		scanf("%d",&a[i]);
		if(i>0)ans=min(ans,Abs(a[i]-a[i-1]));
	}
	cout<<ans<<"\n";
	for(int i=0; i<ans; ++i,puts(""))
		for(int j=0; j<=n; ++j)cout<<a[j]/ans+(i<a[j]%ans)<<" ";
	return 0;
}


#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}
template <class Con>
string concat(const Con &c, const string &spr){
	stringstream ss;
	typename Con::const_iterator it = c.begin(), en = c.end();
	bool fst = true;
	for(; it != en; ++it){
		if(!fst){ ss << spr; }
		fst = false;
		ss << *it;
	}
	return ss.str();
}

template <class Con, class Fun>
vector<typename Con::value_type> cfilter(const Con &c, Fun f) {
	vector<typename Con::value_type> ret;
	typename Con::const_iterator it = c.begin(), en = c.end();
	for(; it != en; ++it){
		if(f(*it)){
			ret.emplace_back(*it);
		}
	}
	return ret;
}
#if __cplusplus >= 201103L
template <class Con, class Fun>
auto cmap(const Con &c, Fun f) -> vector<decltype(f(*c.begin()))> {
	vector<decltype(f(*c.begin()))> ret;
	ret.reserve(c.size());
	for(const auto &x: c){
		ret.emplace_back(f(x));
	}
	return ret;
}
#endif

#if __cplusplus >= 201402L
#define lambda(e) ([&](const auto &_){ return (e); })
#define lambda2(e) ([&](const auto &_a, const auto &_b){ return (e); })
#endif

#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()
#define tget(t,i) get<i>(t)

#define MOD 1000000007LL
#define EPS 1e-8

void mainmain(){
	int n, m;
	cin >> n >> m;
	vint as(m), bs(m);
	REP(i, m){ cin >> as[i] >> bs[i]; }
	int k;
	cin >> k;
	vint cs(k), ds(k);
	REP(i, k){ cin >> cs[i] >> ds[i]; }
	int ans = 0;
	REP(S, 1 << k){
		vint v(n + 1);
		REP(i, k){
			v[S >> i & 1 ? cs[i] : ds[i]] = 1;
		}
		int cnt = 0;
		REP(i, m){
			if(v[as[i]] && v[bs[i]]){ ++cnt; }
		}
		chmax(ans, cnt);
	}
	cout << ans << '\n';
}

}
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}

#include <bits/stdc++.h>
using namespace std;
std::map<long long,long long> s;
long long solve(long long x, long long y){
    if(s[y]>0) return s[y];
    if(y==1){
        s[y]=abs(x-y);
    }else if(y%2==1){
        s[y]=min(abs(x-y), min(solve(x,(y+1)/2)+2, solve(x, (y-1)/2)+2));
    }else{
        s[y]=min(abs(x-y), solve(x,y/2)+1);
    }
    return s[y];
}
long long act(long long dif, long long dim){
    long long a=0;
    for(long long i=0;i<dim;i++){
        a+=(dif>>i)&1;
    }
    a+= (dif>>dim);
    return a;
}
int solve_bin(long long x, long long y){
    if(x>=y){
        return x-y;
    }
    long long xd=x;
    long long dim;
    for(dim=0;dim<100;dim++){
        if(xd*2>=y)break;
        xd*=2;
    }
    long long a = act(y-xd, dim)+dim;
    long long b = act(xd*2-y, dim+1)+dim+1;
    return min(a,b);
}

int main(){
    long long x,y;
    cin >> x >> y;
    cout << solve(x,y) << endl;
    return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main(){
  int n=ri();
  int x[n],y[n],sum=0;
  double s;
  rep(i,n) x[i]=ri(),y[i]=ri();
  rep(i,n-1){
    for(int j=i+1;j<n;j++){
      s=double(y[j]-y[i])/(x[j]-x[i]);
      if(abs(s)<=1)sum++;
    }
  }
  cout<<sum;
}

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

int main()
{
    int N;
    vector<ll> A;
    cin >> N;
    rep(i, N)
    {
        int Ai;
        cin >> Ai;
        A.push_back(Ai);
    }
    int cnt_max = 0;
    int ans = 0;
    for (int i = 2; i <= *max_element(A.begin(), A.end()); i++)
    {
        int res = 0;
        for (ll j : A)
        {
            if (j % i == 0)
            {
                res += 1;
            }
        }
        if (res > cnt_max)
        {
            ans = i;
            cnt_max = res;
        }
    }
    cout << ans << endl;
}


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

int n,val[200005][10],init[10];
bool life[35][6];

bool ok(int x)
{
	for(int i=1;i<init[5];i++)
		for(int j=1;j<=3;j++)
			life[i][j]=0;
	int now;
	for(int i=1;i<=n;i++)
	{
		now=0;
		for(int j=0;j<5;j++)
		{
			if(val[i][j]>=x)
				now+=init[j];
		}
		life[now][1]=1;
		for(int j=0;j<init[5];j++)
			for(int k=1;k<=2;k++)
				life[j|now][k+1]|=life[j][k];
	}
	return life[init[5]-1][3];
}

int main()
{
	init[0]=1;
	for(int i=1;i<=5;i++)
		init[i]=init[i-1]*2;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		for(int j=0;j<5;j++)
			scanf("%d",&val[i][j]);
	for(int i=n+1;i<=200000;i++)
		for(int j=0;j<5;j++)
			val[i][j]=val[i%n+1][j];
	n=200000;
	int l=1,r=1e9,mid;
	life[0][1]=life[0][2]=life[0][3]=1;
	while(l!=r)
	{
		mid=(l+r+1)/2;
		if(ok(mid))
			l=mid;
		else
			r=mid-1;
	}
	printf("%d\n",l);
	return 0;
}

// Problem : D - Choose Me
// Contest : AtCoder - AtCoder Beginner Contest 187
// URL : https://atcoder.jp/contests/abc187/tasks/abc187_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//HAR HAR MAHADEV
//WHEN IT GETS HARDER REMEMBER WHY YOU STARTED💪
/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;

typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;

typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;

#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)
#define vt vector
#define bug(x) cout<<#x<<"="<<x<<endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ins insert
//#define MOD 998244353

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> using PR = pair<T,T>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359;
const int MOD = 1000000007;
const char cl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set
void solve(){
	int n;
	cin>>n;
	vt<pair<ll,pl>> votes(n);
	ll suma=0;
	loop(i,n){
		cin>>votes[i].s.f>>votes[i].s.s;
		suma+=votes[i].s.f;
		votes[i].f=2*votes[i].s.f+votes[i].s.s;
	}
	sort(rall(votes));
	ll sumb=0;
	int cnt=0;
	loop(i,n){
		suma-=votes[i].f;
		cnt++;
		if(suma<0){
			cout<<cnt<<cl;
			return;
		}
	}
	return;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}
/* stuff you should look for
	* jab answer dhoondhna ho to matlb binary search beta
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/


#include <bits/stdc++.h>

using namespace std;

#define SOLVER(x) solve_C x

static void s_solve(void)
{
    long long N;
    long long M;
    long long L;

    cin >> N >> M;

    L = 1;
    if ( M == 0 )
    {
        for ( int i = 0; i < N; i++ )
        {
            cout << L << " " << L+1 << endl;
            L += 2;
        }
        return;
    }

    if ( ( M < 0 ) || ( M > ( N - 2 ) ) )
    {
        cout << "-1" << endl;
        return;
    }

    L = 2;
    for ( int i = 0; i < ( M + 1 ); i++ )
    {
        cout << L << " " << L+1 << endl;
        L += 2;
    }
    cout << "1 " << L << endl;
    L++;

    for ( int i = 0; i < ( N - ( M + 2 ) ); i++ )
    {
        cout << L << " " << L+1 << endl;
        L += 2;
    }

    return;
}

void SOLVER((volatile bool *do_loop))
{
    do {
        s_solve();
    } while ((do_loop != NULL) && (*do_loop));
}

#ifndef NO_PROBLEM_MAIN
int main(void)
{
    SOLVER((NULL));
    return 0;
}
#endif


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

#define ffor(n) for(int i = 0; i < n; i++)
#define fffor(n) for(int j = 0; j < n; j++)
#define uwu ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize("Ofast")

const int INF = 1e9 + 7;
const long long INF2 = 1e17;

int main(void) {
	uwu

	int n, m; cin >> n >> m;
	vector <string> v(n);
	ffor(n) cin >> v[i];

	const int mod = 998244353;
	long long ans = 1;

	for(int i = 0, j = 0; i != n - 1 || j != m - 1; ) {
		set <char> colours;
		for(int x = i, y = j; 0 <= x && x < n && 0 <= y && y < m; x++, y--) {
			if (v[x][y] != '.') colours.insert(v[x][y]);
		}
		if ((int)colours.size() == 0) {
			ans *= 2;
			ans %= mod;
		}
		else if ((int)colours.size() == 1) {
		}
		else if ((int)colours.size() == 2) {
			cout << 0 << '\n';
			return 0;
		}

		if (j == m - 1) i++;
		else j++;
	}
	if (v[n - 1][m - 1] == '.') ans *= 2;
	ans %= mod;
	cout << ans << '\n';
}

/*
C:\Users\kenne\OneDrive\Desktop\competitive_programming\main.cpp
*/

#include <iostream>
#include <algorithm>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
ll n,inx,m,mod=10007,b[200005],a[20005][5],ma[200005];
char s[505][505];

int main()
{
   ios::sync_with_stdio(false);
   cin>>n>>m;
   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=m;j++)
       {
           cin>>s[i][j];
       }
   }
   int flag=0;
   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=m;j++)
       {
           if(s[i][j]=='R')
           {
               if(a[i+j][2]==0)
               {
                   a[i+j][1]=1;
               }
               else
               {
                   cout<<0<<endl;
                   return 0;
               }
           }
           if(s[i][j]=='B')
           {
               if(a[i+j][1]==0)
               {
                   a[i+j][2]++;
               }
               else
               {
                    cout<<0<<endl;
                   return 0;
               }
           }
           if(s[i][j]=='.')
           {
               flag=1;
               a[i+j][3]=666;
           }
       }
   }
   ll ans=0;
   for(int i=2;i<=n+m;i++)
   {
       if(a[i][3]==666&&a[i][1]==0&&a[i][2]==0)ans++;
   }
   if(flag==0)cout<<1<<endl;
   else
   {
       ll temp1=1;
       ll temp2=2;
       while(ans)
       {
           if(ans&1)temp1=(temp1*temp2)%998244353;
           temp2=(temp2*temp2)%998244353;
           ans/=2;
       }
       cout<<temp1<<endl;
   }

    return 0;
}


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

using namespace std;

void solve(int test, std::istream &in) {
    int n;
    in >> n;
    vector<int> a(n), b(n), p(n);
    for (int i = 0; i < n; i++)
        in >> a[i];
    for (int i = 0; i < n; i++)
        in >> b[i];
    for (int i = 0; i < n; i++) {
        in >> p[i];
        p[i]--;
    }
    vector<vector<int>> s;
    for (int i = 0; i < n; i++) {
        if (p[i] >= 0) {
            s.push_back(vector<int>());
            int i2 = i;
            while (p[i2] >= 0) {
                s.back().push_back(i2);
                int tmp = p[i2];
                p[i2] = -1;
                i2 = tmp;
            }
        }
    }
    int m = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i].size() == 1)
            continue;
        for (int j = 0; j < s[i].size(); j++) {
            int u = s[i][j];
            int v = j == s[i].size() - 1 ? s[i][0] : s[i][j + 1];
            if (a[u] <= b[v]) {
                m = -1;
                break;
            }
        }
        if (m < 0)
            break;
        m += s[i].size() - 1;
    }
    printf("%d\n", m);
    if (m > 0) {
        for (int i = 0; i < s.size(); i++) {
            if (s[i].size() == 1)
                continue;
            int max = 0, arg = -1;
            for (int j = 0; j < s[i].size(); j++) {
                int u = s[i][j];
                if (a[u] > max) {
                    max = a[u];
                    arg = j;
                }
            }
            int j = arg == s[i].size() - 1 ? 0 : arg + 1;
            while (j != arg) {
                printf("%d %d\n", s[i][arg] + 1, s[i][j] + 1);
                j++;
                if (j == s[i].size())
                    j = 0;
            }
        }
    }
}

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

/* これを翻訳している間、あなたはあなたの人生のいくつかの貴重な瞬間を無駄にしました */

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ld long double
#define mem(x,y) memset(x,y,sizeof x)

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

vector<array<int,2>> adj[250009];
int a[250009],b[250009];
int r,c;
int d[250009];

int state(int i, int j)
{
	return i*c+j;
}

int main()
{
	IOS
	cin>>r>>c;
	for(int i=0;i<r;i++)
	for(int j=0;j<c-1;j++)
	cin>>a[i*c+j];

	for(int i=0;i<r-1;i++)
	for(int j=0;j<c;j++)
	cin>>b[i*c+j];

	for(int i=0;i<r;i++)
	for(int j=0;j<c;j++)
	{
		if(j+1<c) adj[state(i,j)].pb({state(i,j+1),a[state(i,j)]});
		if(j-1>=0) adj[state(i,j)].pb({state(i,j-1),a[state(i,j-1)]});
		if(i+1<r) adj[state(i,j)].pb({state(i+1,j),b[state(i,j)]});
		for(int k=0;k<i;k++)
		adj[state(i,j)].pb({state(k,j),i-k+1});
	}

	int s=0;
	mem(d,infi);
	d[0] = 0;
	set<pair<int, int>> q;
	q.insert({0, s});
    while (!q.empty()) {
        int v = q.begin()->second;
        q.erase(q.begin());

        for (auto edge : adj[v]) {
            int to = edge[0];
            int len = edge[1];

            if (d[v] + len < d[to]) {
                q.erase({d[to], to});
                d[to] = d[v] + len;
                q.insert({d[to], to});
            }
        }
    }
    cout<<d[r*c-1]<<'\n';
}


#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
#define all(x) x.begin(), x.end()
const ll mod = 1e9 + 7;
ll mod_exp(ll a, ll n) {
   if (a < 0ll)   return 0;
   if (n < 0ll)   return 0;
   ll res = 1ll;
   while (n > 0) {
      if (n & 1)   res = (res * a) % mod;
      a = (a * a) % mod;
      n = n >> 1;
   }
   return res;
}
void solve() {
   int n, m, k, u, v;
   cin >> n >> m >> k;
   const ll c = mod_exp(2 * m, mod - 2);
   vector <ll> d(n);
   vector <vector <ll>> p(n, vector <ll> (n)), e(1, vector <ll> (n));
   for (auto &i : e[0])
      cin >> i;
   for (int i = 0; i < m; i++) {
      cin >> u >> v;
      u--, v--;
      p[u][v] = c;
      p[v][u] = c;
      d[u]++, d[v]++;
   }
   for (int i = 0; i < n; i++)
      p[i][i] = (1 - (d[i] * c) % mod + mod) % mod;
   auto multiply = [&](const auto & a, const auto & b) {
      vector <vector <ll>> c(a.size(), vector <ll> (b[0].size()));
      rep(i, a.size())rep(j, b[0].size())rep(k, b.size()) {
         (c[i][j] += (a[i][k] * b[k][j]) % mod) %= mod;
      }
      return c;
   };
   while (k > 0) {
      if (k & 1)
         e = multiply(e, p);
      p = multiply(p, p);
      k >>= 1;
   }
   for (auto i : e[0])
      cout << i << '\n';
}
int main() {
#ifndef ONLINE_JUDGE
   freopen("inp.in", "r", stdin);      freopen("outp.in", "w", stdout);
#endif
   ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);
   solve();
   return 0;
}

/****************************************** By Lord Sanskar Bhargava******************************/
#include<bits/stdc++.h>
#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define mp make_pair
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define set1(x) __builtin_popcount(x)
#define gcd(a,b) __gcd(a,b)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define bk(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define mid(l,r) (l+(r-l)/2)
#define inf 1e18
template <typename T> T gcd(T a, T b){if(a%b) return gcd(b,a%b);return b;}
template <typename T> T lcm(T a, T b){return (a*(b/gcd(a,b)));}
#define fastio ios::sync_with_stdio(0);cin.tie(0);

template<typename T_vector>
void output_vector(const T_vector &v, bool add_one = false, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n');
}

unsigned mod_pow(unsigned a, unsigned b, unsigned mod)
{
    unsigned result = 1;

    while (b > 0) {
        if (b & 1)
            result = unsigned(uint64_t(result) * a % mod);

        a = unsigned(uint64_t(a) * a % mod);
        b >>= 1;
    }

    return result;
}

bool miller_rabin(unsigned n) {
    if (n < 2)
        return false;

    // Check small primes.
    for (unsigned p : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29})
        if (n % p == 0)
            return n == p;

    int r = __builtin_ctz(n - 1);
    unsigned d = (n - 1) >> r;

    for (unsigned a : {2, 7, 61}) {
        unsigned x = mod_pow(a % n, d, n);

        if (x <= 1 || x == n - 1)
            continue;

        for (int i = 0; i < r - 1 && x != n - 1; i++)
            x = unsigned(uint64_t(x) * x % n);

        if (x != n - 1)
            return false;
    }

    return true;
}

int find_prime(int n) {
    while (!miller_rabin(n))
        n++;

    return n;
}

void run_test_cases()
{
  int n;
  cin>>n;
  vector<pair<int,string>>vp(n);
  for(int i=0;i<n;i++)
  {
    string s;
    int t;
    cin>>s>>t;
    vp.emplace_back(t,s);
  }
  sort(all(vp));
  reverse(all(vp));
  cout<<vp[1].ss<<endl;

}
int main(int argc, char const *argv[])
{
    clock_t begin = clock();
    fastio;
    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        run_test_cases();
    }

return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N,K;cin>>N>>K;
  vector<pair<int,int>>V(N);
  for(int X=0;X<N;X++){
    int A,B;cin>>A>>B;
    V[X]={A,B};
  }
  sort(V.begin(),V.end());
  int now=0;int p=K;
  for(int X=0;X<N;X++){
    if(V[X].first-now<=p){
      p-=V[X].first-now;p+=V[X].second;now=V[X].first;
    }
    else{
      now+=p;p=0;break;
    }
  }
  now+=p;
  cout<<now<<endl;
}

#include <bits/stdc++.h>

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef long int li;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin >> t; while(t--)
#define print_tc(t, c) cout << "Case #" << t << ": " << c << "\n";
const long long int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
const long long int cons = 100005, ncr_cons = 100005;
const long long int MOD = 1000000007; // const long long int MOD = 998244353;
const long long int const_INT_MAX = 1000000000000000000, const_INT_MIN = -1 * 1000000000000000000;
using namespace std;
bool sortinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.first > b.first);}
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second < b.second);}
bool sortbysecinrev(const pair<ll,ll> &a, const pair<ll,ll> &b){return (a.second > b.second);}
ll gcd(ll x, ll y){return (ll)(__gcd(x, y));}
ll lcm(ll x, ll y){return (ll)((x * y) / gcd(x, y));}
ll mod_expo(ll x, ll y, ll p){
    if((x + p) % p == 0) return 0;
    ll res = 1; x = (x + p) % p;
    while (y > 0){
        if(y & 1) res = (res*x + p) % p;
        y = y>>1; x = (x*x + p) % p;
    }
    return res;
}
void usaco(string str = ""){
    fastio;
    if(str.size()){
        freopen((str + ".in").c_str(), "r", stdin);
        freopen((str + ".out").c_str(), "w", stdout);
    }
}
int main(){
    usaco();
    ll n, k; cin >> n >> k; vector<pair<ll, ll>> a(n);
    for(ll i=0;i<n;i++) cin >> a[i].first >> a[i].second; sort(a.begin(), a.end());
    ll i=0, sum=k; while(i < n && a[i].first <= sum){
        sum += a[i].second; i++;
    }
    cout << sum << "\n";
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}


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

int main() {
  int N;
  long long int T;
  cin >> N >> T;
  vector<long long int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  vector<long long int> B, C;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) B.push_back(A.at(i));
    else C.push_back(A.at(i));
  }

  int M = B.size();
  vector<long long int> D;
  for (int bit = 0; bit < (1 << M); bit++) {
    long long int S = 0;
    for (int i = 0; i < M; i++) {
      if (bit & (1 << i)) S += B.at(i);
    }
    D.push_back(S);
  }
  sort(D.begin(), D.end());
  D.erase(unique(D.begin(), D.end()), D.end());

  int L = C.size(), K = D.size();
  long long int ans = 0;
  for (int bit = 0; bit < (1 << L); bit++) {
    long long int S = 0;
    for (int i = 0; i < L; i++) {
      if (bit & (1 << i)) S += C.at(i);
    }
    if (S > T) continue;
    int left = 0, right = K;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (D.at(mid) + S <= T) left = mid;
      else right = mid;
    }
    ans = max(ans, D.at(left) + S);
  }

  cout << ans << endl;
}

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

int h, w;
string ast;
int a[2009][2009];
int max2 = 4009;
int mem[2009][2009];

int opt(int i, int j) {
	if (mem[i][j] != max2) return mem[i][j];
	if (i == h && j == w) return mem[i][j] = 0;
	if ( ( i + j ) % 2 == 0 ) {
		if (i+1>h) return mem[i][j] = opt(i, j+1) + a[i][j+1];
		else if (j+1>w) return mem[i][j] = opt(i+1, j) + a[i+1][j];
		else return mem[i][j] = max(opt(i, j+1) + a[i][j+1], opt(i+1, j) + a[i+1][j]);
	} else {
		if (i+1>h) return mem[i][j] = opt(i, j+1) - a[i][j+1];
		else if (j+1>w) return mem[i][j] = opt(i+1, j) - a[i+1][j];
		else return mem[i][j] = min(opt(i, j+1) - a[i][j+1], opt(i+1, j) - a[i+1][j]);
	}
}

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

	for (int i = 1; i <= h; ++i) {
		cin >> ast;
		for (int j = 1; j <= w; ++j) {
			mem[i][j] = max2;
			if (ast[j-1] == '+') a[i][j] = 1;
			else a[i][j] = -1;
		}
	}

	int ans = opt(1,1);
	if (ans < 0) cout << "Aoki" << endl;
	else if (ans > 0) cout << "Takahashi" << endl;
	else cout << "Draw" << endl;

	return 0;
}


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

// const int mod=1e9+7;

// bool isPerfectSquare(long double x){
// 	if(x>=0){
// 		int sr=sqrt(x);
// 		return (sr*sr==x);
// 	}
// 	return false;
// }

// bool isExponentOfTwo(int n){
//     while(n%2==0){
//         n/=2;
//     }
//     return n==1;
// }

// int power(int x, int y){
//     int res = 1;
//     x = x % mod;
//     if (x == 0) return 0;
//     while (y > 0){
//         if (y & 1)
//             res = (res*x) % mod;
//         y = y>>1;
//         x = (x*x) % mod;
//     }
//     return res;
// }
// int inv(int n){
//     return power(n,mod-2);
// }

// vector<int> fac;
// void factorial(int n){
//     fac.resize(n+1);
//     fac[0]=1;
//     for(int i=1;i<=n;i++){
//         fac[i]=(fac[i-1]*i)%mod;
//     }
// }
// vector<int> ifac;
// void ifactorial(int n){
//     ifac.resize(n+1);
//     for(int i=0;i<=n;i++){
//         ifac[i]=inv(fac[i]);
//     }
// }
// int ncr(int n,int r){
//     if(n<r)return 0;
//     if(r==0)return 1;
//     return (((fac[n]*ifac[r])%mod)*ifac[n-r])%mod;
// }

// vector<int> prime;
// void div(int n){
//     prime.resize(n+1,0);
//     prime[1]=1;
//     for(int i=2;i<=n;i++){
//         if(prime[i]==0){
//             for(int j=1;j*i<=n;j++){
//                 if(prime[i*j]==0)prime[j*i]=i;
//             }
//         }
//     }
// }

// int changingFun(int x,int y){
//     return (x+y); //res bhi change krna h......
// }

// const int N = 2e5;  // limit for array size
// int n;  // array size
// int t[2 * N];

// void build() {  // build the tree
//   for (int i = n - 1; i > 0; --i) t[i] = changingFun(t[i<<1] , t[i<<1|1]);
// }

// void modify(int p, int value) {  // set value at position p
//   for (t[p += n] = value; p > 1; p >>= 1) t[p>>1] = changingFun(t[p] , t[p^1]);
// }

// int query(int l, int r) {  // sum on interval [l, r)
//   int res = 0;
//   for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
//     if (l&1) res = changingFun(res,t[l++]);
//     if (r&1) res =changingFun(res,t[--r]);
//   }
//   return res;
// }

void solve(){
    int n,i; cin>>n;
    int cnt;
    set<int> st;
    st.insert(6);
    st.insert(10);
    st.insert(15);
    cnt=3;
    i=2;
    while(i*6<=10000){
        if(st.size()>=n){
            break;
        }
        else{
            st.insert(i*6);
        }
        i++;
    }
    i=2;
    while(i*10<=10000){
        if(st.size()>=n){
            break;
        }
        else{
            st.insert(i*10);
        }
        i++;
    }
    i=2;
    while(i*15<=10000){
        if(st.size()>=n){
            break;
        }
        else{
            st.insert(i*15);
        }
        i++;
    }
    cnt=0;
    for(auto z:st){
        if(cnt>=n)break;
        cout<<z<<" "; cnt++;
    }
}
signed main(){
    // time_t start, end;
    // time(&start);
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int tt=1,t=1; //cin>>tt;
    while(t<=tt){
        // cout<<"Case #"<<t<<": ";
        solve();
        cout<<"\n";
        t++;
    }
    // time(&end);
    // double time_taken = double(end - start);
    // cout << "Time taken by program is : " << fixed << time_taken << setprecision(5);
    // cout << " sec " << endl;
    return 0;
}

#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

int n;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    vector<int> ans;
    ans.push_back(3 * 5 * 7);
    for(int i = 1; i <= 10'000; i++)
        if(ans.size() < n && (i % 6 == 0 || i % 10 == 0 || i % 14 == 0))
            ans.push_back(i);
    assert(ans.size() == n);
    int sumgcd = 0;
    for(int i = 0; i < ans.size(); i++)
    {
        for(int j = i + 1; j < ans.size(); j++)
            assert(__gcd(ans[i], ans[j]) > 1);
        sumgcd = __gcd(sumgcd, ans[i]);
    }
    assert(sumgcd == 1);
    for(auto x : ans)
        cout << x << " ";
    cout << "\n";
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template <class T>
void read(T &);
template <class T>
void write(const T &);

typedef long long ll;
typedef unsigned long long ull;
typedef const long long &cll;
typedef const int &ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::abs;
using std::max;
using std::min;

constexpr int N = 3005;
constexpr int Mod = 998244353;

void add(int &a, int b) { (a += b) >= Mod ? a -= Mod : a; }

int dp[N][N];
int n, k;

int main() {
  read(n), read(k);
  dp[0][0] = 1;
  for (int j = 1; j <= n; ++j) {
    for (int i = 1; i <= j; ++i) {
      dp[i][j] = dp[i - 1][j - 1];
      if (2 * i <= j - i) {
        add(dp[i][j], dp[2 * i][j - i]);
      }
      if (2 * i - 1 <= j - i) {
        add(dp[i][j], dp[2 * i - 1][j - i]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= k; ++i) {
    add(ans, dp[i][n - k]);
  }
  write(ans), EL;
  return 0;
}

template <class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template <class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}

#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
string s = "AB";
char c [4];
long long n = 10 , nn , a [20] , mask , dp [1003];
map < string , int > mp;
void f ( )
{
    if ( s . size () == n )
    {
        mp [s] ++;
        return;
    }
    for ( int i = 0 ; i < s . size () - 1 ; i ++ )
    {
        if ( s [i] == 'A' && s [ i + 1 ] == 'A' )
        {
            s . insert ( s . begin () + i + 1 , c [0] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'A' && s [ i + 1 ] == 'B' )
        {
            s . insert ( s . begin () + i + 1 , c [1] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'B' && s [ i + 1 ] == 'A' )
        {
            s . insert ( s . begin () + i + 1 , c [2] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
        if ( s [i] == 'B' && s [ i + 1 ] == 'B' )
        {
            s . insert ( s . begin () + i + 1 , c [3] );
            f ();
            s . erase ( s . begin () + i + 1 );
        }
    }
}
void F ( int x , int mask )
{
    if ( x == 4 )
    {
        f ();
        a [mask] = mp . size ();
        mp . clear ();
        return;
    }
    c [x] = 'A';
    F ( x + 1 , mask );
    c [x] = 'B';
    F ( x + 1 , ( mask | ( 1 << x ) ) );
}
long long pw ( long long x , long long y )
{
    if ( y == 0 ) return 1;
    long long ans = pw ( x , y / 2 );
    ans = ( ans * ans ) % mod;
    if ( y % 2 ) ans = ( ans * x ) % mod;
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("milk.in","r",stdin);
    //freopen("milk.out","w",stdout);
    cin >> nn;
    if ( nn == 2 )
    {
        cout << 1;
        return 0;
    }
    F ( 0 , 0 );
    for ( int i = 0 ; i < 4 ; i ++ )
    {
        char c;
        cin >> c;
        if ( c == 'B' ) mask = ( mask | ( 1 << i ) );
    }
    if ( a [mask] == 1 ) cout << 1;
    if ( a [mask] == 128 ) cout << pw ( 2 , nn - 3 );
    if ( a [mask] == 34 )
    {
        dp [0] = 1 , dp [1] = 1;
        for ( int i = 2 ; i <= nn ; i ++ ) dp [i] = ( dp [ i - 1 ] + dp [ i - 2 ] ) % mod;
        cout << dp [ nn - 2 ];
    }
}


//Hare Krishna
//author: Dipjoy Basak
//dip_10

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

#define endl "\n"
#define ll long long
#define int ll
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int, int>
#define vpi vector<pair<int, int>>
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define rrep(i, r, l) for (int i = r; i >= l; i--)
#define readarray(a, n) rep(i, 0, n - 1) cin >> a[i];
#define all(v) v.begin(), v.end()
#ifndef ONLINE_JUDGE
#define debug(x)       \
    cerr << #x << " "; \
    _print(x);         \
    cerr << endl;
#else
#define debug(x) ;
#endif
#define INF INT_MAX

//*----------------------------------------DEBUG functions--------------------------*

void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(ld t) { cerr << t; }
void _print(double t) { cerr << t; }

template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p)
{
    cerr << "{";
    _print(p.ff);
    cerr << ",";
    _print(p.ss);
    cerr << "}";
}
template <class T>
void _print(vector<T> v)
{
    cerr << "[ ";
    for (T i : v)
    {
        _print(i);
        cerr << " ";
    }
    cerr << "]";
}
template <class T>
void _print(set<T> v)
{
    cerr << "[ ";
    for (T i : v)
    {
        _print(i);
        cerr << " ";
    }
    cerr << "]";
}
template <class T>
void _print(multiset<T> v)
{
    cerr << "[ ";
    for (T i : v)
    {
        _print(i);
        cerr << " ";
    }
    cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v)
{
    cerr << "[ ";
    for (auto i : v)
    {
        _print(i);
        cerr << " ";
    }
    cerr << "]";
}

//-----------------------------------------------------------------------------------------------------------------------------

const int mod = 1000000007;
const long double PI = 3.141592653589793;
const int maxn = 100005;
int x, y, z, n, k;

void solve()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b)
    {
        cout << c << endl;
    }
    else if (b == c)
    {
        cout << a << endl;
    }
    else if (a == c)
    {
        cout << b << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << setprecision(15) << fixed;
    int t;
    t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

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


//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;
string s,t;

void rage(){
	cout<<"-1"<<endl;
	exit(0);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);

	cin>>n;
	cin>>s>>t;

	vector<int> stks,stkt;

	ll ans=0;
	rep(x,0,n){
		if (t[x]=='1') stkt.push_back(x);
		if (s[x]=='1'){
			if (!stks.empty()){
				ans+=x-stks.back();
				stks.pop_back();
			}
			else if (!stkt.empty()){
				ans+=x-stkt.back();
				stkt.pop_back();
			}
			else{
				stks.push_back(x);
			}
		}
	}

	if (!stks.empty() || !stkt.empty()) rage();

	cout<<ans<<endl;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <sstream>
#include <cstdlib>
#include <stdio.h>

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define C(x) cout << x << endl //テスト出力

//DP処理用
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; }

//関数
//nCkの計算の関数(呼び出しは[cbn])
ll cbn(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
// a^n mod を計算する
ll powmod(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
//２つの最大公約数
int gcb(int a, int b){
    if(a < b){
        int x = a;
        a = b;
        b = x;
    }
    int amari = a % b;
    if(amari == 0) return b;

    return gcb(b, amari);
}
//３つの最大公約数
int gcb_3(int a, int b, int c){
    return gcb(gcb(a, b), c);
}

/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;
vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
sort(変数名.begin(), 変数名.end());*/

/*-----------------------------ここから-----------------------------*/

int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n; cin>>n;
if(n%2==0) cout<<"White";
else cout<<"Black";
}


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

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define umii unordered_map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 998244353
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define F(i, s, e, j) for (int i = s; i <= e; i += j)
#define mt19937 rng(chrono::steady_clock::now().tjhe_since_epoch().count());
//shuffle(arr,arr+n,rng)
/*---------------------------------------------------------------------------------------------------------------------------*/
int gcd(int a, int b)
{
    if (b > a)
    {
        return gcd(b, a);
    }
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}
int expo(int a, int b, int m)
{
    int res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = (res * a) % m;
        a = (a * a) % m;
        b = b >> 1;
    }
    return res;
}
void extendgcd(int a, int b, int *v)
{
    if (b == 0)
    {
        v[0] = 1;
        v[1] = 0;
        v[2] = a;
        return;
    }
    extendgcd(b, a % b, v);
    int x = v[1];
    v[1] = v[0] - v[1] * (a / b);
    v[0] = x;
    return;
} //pass an arry of size1 3
int mminv(int a, int b)
{
    int arr[3];
    extendgcd(a, b, arr);
    return arr[0];
} //for non prime b
int mminvprime(int a, int b) { return expo(a, b - 2, b); }
void swap(int &x, int &y)
{
    int temp = x;
    x = y;
    y = temp;
}
int combination(int n, int r, int m, int *fact, int *ifact)
{
    int val1 = fact[n];
    int val2 = ifact[n - r];
    int val3 = ifact[r];
    return (((val1 * val2) % m) * val3) % m;
}
void google(int t) { cout << "Case #" << t << ": "; }
vi sieve(int n)
{
    int *arr = new int[n + 1]();
    vi vect;
    for (int i = 2; i <= n; i++)
        if (arr[i] == 0)
        {
            vect.push_back(i);
            for (int j = 2 * i; j <= n; j += i)
                arr[j] = 1;
        }
    return vect;
}
int mod_add(int a, int b, int m)
{
    a = a % m;
    b = b % m;
    return (((a + b) % m) + m) % m;
}
int mod_mul(int a, int b, int m)
{
    a = a % m;
    b = b % m;
    return (((a * b) % m) + m) % m;
}
int mod_sub(int a, int b, int m)
{
    a = a % m;
    b = b % m;
    return (((a - b) % m) + m) % m;
}
int mod_div(int a, int b, int m)
{
    a = a % m;
    b = b % m;
    return (mod_mul(a, mminvprime(b, m), m) + m) % m;
} //only for prime m
int phin(int n)
{
    int number = n;
    if (n % 2 == 0)
    {
        number /= 2;
        while (n % 2 == 0)
            n /= 2;
    }
    for (int i = 3; i <= sqrt(n); i += 2)
    {
        if (n % i == 0)
        {
            while (n % i == 0)
                n /= i;
            number = (number / i * (i - 1));
        }
    }
    if (n > 1)
        number = (number / n * (n - 1));
    return number;
} //O(sqrt(N))
  /*--------------------------------------------------------------------------------------------------------------------------*/
void c_p_c()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve()
{

}
int32_t main()
{
    c_p_c();
    int n=0;
    cin>>n;
    int amt = ((108*n)/100);
    if( amt < 206){
        cout <<"Yay!\n";
    } else if(amt==206)
    {
        cout << "so-so\n";
    } else {
        cout << ":(\n";
    }
    // w(t)
    // {
    //     solve();
    // }
}

#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<ll, ll>;
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 << 60) - 1;  // 4611686018427387904 - 1

template <typename T>
void arrPrint(vector<T> arr) {
    for (auto v : arr) {
        cout << v << " ";
    }
    cout << endl;
}

template <typename T>
void arrPrint2Dim(vector<vector<T>> arr) {
    for (auto a : arr) {
        arrPrint(a);
    }
}

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

    ll N;
    cin >> N;
    ll ans = N * 1.08;
    if (ans == 206) {
        COUT("so-so");
    } else if (ans < 206) {
        COUT("Yay!");
    } else {
        COUT(":(");
    }
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
	long double i,ans=0,x,y,r,k,a,b;
	scanf("%Lf %Lf %Lf",&x,&y,&r);
	r+=1e-14;
	for(i=ceil(x-r);i<=floor(x+r);i+=1.0)
	{
		k=sqrt(r*r-(x-i)*(x-i));
		a=floor(y+k);b=ceil(y-k);
		ans+=a-b+1.0;
	}
	printf("%.0Lf\n",ans);
	return 0;
}

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

int main()
{
  int X,Y,Z,A;
  double x,z;

  cin >> X >> Y >> Z;

  x = (double)Y / X;
  A = x * Z;

  while(true){
    z = (double)A / Z;
    if(z >= x) break;
    A++;
  }

  A--;

  cout << A << endl;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
// typedef pair<int,int> P;
// typedef pair<int,P> IP;
// typedef pair<P,P> PP;
double const PI=3.141592653589793;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

ll N,Q;
ll A[100001];

int main(){
    cin>>N>>Q;
    repn(i,N) cin>>A[i];

    while(Q--){
        ll K;
        cin>>K;
        ll l=0, r=LINF;
        while(r-l>1){
            ll m=(l+r)/2;
            ll l2=0, r2=N+1;
            while(r2-l2>1){
                ll m2=(l2+r2)/2;
                if(A[m2]<=m) l2=m2;
                else r2=m2;
            }
            // cout<<"m,l2 "<<m<<' '<<l2<<endl;
            if(m-l2<K) l=m;
            else r=m;
        }
        cout<<r<<endl;
    }

    return 0;
}

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

int main()
{
	int A,B;
	cin >> A >> B;
	int ans = 0;
	for (int i = 1; i <= 200005; ++i)
	{
		int aa = (A-1)/i;
		int bb = B/i;
		if (bb - aa >= 2) ans = i;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define Aint(vec) vec.begin(), vec.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repc(bit, k, n) for (int bit = (1 << k) - 1; bit < (1 << n); bit = next_combination(bit))
#define repi(itr, vec) for (auto itr = vec.begin(); itr != vec.end(); ++itr)
#define lb(bec, val) lower_bound(Aint(bec), val)
using namespace std;
using pii = pair<int,int>;

void uniq(vector<int> &vec)
{
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return;
}
vector<pii> factorize(int n)
{
  vector<pii> ret;
  for (int i = 2; i * i <= n; i++)
  {
    int temp = 0;
    while (n % i == 0)
    {
      temp++;
      n /= i;
    }
    if (temp != 0)
      ret.push_back(make_pair(i, temp));
  }
  if (n > 1)
    ret.push_back(make_pair(n, 1));
  return ret;
}
int po(int a, int n){
  int ret =1,temp= a;
  while(n>0){
    if(n&1)ret*=temp;
    temp = temp*temp;
    n>>=1;
  }
  return ret;

}
int bs(pii p, const vector<int> &vec){
  int YES = 0;
  int NO = p.second+1;
  while(NO-YES>1){
    int temp = (YES+NO)/2;
    int cur = po(p.first, temp);
    bool yes = true;
    repi(itr, vec){
      if((*itr)%cur){
        yes = false;
        break;
      }
    }
    if(yes)YES = temp;
    else NO = temp;

  }
  return YES ;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;cin>>n;
  vector<int>vec(n);
  rep(i,n)cin>>vec[i];
  uniq(vec);
  auto fac = factorize(vec.front());
  int ans = 1;
  repi(itr, fac){
    ans *= po((*itr).first, bs(*itr, vec));
  }
  cout<<ans<<endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define endl '\n'
#define sf(n) scanf("%d",&n);
#define pf(n) printf("%d\n",n);
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{
	fast_io;
	int a,b;
	cin >> a >> b;
	double ans = 0;
	ans  = double(a)/100 * double(b);
	cout << ans << endl;
	return 0;
}


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

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

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#define debug(...) fprintf(stderr, __VA_ARGS__);
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;

#define fs first
#define sc second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;

const int N = 1e5 + 10;
const int mod = 1e9 + 7;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 Rand(seed);
uniform_int_distribution<ll> ran(0, 1ll << 62);
void ucin() {
  ios::sync_with_stdio(0); cin.tie(0);
}
// uniform_real_distribution<double> dbran;
template<class T> inline void chkmax(T &x, const T &y) { if(x < y) x = y; }
template<class T> inline void chkmin(T &x, const T &y) { if(x > y) x = y; }

inline ll sqr(ll x) { return x * x; }
inline ll cub(ll x) { return x * x * x; }
const ll INF = 1ll << 60;
int n, m, d[18][N];
ll ans;
vector<int> G[N];
void getdis(int s, int *d) {
  fill(d + 1, d + n + 1, -1);
  queue<int> q; d[s] = 0; q.push(s);
  while(q.size()) {
    int u = q.front(); q.pop();
    for(int v : G[u]) if(-1 == d[v]) {
      d[v] = d[u] + 1; q.push(v);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  rep(i, 1, m) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].pb(v); G[v].pb(u);
  }
  static int seq[32];
  static ll dp[1 << 17 | 5][19];
  int k; scanf("%d", &k);
  rep(i, 1, k) scanf("%d", seq + i);
  rep(i, 1, k) getdis(seq[i], d[i]);
  for(int i = 0; i < k; i ++) dp[1 << i][i] = 0;
  for(int i = 1; i < (1 << k); i ++) {
    int c = 0;
    for(int j = 0; j < k; j ++) c += i >> j & 1;
    if(c == 1) continue ;
    for(int j = 0; j < k; j ++) if(i >> j & 1) {
      dp[i][j] = INF;
      for(int u = 0; u < k; u ++) if(u != j && (i >> u & 1) && dp[i ^ (1 << j)][u] < INF && ~d[u + 1][seq[j + 1]]) {
        chkmin(dp[i][j], dp[i ^ (1 << j)][u] + d[u + 1][seq[j + 1]]);
      }
    }
  }
  ll ans = INF;
  for(int i = 0; i < k; i ++) chkmin(ans, dp[(1 << k) - 1][i]);
  cout << ( ans == INF ? -1 : 1 + ans ) << '\n';
  return 0;
}

#include <bits/stdc++.h>
#define all(x)    x.begin(), x.end()
#define allr(x)   x.rbegin(), x.rend()
#define sz(x)     ((int)x.size())
#define ln(x)     ((int)x.length())
#define mp        make_pair
#define pb        push_back
#define ff        first
#define ss        second
#define endl      '\n'
#define dbg(x)    cout << #x << ": " << x << endl;
#define clr(x,v)  memset(x, v, sizeof(x));
#define fix(x)    cout << setprecision(x) << fixed;
#define FASTIO    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

using ll = long long int;
using ld = long double;
using pi = pair<int, int>;

const double PI = acos(-1.0);
const double eps = 1e-9;
const ll mod = 1e9 + 7;
const int inf = 1e7;
const int MAXN = 1e5 + 5;

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

void cp()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> adj(n);
    for(int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    int k;
    cin >> k;
    vector<int> gem(k);
    for(int &x : gem)
        cin >> x, x--;

    bool ok = true;

    vector<vector<int>> dist(k, vector<int>(k, inf));
    for(int i = 0; i < k; i++)
    {
        vector<bool> vis(n);
        vector<int> D(n, inf);
        queue<int> q;
        q.push(gem[i]);
        D[gem[i]] = 0;
        while(!q.empty())
        {
            int u = q.front();
            q.pop();
            vis[u] = 1;

            for(int v : adj[u])
                if(!vis[v])
                    q.push(v), D[v] = D[u] + 1, vis[v] = 1;
        }

        for(int j = 0; j < k; j++)
            dist[i][j] = D[gem[j]];
    }

    function<int(int, int)> solve = [&](int i, int mask)
    {
        if(mask == (1 << k) - 1) return 0;
        int &ret = dp[i][mask];
        if(~ret) return ret;
        int ans = inf;
        for(int j = 0; j < k; j++)
            if(!((mask >> j) & 1))
                ans = min(ans, dist[i][j] + solve(j, mask | (1 << j)));
        return ret = ans;
    };
    clr(dp, -1);
    int ans = inf;
    for(int i = 0; i < k; i++)
        ans = min(ans, 1 + solve(i, 1 << i));

    if(ans == inf) ans = -1;
    cout << ans << endl;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}


//khodaya khodet komak kon
# include <bits/stdc++.h>

/*
// ordered_set
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/

using namespace std;

typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;

# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define lc                                              id << 1
# define rc                                              id << 1 | 1
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);

ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

const int xn = 2e5 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const ld eps = 1e-15;
const int mod = 998244353;
const int base = 257;

ll n, ans, fakeans = INF;
vector <ll> vec[3];

ll check(ll x, int id){
	int l = - 1, r = SZ(vec[id]);
	while (r - l > 1){
		int mid = l + r >> 1;
		if (vec[id][mid] <= x)
			l = mid;
		else
			r = mid;
	}
	ll res = INF;
	if (l + 1)
		res = min(res, abs(vec[id][l] - x));
	if (r < SZ(vec[id]))
		res = min(res, abs(vec[id][r] - x));
	if (SZ(vec[id]) % 2)
		fakeans = min(fakeans, res);
	return res;
}

int main(){
	InTheNameOfGod;

	cin >> n;
	for (int i = 0; i < n + n; ++ i){
		ll x;
		char c;
		cin >> x >> c;
		if (c == 'R')
			vec[0].push_back(x);
		else if (c == 'G')
			vec[1].push_back(x);
		else
			vec[2].push_back(x);
	}
	for (int i = 0; i < 3; ++ i)
		sort(all(vec[i]));
	for (int i = 0; i < 3; ++ i){
		if (SZ(vec[i]) % 2 == 0)
			continue;
		ll mn = INF;
		for (ll x : vec[i])
			for (int j = 0; j < 3; ++ j)
				if (i != j)
					mn = min(mn, check(x, j));
		ans += mn;
	}
	ans = min(ans, fakeans);
	cout << ans << endl;

	return 0;
}

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

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

ll A[200000], tmp[200001];
void pakuri_sort(int N, ll A[]) {
	const int b = 9;
	rep(k, 6) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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

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

	int N = getint();

	int K[3] = {};
	rep(i, N << 1) {
		ll a = getint();
		char c = *ci++;
		ci++;
		ll C = (ll(c) >> 4 | ll(c) << 1) & 3;
		K[C]++;
		A[i] = a | C << 50;
	}
	pakuri_sort(N * 2, A);
	if (K[0] % 2 == 0 && K[1] % 2 == 0 && K[2] % 2 == 0) {
		co(0);
		return 0;
	}

	auto P = A;
	auto Q = A + K[0];
	auto R = A + K[0] + K[1];
	const ll ma = (1ll << 50) - 1;
	for(int i = N * 2 - 1; i >= K[0]; i--) A[i] &= ma;
	ll sai[3] = {};
	ll saiq = 1e18, sair = 1e18;
	int q = 0, r = 0;
	rep(p, K[0]) {
		if (q < K[1]) if (saiq > abs(Q[q] - P[p])) saiq = abs(Q[q] - P[p]);
		while (q < K[1] - 1 && Q[q] < P[p]) {
			q++;
			if (saiq > abs(Q[q] - P[p])) saiq = abs(Q[q] - P[p]);
		}
		if (r < K[2]) if (sair > abs(R[r] - P[p])) sair = abs(R[r] - P[p]);
		while (r < K[2] - 1 && R[r] < P[p]) {
			r++;
			if (sair > abs(R[r] - P[p])) sair = abs(R[r] - P[p]);
		}
	}
	sai[2] = saiq;
	sai[1] = sair;
	sair = 1e18;
	r = 0;
	q = 0;
	while (q < K[1]) {
		if (r < K[2]) if (sair > abs(R[r] - Q[q])) sair = abs(R[r] - Q[q]);
		while (r < K[2] - 1 && R[r] < Q[q]) {
			r++;
			if (sair > abs(R[r] - Q[q])) sair = abs(R[r] - Q[q]);
		}
		q++;
	}
	sai[0] = sair;
	ll kotae = 1e18;
	if (K[0] % 2 == 0) kotae = min(sai[0], sai[1] + sai[2]);
	else if (K[1] % 2 == 0) kotae = min(sai[1], sai[2] + sai[0]);
	else kotae = min(sai[2], sai[0] + sai[1]);
	co(kotae);

	Would you please return 0;
}


#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }

  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

int main(){
   ll n, q ; cin>>n>>q ;
   SegmentTree<ll> A(n,[] (ll a,ll b) {return ll (a^b) ;},0ll) ;
   vector<ll> B(n) ;
   rep(i,n){
       ll jj ; cin>>jj ;
       B[i] = jj ;
       A.set(i+1,jj) ;
   }
   A.build() ;
   while(q--){
    ll t, x,y ; cin>>t>>x>>y ;
    if(t==1){

        ll yy=B[x-1]^y ;
        A.update(x,yy) ;
        B[x-1]=yy ;
    }
    else cout<<A.query(x,y+1)<<endl ;
   }
   return 0 ;
}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
typedef long long int ll;
typedef long double ld;

#define endl '\n'
#define loop(i,m,n) for(int i=m;i<n;i++)
#define loope(i,m,n) for(int i=m;i<=n;i++)
#define epool(i,m,n) for(int i=m;i>=n;i--)
#define mod 1000000007
#define mod2 998244353
#define deb(x) cerr << #x << " = " << (x) << endl;
#define deb2(x,y) cerr << "[" << #x << " = " << (x) << ", " << #y << " = " << (y) << "]" << endl;
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end()
#define umap unordered_map<ll,ll>
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>
#pragma pack(1)
const ll INF=1e18;
const double PI=4*atan(1);
const double eps=1e-8;

#define SpeedForce               \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                    \
    cout.tie(0);

//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;

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

int myxor(int a,int b){
    return ((a|b)&(~a|~b));
}

ll max(ll a,ll b){
    if(a>=b) return a;
    return b;
}

ll min(ll a,ll b){
    if(a<=b) return a;
    return b;
}

void solve(){
    ll n,m,t;
    cin >> n >> m >> t;
    ll ans=n;
    ll a[m],b[m];
    bool f=0;
    for(int i=0;i<m;i++){
        cin >> a[i] >> b[i];
        if(i==0){
            ans-=a[i];
            ans=max(ans,0);
            if(ans<=0) f=1;
            ans+=min(n,(b[i]-a[i]));
            ans=min(ans,n);
        }
        else{
            ans-=(a[i]-b[i-1]);
            ans=max(ans,0);
            if(ans<=0) f=1;
            ans+=min(n,(b[i]-a[i]));
            ans=min(ans,n);
        }
    }

    ans-=(t-b[m-1]);
    if(ans<=0) f=1;
    if(f){
        cout << "No";
    }
    else cout << "Yes";

}

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

    int t;
    t=1;
    //cin >> t;
    cerr << endl;
    int cnt=1;
    while (t--){
       // cout << "Case #" << cnt << ": ";
        //cout << fixed << setprecision(6);
        solve();
        cnt++;
    }
    cerr << "Time : " << 1000*((double)clock())/ (double)CLOCKS_PER_SEC << "ms" << endl;
}


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

#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1

#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n;
vector<li> edges[111];

unordered_map<bitset<110>, double> memo;

inline set<li> visit(li root) {
    queue<li> q;
    q.push(root);
    set<li> res;
    while (!q.empty()) {
        li now = q.front();
        q.pop();
        if (res.count(now) > 0) {
            continue;
        }
        res.insert(now);
        for (auto next : edges[now]) {
            q.push(next);
        }
    }
    return res;
}

int main() {
    cin >> n;
    rin{
        string s;
        cin >> s;
        rep(j, n) {
            if (s[j] == '1') {
                edges[i].pb(j);
            }
        }
    }

    vector<li> deletable(n);
    rin{
        for (auto v : visit(i)) {
            deletable[v]++;
        }
    }
    double res = 0.0;
    rin{
        res += 1.0 / deletable[i];
    }
    printf("%.12f\n", res);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#ifdef EVAL
#define debug(...) cerr << '(' << #__VA_ARGS__ << "): " << (__VA_ARGS__) << '\n';
#else
#define debug(...) 42
#endif
constexpr long long tenpowten = 10000000000;
bool tst(string T) {
  if (T.length() == 1) return true;
  if (T.length() == 2) {
    if (T == "00") return false;
    return true;
  }
  if ((T[0] - '0') + (T[1] - '0') + (T[2] - '0') != 2) return false;
  for (int i = 3; i < T.length(); i++) {
    if (T[i] != T[i % 3]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  string T;
  cin >> N >> T;
  if (!tst(T)) {
    cout << 0;
    return 0;
  }
  if (T == "1") {
    cout << 2 * tenpowten;
    return 0;
  }
  if (T == "0") {
    cout << tenpowten;
    return 0;
  }
  if (T == "01") {
    cout << tenpowten - 1;
    return 0;
  }
  if (T == "10") {
    cout << tenpowten;
    return 0;
  }
  if (T == "11") {
    cout << tenpowten;
    return 0;
  }
  if (N == 3) {
    if (T == "110") {
      cout << tenpowten;
      return 0;
    }
    cout << tenpowten - 1;
    return 0;
  }
  if (N == 4) {
    cout << tenpowten - 1;
    return 0;
  }
  int cnt110 = N, minus = 0;
  if (T.substr(0, 3) == "011") {
    cnt110--;
    minus++;
  } else if (T.substr(0, 3) == "101") {
    cnt110 -= 2;
    minus++;
  }
  if (T.substr(N - 3, 3) == "101") {
    cnt110--;
    minus++;
  } else if (T.substr(N - 3, 3) == "011") {
    cnt110 -= 2;
    minus++;
  }
  cnt110 /= 3;
  cout << tenpowten - cnt110 + 1 - minus;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int int64_t
int32_t main()
{
    set<int> ans;
    for(int i=0;i<=200001;i++)
    {
        ans.insert(i);
    }
    int n;cin>>n;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        if(ans.find(x)!=ans.end())
        {
            ans.erase(x);
        }
        cout<<*ans.begin()<<"\n";
    }
    return 0;
}

#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define Toggle(n,i) (n^((ll)1<<i))
#define Check(n,i) (n&((ll)1<<i))
#define Set(n,i) (n|((ll)1<<i))
#define Reset(n,i) (n&(~((ll)1<<i)))
#define fo(a,x,y) for(int i=(x);i<=(y);++i){cout<<a[i]<<" ";}cout<<endl;
#define me(arr,val) memset(arr,val,sizeof arr)
#define inf 10e8
#define infd DBL_MAX
#define infl 10e17
#define mod 1000000007ll
#define f first
#define s second
#define  g(t,a)  (get<a>(t))
#define pra(a) for(auto i:a){cout<<i<<endl;}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//int dx[]={+1,-1,0,0};//vertical horizontal
//int dy[]={0,0,+1,-1};//vertical horizontal
//int dx[]={+1,+1,-1,-1,+2,-2,+2,-2};//knights move
//int dy[]={+2,-2,+2,-2,+1,+1,-1,-1};//knights move
//int dx[]={+1,-1,0,0,+1,+1,-1,-1};//vertical horizontal diagonal
//int dy[]={0,0,+1,-1,-1,+1,+1,-1};//vertical horizontal diagonal
using namespace std;
using namespace __gnu_pbds;
/*typedef tree<int, null_type,less<int>, rb_tree_tag,
             tree_order_statistics_node_update>indexed_set;
for set use above*/
typedef tree<pair<int,int>, null_type,less<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update> indexed_multiset;
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
    os << "[";
    typename multiset< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}
#define pr(x) cerr << #x << " = " << x << endl;
int vis[1000005];

int main()
{
    int n,prev=0;
    cin>>n;
    while(n--)
    {
        int num;
        cin>>num;
        vis[num]=1;
        while(vis[prev])
        {
            ++prev;
        }
        cout<<prev<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define ll long long
#define inf (1<<30)
#define INF (1LL<<60)
//#define int long long
//const int mod=998244353;
//const int mod=1e9+7;
const int N=1e5+5,M=5e5+5;
//int head[M],to[M],nxt[M],tot;
using namespace std;

int n,a[N];
bool f[N<<2];
void Clear(){

	return;
}
void work(){
	Clear();
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
//		f[a[i]]=1;
	}
	f[0]=1;
	for(int i=1;i<=n;i++){
		for(int j=sum;j>=a[i];j--){
			f[j]|=f[j-a[i]];
		}
	}
	for(int i=sum/2;i>=0;i--)
		if(f[i]){
			cout<<sum-i<<endl;
			return;
		}
}
signed main(){
	int T=1;
//	scanf("%d",&T);
	while(T--)work();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).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 (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    string s,t;cin >> s >> t;
    vector<int> a(n),b(n);
    REP(i,n){
        a[i]=s[i]-'0';
        b[i]=t[i]-'0';
    }
    int cnt=0;
    REPR(i,n){
        cnt+=a[i]-b[i];
        if(cnt<0){
            cout << -1 << endl;
            return 0;
        }
    }
    if(cnt%2==1){
        cout << -1 << endl;
        return 0;
    }
    ll ans=0;
    stack<int> st;
    queue<int> q;
    REP(i,n){
        if(b[i]==1){
            q.push(i);
        }
        if(a[i]==1){
            if(!st.empty()){
                int p=st.top();
                st.pop();
                ans+=i-p;
            }
            else if(q.empty()){
                st.push(i);
            }
            else{
                int p=q.front();
                q.pop();
                ans+=i-p;
            }
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define mt make_tuple
#define tp(pos, name) get<pos>(name)
#define ld long double
#define VNAME(name) (#name)
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
typedef tuple<int, int, int> mkgroups;

void debug_out() { cout << '\n'; }

template<typename T, typename... R>
void debug_out(const T &f, const R &... r) {
    cout << f << " ";
    debug_out(r...);
}

template<typename A, typename B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
    out << "(" << a.first << "," << a.second << ")";
    return out;
}

template<typename Tuple, size_t N>
struct tuple_print {
    static void print(const Tuple &t, std::ostream &os) {
        tuple_print<Tuple, N - 1>::print(t, os);
        os << ", " << std::get<N - 1>(t);
    }
};

template<typename Tuple>
struct tuple_print<Tuple, 1> {
    static void print(const Tuple &t, std::ostream &os) { os << "(" << std::get<0>(t); }
};

template<typename... Args>
ostream &operator<<(ostream &os, const tuple<Args...> &t) {
    tuple_print<decltype(t), sizeof...(Args)>::print(t, os);
    return os << ")";
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    out << "[";
    bool first = true;
    for (auto &v : a) {
        out << (first ? "" : ", ");
        out << v;
        first = 0;
    }
    out << "]";
    return out;
}

template<typename T, class Cmp>
ostream &operator<<(ostream &out, const set<T, Cmp> &a) {
    out << "{";
    bool first = true;
    for (auto &v : a) {
        out << (first ? "" : ", ");
        out << v;
        first = 0;
    }
    out << "}";
    return out;
}

template<typename U, typename T, class Cmp>
ostream &operator<<(ostream &out, const map<U, T, Cmp> &a) {
    out << "{";
    bool first = true;
    for (auto &p : a) {
        out << (first ? "" : ", ");
        out << p.first << ":" << p.second;
        first = 0;
    }
    out << "}";
    return out;
}

template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) { cerr << name << ": " << arg1 << endl; }

template<typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

const ll mod = 1e9 + 7;
const int N = 1e6 + 100;
int T;
string str;
int n;

int main() {
    ios::sync_with_stdio(false);
    cin >> str >> n;
    vector<int> v;
    for (auto x:str) {
        if (isdigit(x))v.push_back(x - '0');
        else v.push_back(x - 'A' + 10);
    }
    vector<vector<ll>> f(str.size() + 1, vector<ll>(18, 0));
    int state = 0;
    for (int i = 0; i < str.size(); i++) {
        for (int j = 1; j <= 16; j++) {
            f[i + 1][j] = (f[i + 1][j] + f[i][j] * 1ll * j) % mod;
            f[i + 1][j + 1] = (f[i + 1][j + 1] + f[i][j] * 1ll * (16 - j)) % mod;
        }
        f[i + 1][1] = (f[i + 1][1] + f[i][0] * 15ll) % mod;
        f[i + 1][0] = (f[i + 1][0] + f[i][0]) % mod;
        for (int j = 0; j < v[i]; j++) {
            int cut = state;
            if (i || j)cut |= (1 << j);
            f[i + 1][__builtin_popcount(cut)] += 1;
        }
        state |= (1 << v[i]);
    }
    cout << f[str.size()][n] + (__builtin_popcount(state) == n);
    return 0;
}

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

using namespace std;

const int maxn = 2e5 + 50, INF = 0x3f3f3f3f, mod = 1e9 + 7;

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

int n, k, ans, a[maxn], s[maxn], f[maxn][17];
char str[maxn];

inline int addmod (register int a, register int b) {
	return a += b, a >= mod ? a - mod : a;
}

inline int DFS (register int now, register int cnt, register bool flag0, register bool flag1, register int ans = 0) {
	if (cnt < 0 || cnt > n - now + 1) return 0;
	if (now == n + 1) return 1;
	if (! flag0 && ! flag1 && f[now][cnt] != -1) return f[now][cnt];
	if (flag1) {
		for (register int i = 0; i <= a[now]; i ++) {
			if (s[now - 1] & 1 << i) ans = addmod (ans, DFS (now + 1, cnt, 0, i == a[now]));
			else ans = addmod (ans, DFS (now + 1, cnt - 1, 0, i == a[now]));
		}
	} else if (flag0) ans = addmod (ans, addmod (DFS (now + 1, cnt, 1, 0), 1ll * DFS (now + 1, cnt - 1, 0, 0) * (15 - k + cnt) % mod));
	else ans = addmod (ans, addmod (1ll * DFS (now + 1, cnt, 0, 0) * (k - cnt) % mod, 1ll * DFS (now + 1, cnt - 1, 0, 0) * (16 - k + cnt) % mod));
	if (! flag0 && ! flag1) return f[now][cnt] = ans;
	else return ans;
}

int main () {
	scanf ("%s", str + 1), n = strlen (str + 1), k = read(), memset (f, -1, sizeof f);
	for (register int i = 1; i <= n; i ++) {
		if (str[i] >= '0' && str[i] <= '9') a[i] = str[i] - '0';
		else a[i] = str[i] - 'A' + 10;
		s[i] = s[i - 1] | 1 << a[i];
	}
	for (register int i = 0; i <= a[1]; i ++) {
		if (i == 0) ans = addmod (ans, DFS (2, k, 1, 0));
		else if (i == a[1]) ans = addmod (ans, DFS (2, k - 1, 0, 1));
		else ans = addmod (ans, DFS (2, k - 1, 0, 0));
	}
	return printf ("%d\n", ans), 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define REPA(i,j) for(int i=1;i<=j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const int INF=1<<30;
inline void read(int &x){
//	short neg=1;
	x=0;
	char c=getchar();
	/*while(c<'0'||c>'9'){
		if(c=='-')neg=-1;
		c=getchar();
	}*/
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+(c^48),c=getchar();
	}
//	x*=neg;
}
int t;
int main(void){
	cin>>t;
	REP(ii,t){
		ll L,R;
		cin>>L>>R;
		ll ans;
		if(R-L<L)ans=0;
		else ans=(R-L+1)*(R-2*L+1)-R*(R-2*L+1)/2;
		cout<<ans<<endl;
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>

using namespace std;
int t,l,r;
long long c,ans;
int main()
{
	int i,j;
	scanf("%d",&t);
	for (i=1;i<=t;i++)
	{
		scanf("%d%d",&l,&r);
		if (l+l>r) {printf("0\n"); continue;}
		c=r-l-l;
		ans=(c+1+1)*(c+1)/2;
		printf("%lld\n",ans);
	}
	return 0;
}