#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define MOD 998244353
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<int,int> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }

i64 ceil(i64 a, i64 b) { return (a+b-1)/b; }
mt19937_64 rnd(time(NULL));

const int n = 30;
const int Q = 1000;
int e[30][30][4];
int etimes[30][30][4];
int dh[4] = {0,-1,0,1}, dw[4] = {-1,0,1,0};
char dc[4] = {'L','U','R','D'};
map<char, int> dtoi;
void update(string s, int cost, int h, int w){
    int sz = s.size();
    int c = cost / sz;
    for(int i = 0; i < sz; i++){
      int d = dtoi[s[i]];
      etimes[h][w][d]++;
      e[h][w][d] += (c - e[h][w][d]) / (etimes[h][w][d] + 1);
      int nh = h + dh[d];
      int nw = w + dw[d];
      etimes[nh][nw][d ^ 2] = etimes[h][w][d];
      e[nh][nw][d ^ 2] = e[h][w][d];
      h = nh;
      w = nw;
    }
}

void solve(){
  //前処理
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      for(int d = 0; d < 4; d++){
        e[i][j][d] = 1000;
      }
    }
  }
  for (int d = 0; d < 4; d++) {
    dtoi[dc[d]] = d;
  }
  //

  for(int t = 0; t < Q; t++){
    int ah, aw, bh, bw;
    cin >> ah >> aw >> bh >> bw;

    string ans;
    //
    priority_queue<pair<int, P>, vector<pair<int, P>>, greater<pair<int, P>>> pq;
    pq.push(make_pair(0, P(ah, aw)));
    string s[30][30];
    int mi[30][30];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        mi[i][j] = INF;
      }
    }
    mi[ah][aw] = 0;
    while (!pq.empty()) {
      auto p = pq.top();
      pq.pop();
      int c = p.first;
      int h = p.second.first;
      int w = p.second.second;
      if (h == bh && w == bw) {
        break;
      }
      for (int d = 0; d < 4; d++) {
        int nh = h + dh[d];
        int nw = w + dw[d];
        if (nh < 0 || nw < 0 || nh >= n || nw >= n)
          continue;
        int nc = c + e[h][w][d];
        if (mi[nh][nw] <= nc)
          continue;
        mi[nh][nw] = nc;
        pq.push(make_pair(nc, P(nh, nw)));
        s[nh][nw] = s[h][w];
        s[nh][nw] += dc[d];
      }
    }
    //
    ans = s[bh][bw];
    cout << ans << endl;

    int cost;
    cin >> cost;
    //
    update(ans, cost, ah, aw);
    //
  }
}

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

	return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<random>
#include<map>
long long int realOdometer = 0;
long long int manhattanOdometer = 0;
long long int generalAverage = 0;
using namespace std;
int main(){
  pair<int, int>s, t;
  map<pair<pair<int, int>, pair<int, int>>, pair<int, int>>distance;
  int loopCount = 0;
  while(cin >> s.first >> s.second >> t.first >> t.second){
    string str = "";
    for(int i=0; i<abs(t.first-s.first); i++){
      str = str + (t.first-s.first>0? "D": "U");
    }
    for(int i=0; i<abs(t.second-s.second); i++){
      str = str + (t.second-s.second>0? "R": "L");
    }
    mt19937 g(loopCount);
    shuffle(str.begin(), str.end(), g);
    if(loopCount<2){
      cout << str << endl;
    }else{
      str.clear();
      pair<int, int>currentPos = s;
      while(currentPos!=t){
        if(currentPos.first==t.first||currentPos.second==t.second){
          if(currentPos.first==t.first){
            str.push_back(currentPos.second<t.second? 'R': 'L');
          }else{
            str.push_back(currentPos.first<t.first? 'D': 'U');
          }
        }else{
          pair<int, int>component0 = make_pair(currentPos.first, currentPos.second + (currentPos.second<t.second? +1: -1));
          pair<int, int>component1 = make_pair(currentPos.first + (currentPos.first<t.first? +1: -1), currentPos.second);
          pair<pair<int, int>, pair<int, int>>candidate0 = make_pair(currentPos, component0);
          pair<pair<int, int>, pair<int, int>>candidate1 = make_pair(currentPos, component1);
          if(candidate0.first>candidate0.second){
            swap(candidate0.first, candidate0.second);
          }
          if(candidate1.first>candidate1.second){
            swap(candidate1.first, candidate1.second);
          }
          int d0 = distance[candidate0].first!=0? distance[candidate0].first: generalAverage;
          int d1 = distance[candidate1].first!=0? distance[candidate1].first: generalAverage;
          if(d0<d1){
            str.push_back(currentPos.second<t.second? 'R': 'L');
          }else{
            str.push_back(currentPos.first<t.first? 'D': 'U');
          }
        }
        currentPos.first+= (str.back()=='D') - (str.back()=='U');
        currentPos.second+= (str.back()=='R') - (str.back()=='L');
      }
      cout << str << endl;
    }
    long long int D;
    cin >> D;
    realOdometer+= D;
    manhattanOdometer+= str.length();
    generalAverage = realOdometer/manhattanOdometer;
    int manhattan_d = str.length();
    vector<pair<pair<int, int>, pair<int, int>>>toDoList;
    for(int i=0; i<manhattan_d; i++){
      pair<int, int>temp1, temp2;
      if(i!=0){
        temp1 = toDoList.back().second;
      }else{
        temp1 = s;
      }
      auto convert = [&](char c){
        pair<int, int> val = temp1;
        if(c=='R'||c=='L'){
          val = make_pair(val.first, val.second + (c=='R'? +1: -1));
        }else{
          val = make_pair(val.first + (c=='D'? +1: -1), val.second);
        }
        return val;
      };
      temp2 = convert(str.at(i));
      toDoList.push_back(make_pair(temp1, temp2));
    }
    while(toDoList.size()!=0){
      if(toDoList.back().first>toDoList.back().second){
        swap(toDoList.back().first, toDoList.back().second);
      }
      distance[toDoList.back()].second++;
      distance[toDoList.back()].first =
        (distance[toDoList.back()].first * (distance[toDoList.back()].second-1)
        + D/manhattan_d)/distance[toDoList.back()].second;
      toDoList.pop_back();
    }
    loopCount++;
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &i : a) {
        cin >> i;
    }
    sort(a.begin(), a.end());
    ll f = 0;
    for (int i = n - 1; i >= 0; i -= 2) {
        f += a[i];
    }
    ll s = accumulate(a.begin(), a.end(), 0ll);
    if (f > s - f) {
        cout << (n % 2 ? "Second" : "First") << endl;
        return;
    }
    cout << "Second" << endl;
    return;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)

typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
struct fast_ios{ fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;

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

#define TOSTRING(x) string(#x)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os  << "["; for(auto _: v) os << _ << ", "; os << "]"; return os; };
template <typename T> ostream &operator<<(ostream &os, set<T> &st) { os << "("; for(auto _: st) { os << _ << ", "; } os << ")";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair< T, U >& p){os << "{" <<p.first << ", " << p.second << "}";return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &mp){ os << "["; for(auto _: mp){ os << _ << ", "; } os << "]" << endl; return os; }

#define DUMPOUT cerr
void dump_func(){ DUMPOUT << endl; }
template <class Head, class... Tail> void dump_func(Head &&head, Tail &&... tail) { DUMPOUT << head; if (sizeof...(Tail) > 0) { DUMPOUT << ", "; } dump_func(std::move(tail)...); }

#ifdef DEBUG
#define dbg(...) dump_func(__VA_ARGS__)
#define dump(...) DUMPOUT << string(#__VA_ARGS__) << ": "; dump_func(__VA_ARGS__)
#else
#define dbg(...)
#define dump(...)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
void fi(){
    cout << "First" << endl;
}
void se(){
    cout << "Second" << endl;
}
void solve(){
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N)cin >> a[i];
    sort(all(a));
    ll cnt[2] = {0, 0};
    rep(i,N)cnt[i&1] +=a[i];
    dump(cnt[0], cnt[1]);
    if(N == 1){
        se();
        return;
    }
    if(N == 2){
        if(a[0] == a[1])se();
        else fi();
        return;
    }
    if(N&1){
        if(cnt[0] == cnt[1])fi();
        else se();
    }
    else{
        if(cnt[0] == cnt[1])se();
        else fi();
    }
}
int main(){
    int t;
    cin >> t;
    while(t--)solve();
}


/*
    Author: Aryan Yadav
*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define f(i, a, b) for (long long i = a; i < b; i++)
#define rep(i, a, b) for (long long i = a; i <= b; i++)
#define fm(i, a, b) for (long long i = a; i > b; i--)
#define repm(i, a, b) for (long long i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define pqmaxi priority_queue<int>
#define pqmaxl priority_queue<ll>
#define pqmini priority_queue<int, vi, greater<int>>
#define pqminl priority_queue<ll, vl, greater<ll>>
#define all(x) x.begin(), x.end()
#define test     \
    ll test;     \
    cin >> test; \
    while (test--)
#define pb(i) push_back(i)
#define mp(i, j) make_pair(i, j)
#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL)

int main()
{
    fast;
    int n, m, t1;
    cin >> n >> m >> t1;
    int cap = n;
    ll prev = 0;
    f(i, 0, m)
    {
        ll a, b;
        cin >> a >> b;
        cap -= (a - prev);
        cap = max(0, cap);
        if (cap == 0)
        {
            cout << "No";
            exit(0);
        }
        f(j, a, b)
        {
            cap += 1;
        }
        cap = min(cap, n);
        prev = b;
    }
    cap -= (t1 - prev);
    if (cap <= 0)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m; cin >> n >> m;
  if(n==1 && m==0){
    cout << "1 2\n";
    return 0;
  }
  if(m<0 || m>=n-1){
    cout << "-1\n";
    return 0;
  }

  vector<int> l(n), r(n);
  l[0] = 1;
  r[0] = 2;
  FOR(i,1,n){
    l[i] = r[i-1]+2;
    r[i] = l[i]+1;
  }

  if(m>0) r[0] = r[m+1]+1;

  REP(i,n){
    cout << l[i] << " " << r[i] <<'\n';
  }
  return 0;
}


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

typedef long long int ll;
using ii= pair<ll,ll>;
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define all(o) (o).begin(),(o).end()
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ld long double
#define eps 0.00000000001
#define mod 1000000007

class prioritize{
    public: bool operator() (ii &p1,ii &p2){
        return p1.F<p2.F;
    }
};

auto start_time= high_resolution_clock::now();
void time()
{
    #ifndef ONLINE_JUDGE
        auto stop_time= high_resolution_clock::now();
        auto duration= duration_cast<milliseconds>(stop_time-start_time);
        cout<<"run time: "<<duration.count()<<" ms"<<"\n";
    #endif
    return;
}

void ojudge()
{
	#ifndef ONLINE_JUDGE
        freopen("input1.txt","r", stdin);
        freopen("output1.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    return;
}

const int N= 2010;
ll dp[N][N][2];
ll mat[N][N];ll h,w;

ll rec(ll i,ll j,ll turn){

	if(i<1||i>h||j<1||j>w) return 0;
	if(i==h && j==w) return 0;
	if(dp[i][j][turn]!=-1) return dp[i][j][turn];

	if(turn==0){
		ll ans= -1e9;
		if(i+1<=h) ans= max(ans,mat[i+1][j]-rec(i+1,j,1));
		if(j+1<=w) ans= max(ans,mat[i][j+1]-rec(i,j+1,1));
		return dp[i][j][turn]= ans;
	}
	else{
		ll ans= -1e9;
		if(i+1<=h) ans= max(ans,mat[i+1][j]-rec(i+1,j,0));
		if(j+1<=w) ans= max(ans,mat[i][j+1]-rec(i,j+1,0));
		return dp[i][j][turn]= ans;
	}
}

int main()
{
    ojudge();

    cin>>h>>w;

    map<char,ll> mp;
    mp['+']= 1,mp['-']= -1;
    memset(dp,-1,sizeof(dp));

    fr(i,1,h+1){
    	fr(j,1,w+1){
    		char x;cin>>x;
    		mat[i][j]= mp[x];
    	}
    }

    ll v1= rec(1,1,0);
    if(v1>0) cout<<"Takahashi\n";
    else if(v1<0) cout<<"Aoki\n";
    else cout<<"Draw\n";

    time();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){

	int N, M,T;
	cin >> N >> M>>T;

  	int Nmax = N;
	vector<int> A(M);
	vector<int> B(M);

	for(int i = 0; i < M;i++){
		int x = 0;
		int y = 0;
		cin >> x >> y;
		A.at(i) = x;
		B.at(i) = y;
	}

	bool flag = true;

	for(int i = 0; i < M; i++){
      if(i == 0) N -= A.at(i);
      else	N -= (A.at(i) - B.at(i-1));
		if(N <= 0){
			flag = false;
			break;
		}
		N += (B.at(i)-A.at(i));
      	if(N > Nmax){
          N = Nmax;
        }
	}

  	N -= (T - B.at(M-1));

	if(N <= 0){
			flag = false;
		}

	if(flag){
		cout << "Yes" << endl;
	}

	if(flag == false)	cout << "No" <<endl;
}


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

int main(){
  long long n;
  cin >> n;
  long long x = 0, y = 0;
  vector<int> Q;
  auto q = [&](int i){
    if(i == 0){
      x += 1;
    }
    if(i == 1){
      y += 1;
    }
    if(i == 2){
      x += y;
    }
    if(i == 3){
      y += x;
    }
    Q.emplace_back(i);
  };
  vector<long long> F(2,0);
  F[1] = 1;
  for(int i = 2; i < 130; ++i){
    long long t = F[i-1] + F[i-2];
    if(t > n) break;
    F.emplace_back(t);
  }
  vector<int> A;
  long long n_ = n;
  for(int i = F.size()-1; i >= 0; --i){
    if(F[i] <= n_){
      A.emplace_back(i);
      n_ -= F[i];
    }
  }
  q(0);
  int p = 3, j = A[0]-1;
  for(auto a : A){
    if(a == A[0]) continue;
    while(j > a){
      q(p);
      p ^= 1;
      --j;
    }
    q(p&1);
  }
  if(y == n){
    swap(x,y);
    for(auto& q : Q)
      q ^= 1;
  }
  cout << Q.size() << endl;
  for(auto e : Q){
    cout << e+1 << '\n';
  }
  cerr << x << " " << y << endl;
  assert(x == n);
}

#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>
#include <climits>
#include <cstring>
#include <cassert>

using namespace std;
//using namespace atcoder;

#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

// edit

void solve() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    REP(i, N) {
        cin >> A[i];
    }
    REP(i, N) {
        cin >> B[i];
    }

    int diff = *min_element(ALL(B)) - *max_element(ALL(A));
    if (diff < 0) {
        cout << 0 << endl;
    } else {
        cout << diff + 1 << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();

    return 0;
}


#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
// clang-format off
#define PI 3.14159265358979323846264338327950L
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep2(i,s,n) for (int i=(s); i<(int)(n); ++i)
#define prep_ios(do_flush) if(!do_flush){ ios::sync_with_stdio(false);cin.tie(nullptr);constexpr char endl='\n'; } cout<<fixed<<setprecision(20)
#define put(expr) cout<<expr<<'\n'
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "[ "; for (auto v: vec) os << v << " "; os << "]"; return os; }template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "< "; for (auto v: vec) os << v << " "; os << ">"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{ "; for (auto v: vec) os << v << " "; os << "}"; return os; }template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{ "; for (auto v: vec) os << v << " "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{ "; for (auto v: mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{ "; for (auto v: mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
typedef int8_t i8; typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef float f32; typedef double f64; typedef long double f80;
typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef map<int, int> mii;
typedef __int128_t i128; i128 parse(string &s) { i128 ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } istream &operator>>(istream &is, i128 &v) { string s; is >> s; v = parse(s); return is; } ostream &operator<<(ostream &os, const i128 &v) { if (v == 0) return (os << "0"); i128 num = v; if (v < 0) { os << '-'; num = -num; } string s; for (; num > 0; num /= 10) s.push_back('0' + (char)(num % 10)); reverse(s.begin(), s.end()); return (os << s); }
template <typename T> bool chmax(T &now, const T &cand) { if (now < cand) { now = cand; return true; } return false; } template <typename T> bool chmin(T &now, const T &cand) { if (now > cand) { now = cand; return true; } return false; }
template <typename T> T gcd(const T &a, const T &b) { if (a % b == 0) return b; return gcd(b, a % b); } template <typename T> T lcm(const T &a, const T &b) { return a * b / gcd(a, b); }
template <typename T> T nCr(const T &n, T k) { if (k > n) return 0; if (k * 2 > n) k = n - k; if (k == 0) return 1; int result = n; for (int i = 2; i <= k; ++i) { result *= (n - i + 1); result /= i; } return result; }
const int INF = 1<<30; /* INF > 10^9 */ const i64 INFLL = 1LL<<60; /* INFLL > 10^18 */ const string YES = "Yes", NO = "No";

// clang-format on?

int main() {
  prep_ios(true);

  vi anss = vi(1010);

  i64 N, M;
  cin >> N >> M;

  rep(i, N) {
    i64 tmp;
    cin >> tmp;
    ++anss[tmp];
  }

  rep(i, M) {
    i64 tmp;
    cin >> tmp;
    ++anss[tmp];
  }

  bool first = true;
  rep(i, anss.size()){
    if (anss[i]==1){
      if (first) {
        first = false;
      } else{
        cout << ' ';
      }
      cout<<i;
    }
  }
  cout<<endl;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define N 214514
#define all(x) (x).begin(), (x).end()
const ll mod = 998244353;
const ll inf = 8000000000000000000;
int main() {
    vector<ll> used(1010);
    ll n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        used[x] += 1;
    }
    vector<ll> ans;
    for (int i = 0; i < m; i++) {
        ll x;
        cin >> x;
        used[x]++;
    }
    for (int i = 1; i <= 1000; i++) {
        if (used[i] == 1) cout << i << ' ';
    }
    cout << endl;
    return 0;
}


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

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
#define pi 3.1415926535897
int gcd(int a, int b) {
	if (b != 0) return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

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


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

using namespace std;

int main(){

  string S;
  cin >> S;

  int cnt = 0;

  for( int i = 0; i < 10000; i++ ){
    int used[10] = {0};

    for( int a = 0; a < 4; a++ ){
      int temp = i / int(pow(10,a)) % 10;
      used[temp]++;
    }

    int NGflag = 0;
    for( int b = 0; b < 10; b++ ){

      if( S[b] == 'o' && used[b] == 0 ){
        NGflag = 1;
         break;
      }
      if( S[b] == 'x' && used[b] != 0 ){
        NGflag = 1;
         break;
      }

    }

    if( NGflag == 0 ){
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<ll, ll> p;

#define MOD 1000000007

map<ll, ll> m;
map<ll, bool> c;

ll memo(ll x, ll y) {
	if(c[y]) return m[y];
	ll a;
	if(y == 1LL) {
		a = x - 1LL;
	} else if(y % 2LL) {
		a = min(abs(x - y), min(memo(x, (y + 1LL) / 2LL) + 2LL, memo(x, (y - 1LL) / 2LL) + 2LL));
	} else {
		a = min(abs(x - y), memo(x, y / 2LL) + 1LL);
	}
	c[y] = true;
	return m[y] = a;
}

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

	ll X, Y;
	cin >> X >> Y;

	cout << memo(X, Y) << endl;
}

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b; return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b; return true;
    }
    return false;
}
template<int MOD> struct Fp {
    ll val;
    constexpr Fp(ll v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        ll a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, ll n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
constexpr ll MOD = 1e9 + 7;
using mint = Fp<MOD>;

#define pb push_back
#define mp make_pair
#define mt make_tuple

int N, M;
vector<int> As;
vector<int> Xs;
vector<int> Ys;
vector<vector<int>> from_to;
vector<vector<int>> to_from;

vector<int> cache;
int dfs(int n) {
    if (cache[n] != -1e9) return cache[n];

    int mx = 0;
    for(auto v: from_to[n]) {
        chmax(mx, As[v]);
        chmax(mx, dfs(v));
    }
   return cache[n] = mx;
}

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

    cin >> N >> M;
    As.resize(N);
    Xs.resize(M);
    Ys.resize(M);
    from_to.resize(N);
    cache.resize(N, -1e9);

    REP(n, N) cin >> As[n];
    REP(m, M) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        from_to[x].pb(y);
    }
    cin >> N;

    int ans = -1e9;
    REP(n, N) {
        // 買うことができない
        if (SIZE(from_to[n]) == 0) continue;

        int tmp = dfs(n) - As[n];
        chmax(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
    int n;
    string s,t;
    cin >> n >> s >> t;
    vector<int> s0;
    vector<int> t0;
    rep(i,n){
        if(s[i] == '0')s0.push_back(i);
        if(t[i] == '0')t0.push_back(i);
    }
    if(s0.size()!=t0.size()){
        cout << -1 << endl;
        return 0;
    }
    int ans = s0.size();
    rep(i,s0.size()){
        if(s0[i]==t0[i])ans--;
    }
    if(ans < 0)ans = 0;
    cout << ans << endl;
    return 0;
}

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

#define rep(i, l, r) for(int i=(l), i##_end_=(r); i<=i##_end_; ++i)
#define drep(i, l, r) for(int i=(l), i##_end_=(r); i>=i##_end_; --i)
#define fi first
#define se second
#define Endl putchar('\n')
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T>inline T fab(T x){ return x<0? -x: x; }
template<class T>inline T readin(T x){
    x=0; int f=0; char c;
    while((c=getchar())<'0' || '9'<c) if(c=='-') f=1;
    for(x=(c^48); '0'<=(c=getchar()) && c<='9'; x=(x<<1)+(x<<3)+(c^48));
    return f? -x: x;
}

const int maxn=500000;

int a[maxn+5], b[maxn+5], n;

vector<int>pa, pb;

inline void input(){
    n=readin(1);
    rep(i, 1, n) scanf("%1d", &a[i]);
    rep(i, 1, n) scanf("%1d", &b[i]);
}

signed main(){
    input();
    rep(i, 1, n) if(!a[i]) pa.push_back(i);
    rep(i, 1, n) if(!b[i]) pb.push_back(i);
    if(pa.size()!=pb.size()) return printf("-1\n"), 0;
    int ans=0;
    for(int i=0, siz=pa.size(); i<siz; ++i)
        if(pa[i]!=pb[i]) ++ans;
    printf("%d\n", ans);
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
	int x, y;

	cin >> x >> y;
	if (x > y && y + 3 > x)
		cout << "Yes";
	else if(y > x && x + 3 > y)
		cout << "Yes";
	else
		cout << "No";
}

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

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

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

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

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

}
void solve() {
	ll a, b;
	cin >> a >> b;
	if (a < b)
		swap(a, b);
	if (b + 3 > a)
		cout << "Yes";
	else
		cout << "No";
}


#include<set>
#include<ctime>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e4+7;
int read(){
	char c;
	int x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while(isdigit(c)){
		x=x*10+f*(c-48);
		c=getchar();
	}
	return x;
}
struct que{
	int p,i;
	que(int a=0,int b=0){
		p=a;
		i=b;
	}
	friend bool operator <(que a,que b){
		return a.p<b.p;
	}
};
struct sol{
	int a,b,c,d;
	sol(int A=0,int B=0,int C=0,int D=0){
		a=A;
		b=B;
		c=C;
		d=D;
	}
};
int c[N];
bool vis[N];
int n,x,y,r,tot;
vector<que>l[N];
sol ans[N];
int random(int l,int r){
	return rand()%(r-l+1)+l;
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	srand(210280344);
	for(int i=1;i<=n;++i){
		x=read();
		y=read();
		r=read();
		l[x].push_back(que(y,i));
		vis[x]=1;
	}
	for(int i=0;i<N-7;++i){
		if(vis[i]){
			++tot;
			c[tot]=i;
			sort(l[i].begin(),l[i].end());
		}
	}
	c[tot+1]=N-7;
	for(int i=1;i<=tot;++i){
		int A;
		int B;
		int C;
		int D;
		int sz=l[c[i]].size();
		if(i==1)
			A=random(0,c[i]);
		else
			A=random(c[i-1],c[i]);
		C=random(c[i]+1,c[i+1]);
		B=random(0,l[c[i]][0].p);
		if(sz==1){
			D=random(l[c[i]][0].p+1,N-7);
			ans[l[c[i]][0].i]=sol(A,B,C,D);
			c[i]=C;
			continue;
		}
		D=random(l[c[i]][0].p+1,l[c[i]][1].p);
		l[c[i]][0].p=D;
		ans[l[c[i]][0].i]=sol(A,B,C,D);
		for(int j=1;j<sz-1;++j){
			B=random(l[c[i]][j-1].p,l[c[i]][j].p);
			D=random(l[c[i]][j].p+1,l[c[i]][j+1].p);
			l[c[i]][j].p=D;
			ans[l[c[i]][j].i]=sol(A,B,C,D);
		}
		B=random(l[c[i]][sz-2].p,l[c[i]][sz-1].p);
		D=random(l[c[i]][sz-1].p+1,N-7);
		ans[l[c[i]][sz-1].i]=sol(A,B,C,D);
		c[i]=C;
	}
	for(int i=1;i<=n;++i){
		int A=ans[i].a;
		int B=ans[i].b;
		int C=ans[i].c;
		int D=ans[i].d;
		printf("%d %d %d %d\n",A,B,C,D);
	}
	//--------
	fprintf(stderr,"%0.3lfs",1.0*(clock()-t1)/CLOCKS_PER_SEC);
	return 0;
}

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

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

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

    // 入力する
    vector<long long int> H(N);
    vector<long long int> W(M);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> W[i];
    }

    // vectorをソートする
    sort(H.begin(), H.end());

    vector<long long int> sum1((N + 1) / 2);
    vector<long long int> sum2((N + 1) / 2);
    for (int i = 0; i + 1 < N; i += 2) {
        sum1[i / 2 + 1] = sum1[i / 2] + H[i + 1] - H[i];
    }
    for (int i = N - 2; i > 0; i -= 2) {
        sum2[i / 2] = sum2[i / 2 + 1] + H[i + 1] - H[i];
    }

    long long int res = LLONG_MAX;

    // lower_boundで各W_iの入るindexを調べる
    for (long long int w : W) {
        long long int index = lower_bound(H.begin(), H.end(), w) - H.begin();
        if (index & 1) {
            index ^= 1;
        }
        chmin(res, sum1[index / 2] + sum2[index / 2] + abs(H[index] - w));
    }

    cout << res << endl;
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#define _GLIBCXX_DEBUG
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
using namespace std;
using ll=long long;
const ll INF=50000000000000000;
const ll dx[8]={1,0,-1,0,1,1,-1,-1};
const ll dy[8]={0,1,0,-1,1,-1,1,-1};
ll mod(ll x,ll m){return x & m;}
ll modinv(ll a,ll m){ll b=m,u=1,v=0;while(b){ll t=a/b;a-=t*b;swap(a,b);u-=t*v;swap(u,v);}u%=m;if(u<0){u+=m;}return u;}
ll modpow(ll a,ll n,ll m){ll res=1;while(n>0){if(n&1){res=res*a%m;}a=a*a%m;n>>=1;}return res;}
ll npow(ll a,ll n){ll res=1;while(n>0){if(n&1){res=res*a;}a=a*a;n>>=1;}return res;}
ll yaku(ll x){ll cnt=0;for(int i=1;i*i<=x;i++){if(x%i==0){if(i==x/i){cnt++;}else{cnt+=2;}}}return cnt;}
ll modwaru(ll a, ll b, ll m){a%=m;return a*modinv(b,m)%m;}
ll gcd(ll x, ll y){if(x%y==0){return y;}else{return gcd(y, x % y);}}
struct UnionFind{vector<ll>par;UnionFind(ll N):par(N){for(ll i=0;i<N;i++)par[i]=i;}ll root(ll x){if(par[x]==x){return x;}return par[x]=root(par[x]);}void unite(ll x,ll y){ ll rx=root(x);ll ry=root(y);if(rx==ry){return;}par[rx]=ry;}bool same(ll x,ll y){ll rx=root(x);ll ry=root(y);return rx==ry;}};

int main(){
    ll N, ans = 0;
    cin >> N;
    vector<ll> A(N), rui(N + 1, 0);
    for(int i = 0; i < N; i++) cin >> A[i];
    rui[0] = 0;
    for(int i = 1; i <= N; i++){
        if(i % 2 == 1) rui[i] += rui[i - 1] + A[i - 1];
        else rui[i] += rui[i - 1] - A[i - 1];
    }
    map<ll,ll> cnt;
    for(int i = 0; i <= N; i++){
        cnt[rui[i]]++;
    }
    for(pair<ll,ll> a : cnt){
        ans += a.second * (a.second - 1) / 2;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;

#define REP(i,b,e) for(int i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second

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

int main(){
	ll n;
	scanf("%ld", &n);
	ll a[n];
	REP(i, 0, n) scanf("%ld", &a[i]);

	ll waO[1+n] = {}, waE[1+n] = {};
	REP(i, 0, n){
		if(i%2) waO[i+1] += a[i];
		else waE[i+1] += a[i];
		waO[i+1] += waO[i];
		waE[i+1] += waE[i];
	}

	std::map<ll, ll> mp;
	REP(i, 0, n+1) mp[waO[i] - waE[i]]++;
	ll ans = 0;
	for(auto [k,v]: mp){
		ans += v * (v-1) / 2;
	}
	printf("%ld\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;
const int MAX32 = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  long long n, p, min = 0;
  cin >> n;
  vector<char> num(300000, 0);
  for (int i = 0; i < n; i++) {
    cin >> p;
    num[p] = 1;
    while (num[min]) {
      min++;
    }
    cout << min << endl;
  }
}

#include<bits/stdc++.h>
using namespace std;
const int N=100;
string  a[N];
long long dp[N];
int main(){
    int  n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(a[i]=="AND")
            dp[i]=dp[i-1];
        else
            dp[i]=dp[i-1]+(1LL<<i);
    }
    cout<<dp[n]+1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n;
    cin >> n;
    vector<long long int> vec;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        vec.push_back(a);
    }
    long long first=0;
    for(int i=0; i<vec.size(); i++){
        first+=abs(vec[i]);
    }
    cout << first <<endl;
    double second=0;
    for(int i=0; i<vec.size(); i++){
        second+=pow(vec[i],2);
    }
    cout << setprecision(20)<<sqrt(second) <<endl;
    long long mx=INT32_MIN;
    for(int i=0; i<vec.size(); i++){
        mx = max(mx,abs(vec[i]));
    }
    cout << mx <<endl;
}

/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#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> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/
lli power(lli x, lli y)
{
	lli temp;
	if ( y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp * temp;
}
const lli N = 1000005;
lli prime_arr[N + 1];
vector<lli> pr;

void sieve() {
	for (lli i = 2; i <= N; ++i) {
		if (prime_arr[i] == 0) {
			prime_arr[i] = i;
			pr.push_back (i);
		}
		for (lli j = 0; j < (lli)pr.size() && pr[j] <= prime_arr[i] && i * pr[j] <= N; ++j)
			prime_arr[i * pr[j]] = pr[j];
	}
}

void solve()
{
	lli n, i, j, c = 0, s = 0, f = 0;
	cin >> n;
	lli arr[n], brr[n];
	for (i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	for (i = 0; i < n; i++)
	{
		cin >> brr[i];
	}
	for (i = 1; i <= 1000; i++)
	{
		lli flag = 0;
		for (j = 0; j < n; j++)
		{
			if (arr[j] <= i and brr[j] >= i)
			{
				//cout << arr[j] << " " << i << " " << brr[j] << endl;
				if (brr[j] >= i) {
					flag = 1;
				} else {
					flag = 0;
					break;
				}
			} else {
				flag = 0;
				break;
			}
		}
		if (flag == 1) {
			//cout << i << endl;
			c++;
		}
	}
	cout << c << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	/*lli t;
	cin >> t;
	while (t--)*/
//	sieve();
	solve();
	return 0;
}
/*
1
3 3
5 6 1
3 1 3
3 1 3
*/


#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;
const int MOD = 1e9 + 7;

int main(){
    string s; cin >> s;
    deque<char> t;
    int r = 0;
    for(char c : s){
        if(c == 'R') r = 1 - r;
        else {
            if(r == 0) t.push_back(c);
            else t.push_front(c);
        }
    }
    if(r == 1) reverse(t.begin(),t.end());
    string S;
    for(char c : t) {
        if(S.back() != c) S.push_back(c);
        else S.pop_back();
    }

    cout << S << endl;

    return 0;
}

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

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

  string S;
  cin>>S;
  int N=S.size();

  deque<char> DQ;
  bool rev=false;
  rep(i,N){
    if(S[i]=='R'){
      rev^=true;
    }else{
      if(rev) DQ.push_front(S[i]);
      else DQ.push_back(S[i]);
    }
  }

  string T="";
  while(!DQ.empty()){
    if(rev){
      T+=DQ.back();
      DQ.pop_back();
    }else{
      T+=DQ.front();
      DQ.pop_front();
    }
  }

  string ans="";
  stack<char> st;
  rep(i,T.size()){
    if(st.empty()) st.push(T[i]);
    else{
      if(st.top()==T[i]){
        st.pop();
      }else{
        st.push(T[i]);
      }
    }
  }
  while(!st.empty()){
    ans+=st.top();
    st.pop();
  }
  reverse(all(ans));
  cout<<ans<<endl;

  return 0;
}


#include <bits/stdc++.h>

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

int main () {
	int n;
	cin >> n;
	pair<int, int> ar[n];
	for (int i = 0; i < n; i++) {
		cin >> ar[i].first >> ar[i].second;
	}
	int sol = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ld x = ar[j].first - ar[i].first, y = ar[j].second - ar[i].second;
			ld un = 1;
			if (-un <= y/x && y/x <= un) sol++;
		}
	}
	cout << sol << '\n';
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}

void solve(std::vector<long long> r, std::vector<long long> c){
    auto calc = [&](i64 x0, i64 y0, i64 x1, i64 y1){
        if((x0 + y0 + i64(1e12)) % 2 != (x1 + y1 + i64(1e12)) % 2)
            return MOD;
        i64 cnt = 0;
        cnt += (x0 + y0) != (x1 + y1);
        cnt += (x0 - y0) != (x1 - y1);
        return cnt;
    };
    int ans = (abs(r[0] - r[1]) + abs(c[0] - c[1]) + 2) / 3;
    for(int i = -5; i < 5; ++i){
        for(int j = -5; j < 5; ++j){
            if(abs(i) + abs(j) > 3)
                continue;
            int cnt = (abs(i) + abs(j) == 0 ? 0 : 1);
            i64 nx = r[0] + i;
            i64 ny = c[0] + j;
            ans = min(ans, int(calc(nx, ny, r[1], c[1])) + cnt);
        }
    }
    cout << ans << endl;
}

signed main(){
    std::vector<long long> r(2);
    std::vector<long long> c(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&r[i]);
        scanf("%lld",&c[i]);
    }
    solve(std::move(r), std::move(c));
    return 0;
}


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

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

int to[400001], ne[400001], he[200001];
int pl[200001], dl[200001], Q[400010];

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

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

	int N = getint(), K = getint();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		to[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		to[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	int q = 0, p = 0, kazu = 1, kyori = 0;
	Q[q++] = 1;
	while(kyori < N) {
		while (p < kazu) {
			int u = Q[p++];
			int tmp = 0;
			int ind = he[u];
			he[u] = 0;
			while (ind) {
				int v = to[ind];
				tmp = ne[ind];
				if (he[v] > 0) {
					Q[q++] = v;
					ne[ind] = he[u];
					he[u] = -ind;
				}
				ind = tmp;
			}
		}
		if (p == N) break;
		kazu = q;
		kyori++;
	}

	int are = 1000000, pd0 = are;
	int L = max(0, kyori / K / 2 - 1), R = (N + K - 1) / K;
	while (L + 1 < R) {
		int wj = (L + R) / 2;

		int num = 0;

		for (int i = N - 1; i >= 0; i--) {
			int po = pd0 - 1;
			int dd = pd0;
			int u = Q[i];
			for (int ind = -he[u]; ind; ind = -ne[ind]) {
				int v = to[ind];
				if (po < pl[v]) po = pl[v];
				if (dd < dl[v]) dd = dl[v];
			}
			if (po >= dd) dd = 0;
			if (dd >= pd0 + wj) {
				num++;
				po = pd0 + wj;
				dd = 0;
			}
			pl[u] = po - 1;
			dl[u] = dd + 1;
		}

		int are = num + (dl[1] > pd0);
		if (are > K) L = wj;
		else R = wj;

		pd0 += are;
	}

	printf("%d", R);

	Would you please return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int maxn = 2e5 + 10;
vector<int> edge[maxn];

int n, k, p, tot;
int mx[maxn];

void dfs(int u, int pre)
{
	mx[u] = 0;
	for(int v : edge[u]) if(v != pre)
	{
		dfs(v, u);
		if(mx[u] + mx[v] + 1 > 2 * p)
		{
			tot ++;
			mx[u] = min(mx[u], mx[v] + 1);
		}
		else mx[u] = max(mx[u], mx[v] + 1);
	}
}

bool check()
{
	tot = 0; dfs(1, 0);
	return tot + 1 <= k;
}

int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 1; i < n; i ++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	int l = 1, r = n, res;
	while(l <= r)
	{
		p = l + r >> 1;
		if(check()) r = p - 1, res = p;
		else l = p + 1;
	}
	printf("%d\n", res);
	return 0;
}


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

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

    long long n;
    unordered_set <long long> se;
    cin >> n;

    int x = sqrt(n);
    for (int i = 2;i < x+2;i++)
        for (int j = 2;j < n && pow(i,j) <= n;j++)
            se.insert(pow(i,j));

    // for (long long l : se)
    //     cout << l << endl;

    cout << n - se.size() << endl;

    return 0;
}

//Codeforcesで128bit整数を使いたいとき
//→__int128_tを使う&GNU C++17 (64)で提出する

//インクルードなど
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

//イテレーション
#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--)
#define FORA(i, I) for (const auto &i : I)
//x:コンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF32 2147483647          //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007            //問題による
//略記
#define F first
#define S second
//出力(空白区切りで昇順に)
#define coutALL(x)                                \
    for (auto i = x.begin(); i != --x.end(); i++) \
        cout << *i << " ";                        \
    cout << *--x.end() << endl;

//aをbで割る時の繰上げ,繰り下げ
ll myceil(ll a, ll b) { return (a + (b - 1)) / b; }
ll myfloor(ll a, ll b) { return a / b; }

ll A[17][65536];
int N;

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

    cin >> N;

    int t = static_cast<int>(pow(2,N));
    REP(i,t){
        cin >> A[N][i];
    }
    for(int i= N;i>=1;i--){
        for(int j=1,c=0;j<t;j+=2){
            A[i-1][c++] = max(A[i][j-1],A[i][j]);
        }
        t/=2;
    }

    ll n1=min(A[1][0],A[1][1]);

    int ans = 0;

    t = static_cast<int>(pow(2,N));
    REP(i,t){
        if(A[N][i]==n1){
            ans = i+1;
            break;
        }
    }

    cout << ans << endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>
#include<map>
#include<cassert>

using namespace std;

#define ll long long
#define reps(i, a, b) for(int i = a; i < b; i++)
#define rreps(i, a, b) for(int i = a-1; i >= b; i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define P pair<int, int>
#define vec vector<int>
#define mat vector<vector<int> >

const ll mod = 1000000007;
const ll INF = 1001001001001001001;

int n;
vec a, t;

ll fi(int i, ll num){
    if(i == n){
        return num;
    }
    if(t[i] == 1) {
        return fi(i+1, num + a[i]);
    }else if(t[i] == 2){
        return fi(i+1, max(num, (ll)a[i]));
    }else{
        return fi(i+1, min(num, (ll)a[i]));
    }
}

int main(){
    cin >> n;
    a = vec(n);
    t = vec(n);
    rep(i, n) {
        cin >> a[i] >> t[i];
    }
    int q;
    cin >> q;
    vec x(q);
    rep(i, q) cin >> x[i];
    ll lval = fi(0, -INF);
    ll rval = fi(0, INF);
    if(lval == rval){
        rep(i, q){
            cout << lval << endl;
        }
    }else{
        ll llim, rlim;
        {
            ll l = -INF, r = INF;
            while(l < r - 1){
                ll mid = (l + r) / 2;
                if(fi(0, mid) == lval) l = mid;
                else r = mid;
            }
            llim = l;
        }
        {
            ll l = -INF, r = INF;
            while(l < r - 1){
                ll mid = (l + r) / 2;
                if(fi(0, mid) == rval) r = mid;
                else l = mid;
            }
            rlim = r;
        }
        ll dif = fi(0, llim) - llim;
        rep(i, q){
            ll ans;
            if(x[i] <= llim) ans = lval;
            else if(x[i] >= rlim) ans = rval;
            else ans = (ll)x[i] + dif;
            cout << ans << endl;
        }
    }

}

/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com
	> Blog: https://blog.csdn.net/Pig_cfbsl
	> Created Time: 2020/10/11 14:09:05
 ************************************************************************/
#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define pb push_back
#define pr pair<int,int>
#define fi first
#define se second
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int mod=1e9+7;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int T=read();
while(T--){
	LL n=read(),a=read(),b=read(),d=n-a-b;
	if(n<a+b){ puts("0"); continue; }
	d=(d+1)*(d+2)%mod;
	a=n-a+1; b=n-b+1;
	n=a*b%mod;
	LL ans=2*d*n%mod-d*d%mod;
	cout<<(ans+mod)%mod<<endl;
}
	return 0;
}


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

//UnionFindテンプレ
class UnionFind {
    // まとめる 判定 サイズを知る
    public:
    // Aから見た親の番号を格納する。rootだったら-1*その集合のサイズ。
    vector<int> Parent;

    // 初期化
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }

    // Aのrootを調べる
    int root(int A) {
        if (Parent[A] < 0) return A;  // マイナスならそれはroot
        return Parent[A] = root(Parent[A]);
    }

    // rootの値をプラスに戻して返す(サイズ)
    int size(int A) {
        return -Parent[root(A)];
    }

    // くっつける関数
    bool connect(int A, int B) {
        // AとBのroot同士をくっつける
        A = root(A);  // ここのAは、"rootの場所"の意味
        B = root(B);
        if (A == B) return false;  // 既にくっついている
        if (size(A) < size(B))
        swap(A, B);            // 大きい方にくっつけるために中身交換
        Parent[A] += Parent[B];  // 中身更新
        Parent[B] = A;
        return true;
    }

    //連結か調べる関数
    bool issame(int A, int B) {
        return root(A) == root(B);
    }
};

//chmin,chmax関数(DP用)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//aのZ/mZでの逆元
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//最大公約数
int64_t gcd(int64_t a, int64_t b) {
    if (a % b == 0) {
        return b;
    }
    return gcd(b, a%b);
}

//エラストテレスのふるい
vector<bool> make_is_prime(int N) {
    vector<bool> prime(N + 1, true);
    if (N >= 0) prime[0] = false;
    if (N >= 1) prime[1] = false;
    for (int i = 2; i * i <= N; i++) {
        if (!prime[i]) continue;
        for (int j = i * i; j <= N; j += i) {
            prime[j] = false;
        }
    }
    return prime;
}

const int64_t mod = 998244353;
//累乗a^b
int64_t pow(int64_t a, int64_t b) {
    int64_t ans = (int64_t)1;
    for (int64_t i = 0; i < b; i++) {
        ans *= a;
        ans %= mod;
    }
    return ans;
}

//ここから

int64_t pow2(int64_t a, int64_t b) {
    a%=mod;
    if (a == 0) return 0;
    else if (b == 0) return 1;
    else if (b % 2 == 0) {
        int64_t a1 = a*a; a%=mod;
        return pow2(a1,b/2);
    } else {
        int64_t a1 = a*a; a%=mod;
        return (a*pow2(a1,(b-1)/2))%mod;
    }
}

int main() {
    int64_t N,M,K; cin>>N>>M>>K;
    if (N == 1) {
        cout << pow2(K,M) << endl;
        return 0;
    }
    if (M == 1) {
        cout << pow2(K,N) << endl;
        return 0;
    }
    vector<int64_t> Ntimes(K+1);
    vector<int64_t> Mtimes(K+1);
    for (int64_t i = 0; i < K+1; i++) {
        Ntimes.at(i) = pow2(i,N);
        Mtimes.at(i) = pow2(i,M);
    }
    int64_t ans = 0;

    for (int64_t i = 0; i < K; i++) {
        int64_t pl = Ntimes.at(i+1)-Ntimes.at(i); pl%=mod;
        pl *= Mtimes.at(K-i); pl%mod;
        ans += pl; ans%=mod;
    }

    //int64_t x = pow(pow((int64_t)2,(int64_t)10),(int64_t)10);
    //cout << x << endl;

    if (ans < 0) ans += mod;
    cout << ans << endl;
}

#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
#define pii pair<int,int>
#define vint vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define red(i,a,b) for(int i=(a);i>=(b);i--)
#define Help freopen("a.cpp","r",stdin)
#define db double
#define ld long db
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
int read(){
	int g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const int mod=998244353;
int n,m,k;
int ksm(int x,int y){
	int re=1;
	for(;y;y>>=1,x=1ll*x*x%mod)if(y&1)re=1ll*re*x%mod;
	return re;
}
signed main(){
	//Freopen();
#ifndef ONLINE_JUDGE
	Help;
#endif
	n=read(),m=read(),k=read();
	if(n==1||m==1){
		int ans=0;
		rep(i,1,k)ans=(ans+1ll*(ksm(i,n)+mod-ksm(i-1,n))%mod*(ksm(k-i+1,m)-ksm(k-i,m)+mod)%mod)%mod;
		cout<<(ans%mod+mod)%mod;
		return signed();
	}
	int ans=0;
	rep(i,1,k)ans=(ans+1ll*(ksm(i,n)+mod-ksm(i-1,n))%mod*ksm(k-i+1,m)%mod)%mod;
	cout<<(ans%mod+mod)%mod;
	return signed();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007 //998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
int main(){
    ll a, b, w; cin >> a >> b >> w; w*=1000;
    ll ma = -1; ll mi = INF;
    FOR(i,1,1000100) {
        if (a*i<=w && b*i>=w) {
            ma = max(ma,i); mi = min(mi,i);
        }
    }
    if (ma==-1 || mi==INF) cout << "UNSATISFIABLE" << endl;
    else cout << mi << " " << ma << endl;
}

#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>

using namespace std;

void solve()
{
	int a, b, w;
	cin >> a >> b >> w;
	w *= 1000;

	int c = w / b;
	int d = w / a;
	int e = w - d * a;
	if (e > (b - a) * d)
		cout << "UNSATISFIABLE";
	else
		cout << c + (c * b != w) << " " << d;
}

int main()
{
	ios_base::sync_with_stdio(0);
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
}


#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for (int i = (a); i < (int)(n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
using ll = long long;

int main() {
    int A,B,C; cin >> A >> B >> C;

    bool c = (C%2 == 0 ? true : false);
    string ans;
    if( A == B ) ans = "=";
    else if( abs(A) == abs(B) && c) ans = "=" ;

    else if( A > B ) {
        if(abs(A) < abs(B) && c) ans = "<";
        else ans = ">";
    }
    else if( A < B ) {
        if(abs(A) > abs(B) && c) ans = ">";
        else ans = "<";
    }

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

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <sstream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define debug(s, param) std::cerr << s << param << std::endl;

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

// 参考にするコード
// https://atcoder.jp/contests/abc199/submissions/22050932

const int INF = 1e9;
const ll INFL = 1e18;
const ll MOD = 1000000007;

int main() {
  int n, m; cin >> n >> m;
  vector<vector<pi>> constraints(n+1);
  rep (i, m) {
    int x, y, z; cin >> x >> y >> z;
    constraints[x].emplace_back(pi(y, z));
  }

  vector<int> popCount(1 << n);
  rep (i, 1 << n) popCount[i] = bitset<18>(i).count();
  vector<ll> dp(1 << n, 0);
  dp[0] = 1;
  rep (S, 1 << n) {
    bool ok = true;
    for (auto [y, z] : constraints[popCount[S]]) {
      int mask = (1 << y) - 1;
      if (popCount[S & mask] > z) {
        ok = false;
        break;
      }
    }
    if (!ok) dp[S] = 0;
    rep (i, n) {
      if (S >> i & 1) continue;
      dp[S | 1 << i] += dp[S];
    }
  }

  cout << dp[(1 << n) - 1] << endl;

  return 0;
}


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

#define INF 1234567890
#define ll long long

int N, M, sy, sx, sd, res = 0;
string s[11];
int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int block[4][2] = {{-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
bool vis[11][11][4];

void f(int y, int x, int d)
{
	if (vis[y][x][d]) return;
	vis[y][x][d] = true;

	int ny = y + dir[d][0], nx = x + dir[d][1];
	int by = y + block[d][0], bx = x + block[d][1];
	if (s[by][bx] == '#')
	{
		res++;
		f(by, bx, (d+3)%4);
	}
	else if (s[ny][nx] == '.')
	{
		res++;
		f(y, x, (d+1)%4);
	}
	else
		f(ny, nx, d);
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N >> M;
	for(int i=0; i<N; i++)
		cin >> s[i];
	for(int i=0; i<N; i++)
		for(int j=0; j<M; j++)
			if (s[i][j] == '#')
			{
				f(i, j, 0);
				goto END;
			}
	assert(0);
	END:
	cout << res;
	return 0;
}


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

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

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll s, p;
    cin, s, p;
    for (ll i = 1; i * i <= p; i++) {
        if (p % i == 0) {
            ll n = i, m = p / i;
            if (n + m == s) {
                print("Yes");
                return 0;
            }
        }
    }
    print("No");
    return 0;
}

/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     vi          vector<int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

void solve(){
    ll n;
    cin>>n;
    int cnt=0;
    while(n%2==0) n/=2,cnt++;
    if(!cnt) cout<<"Odd\n";
    else if(cnt==1) cout<<"Same\n";
    else cout<<"Even\n";
}

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


#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using Matrix = vector<vector<int>>;

const ll INF = LLONG_MAX;
const ld EPS = 1e-14;
const ll MOD = 1e9+7;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

template<class T> void chmax(T& a, T b) { if (a < b) a = b; }
template<class T> void chmin(T& a, T b) { if (a > b) a = b; }
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() {
    int n, k;
    cin >> n >> k;
    Matrix a(n, vector<int>(n));
    rep(i,0,n) rep(j,0,n) cin >> a[i][j];
    int L = k*k/2+1;

    int wa = -1, ac = 1001001001;
    while(wa+1 < ac) {
        int wj = (wa+ac) / 2;
        bool ok = false;
        Matrix s(n+1, vector<int>(n+1));
        rep(i,0,n) rep(j,0,n) s[i+1][j+1] = a[i][j] > wj ? 1 : 0;
        rep(i,0,n+1) rep(j,0,n) s[i][j+1] += s[i][j];
        rep(i,0,n) rep(j,0,n+1) s[i+1][j] += s[i][j];
        rep(i,0,n-k+1) rep(j,0,n-k+1) {
            int now = s[i+k][j+k];
            now -= s[i][j+k];
            now -= s[i+k][j];
            now += s[i][j];
            if (now < L) ok = true;
        }
        if (ok) ac = wj;
        else wa = wj;
    }
    cout << ac << endl;
    return 0;
}

#include "bits/stdc++.h"
using namespace std;
// #define int long long
constexpr int N = 801;
int f[N][N];
int n, k;
int bound;
int a[N][N];
int get(int x1, int y1, int x2, int y2) {
  return f[x2][y2] - f[x1 - 1][y2] - f[x2][y1 - 1] + f[x1 - 1][y1 - 1];
}
bool check(int t) {
  for (int i = 1; i <= n; i ++) {
    for (int j = 1; j <= n; j ++) {
      f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + (a[i][j] <= t);
      // cout << f[i][j] << " ";
    }
    // cout << endl;
  }
  // cerr << get(2, 2, 3, 3);
  for (int i = 1; i + k - 1 <= n; i ++)
    for (int j = 1; j + k - 1 <= n; j ++) {
      if (get(i, j, i + k - 1, j + k - 1) >= bound)
        return true;
    }
  return false;
}
void solution() {
  cin >> n >> k;
  for (int i = 1; i <= n; i ++)
    for (int j = 1; j <= n; j ++)
      cin >> a[i][j];
  bound = ((k * k + 1) / 2);
  // cerr << bound << endl;
  int l = 0, r = 1000000000, ans;
  while (l <= r) {
    int m = (l + r) >> 1;
    // cout << l << ' ' << r << ' ' << m << endl;
    if (check(m)) ans = m, r = m - 1;
    else l = m + 1;
  }
  // check(0);
  // for (int i = 0; i <= 10; i ++) cout << check(i) << endl;
  // assert(check(ans));
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0); cin.tie(0); int tc = 1;
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif
  // cin >> tc;
  while (tc --) { solution(); cout << "\n"; }
}


#include <bits/stdc++.h>

using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define drep(i,j) for(int (i)=(j);(i) >= 0;(i)--)

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
 cout << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
cout << first << " " ;
OUT(rest...);
   return;
}
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = int(1e9);
const long long int INFL = LLONG_MAX;

int n,m,k;
string S;
int ans;

vll A;

ll f(ll mod,ll n,ll x)
{
  ll dp[n+1][mod+1][mod];//
  memset(dp,-1,sizeof(dp));
  dp[0][0][0] = 0;
  rep(i,n)
  {
    rep(j,mod+1)
    {
      rep(k,mod)
      {
        if(dp[i][j][k] < 0)continue;
        chmax(dp[i+1][j][k],dp[i][j][k]);
        if(j<mod)chmax(dp[i+1][j+1][(k+A[i])%mod],dp[i][j][k] + A[i]);
      }
    }
  }
  x = x%mod;
  return dp[n][mod][x];
}

void solve()
{
  ll N;
  ll X;
  IN(N,X);
  A.resize(N);
  rep(i,N)IN(A[i]);
  ll ans = INFL;
  for(ll i=1;i<=N;i++)
  {
    ll tmp = f(i,N,X);
    //OUT(tmp);
    if(tmp>0)chmin(ans,(X - tmp)/i);
  }
  cout << ans << endl;
}

signed main (int argc, char* argv[])
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   int cases=1;
   //IN(cases);
   while(cases--)solve();
   //pri(ans);
   //for(auto c : ans){cout << c << endl;}
   //cout << fixed << setprecision(15) << ans << endl;
   return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

// ll sum() { return 0; }
// template<typename T, typename... Args>
// T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl

void solve() {
    ll n, x;
	cin >> n >> x;
	vl A(n);
	READ(A);
	ll ans = INFF;
    for(ll k = 1; k <= n; k++) {
        vvl dp(k + 1, vl(k, -INFF));
        dp[0][0] = 0;
        for(ll a : A) {
            for(ll i = k; i--;) {
                for(ll j = 0; j < k; j++) {
                    if(dp[i][j] != -INFF) {
                        ll x = a + dp[i][j];
                        dp[i + 1][x % k] = max<ll>(dp[i + 1][x % k], x);
                    }
                }
            }
        }
        if(dp[k][x % k] != -INFF) {
            ans = min<ll>(ans, (x - dp[k][x % k]) / k);
        }
    }
	OUT(ans);
}

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

    // int tc; cin >> tc;
    // TC(tc) solve();
    solve();
    return 0;
}


#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
//#include<boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int mulint;

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}
template < typename T, typename U >
ostream &operator<<(ostream &os, const pair< T, U > &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template < typename T, typename U >
istream &operator>>(istream &is, pair< T, U > &p) {
	is >> p.first >> p.second;
	return is;
}
template < typename T >
istream &operator>>(istream &is, vector< T > &A) {
	rep(i, A.size()) is >> A[i];
	return is;
}
template < typename... Args >
auto print(Args const &... args) {
	for (auto const &e : {args...})
		cerr << e << " ";
	cerr << endl;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c, i;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0, int _i = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
		i = _i;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

template < typename A, std::size_t N, typename T >
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
//expicit argument required with multi-precision
template < typename T >
vector< int > itod(T n) {
	vector< int > ret;
	while (n > 0) {
		ret.push_back((int)(n % 10));
		n /= 10;
	}
	return ret;
}
template < typename T >
T dtoi(const vector< int > &d) {
	T ret = 0;
	for (int i = d.size() - 1; i >= 0; i--) {
		ret *= 10;
		ret += d[i];
	}
	return ret;
}
struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
		ios::sync_with_stdio(false);
		std::cin.tie(nullptr);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	string S;
	cin >> S;
	string T;
	rep(i, N) {
		T.push_back(S[i]);
		while (T.size() >= 3 && T[T.size() - 3] == 'f' && T[T.size() - 2] == 'o' && T[T.size() - 1] == 'x') {
			rep(_, 3) T.pop_back();
		}
	}
	cout << T.size() << endl;
	return 0;
}

//@Author: KeinYukiyoshi

// clang-format off
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#define int long long
using namespace std;
#define stoi stoll
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define _max(x) *max_element(ALL(x))
#define _min(x) *min_element(ALL(x))
#define _sum(x) accumulate(ALL(x), 0LL)

const int MOD   = 1000000007;
// const int MOD    = 998244353;
// const int INF    = (int)1e18;
// const int INF    = 10000000000007; // 1e13 + 7
// const int INF    = LLONG_MAX; // 9.2e18
const double EPS = 1e-8;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b) {int res = 1;for (a %= MOD; b; a = a * a % MOD, b >>= 1)if (b & 1) res = res * a % MOD;return res;}
struct mint {long long x;mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) { (x *= a.x) %= MOD;return *this; }mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long t) const {if (!t) return 1;mint a = pow(t >> 1);a *= a;if (t & 1) a *= *this;return a;}mint inv() const { return pow(MOD - 2); }mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }};istream &operator>>(istream &is, mint &a) { return is >> a.x; }ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }
// clang-format on

class AGodSequence {
public:
  static void solve(istream &cin, ostream &cout) {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int A, B;
    cin >> A >> B;
    V<int> E(A + B);
    if (A >= B){
      rep(i, A) E[i]         = i + 1;
      rep(i, B - 1) E[i + A] = -(i + 1);
      int sum                = _sum(E);
      E[A + B - 1]           = -sum;
    }else{
      rep(i, B) E[i]         = -(i + 1);
      rep(i, A - 1) E[i + B] = (i + 1);
      int sum                = _sum(E);
      E[A + B - 1]           = -sum;
    }

    FOR(i, E)
    cout << i << " ";
    cout << endl;
  }
};

signed main() {
  AGodSequence solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=998244353;
const ll inf=INF*INF;
const ll mod=MOD;
const ll MAX=20000010;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    vector<ll>a(n),t(n);
    rep(i,n)cin>>a[i]>>t[i];
    ll su=inf,ma=inf;
    ll de=-inf,mi=-inf;
    ll now=0;
    rep(i,n){
        if(t[i]==1){
            now+=a[i];
            ma+=a[i];
            mi+=a[i];
        }
        if(t[i]==2){
            if(mi>a[i])continue;
            if(ma<=a[i]){
                de=inf;
                su=-inf;
                ma=a[i],mi=a[i];
                continue;
            }
            de=a[i]-now;
            mi=a[i];
        }
        if(t[i]==3){
            if(ma<a[i])continue;
            if(mi>=a[i]){
                de=inf;
                su=-inf;
                ma=a[i],mi=a[i];
                continue;
            }
            su=a[i]-now;
            ma=a[i];
        }
        //cout<<de<<' '<<su<<' '<<mi<<' '<<ma<<endl;
    }
    ll q;cin>>q;
    rep(i,q){
        ll x;cin>>x;
        if(su<=de){
            cout<<ma<<endl;
        }else{
            if(x>=su){
                cout<<ma<<endl;
            }else if(x<=de){
                cout<<mi<<endl;
            }else{
                cout<<x+now<<endl;
            }
        }
    }
}

#include <bits/stdc++.h>
#include <fstream>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(3)<<(x)
#define all(v) (v).begin(), ( v).end()
using namespace  std;
#define forn(i, b) for (int i=0; i<b; ++i)
using ll = long long;
const int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int , int> pairs;
typedef complex<ll> G;
const int INF = 1e9 + 1 ;
const int N = 1e5 + 2;
using TP = tuple<int, int, int>;

int power(ll a,ll b){
    if(!b)
        return 1;
    int c=power(a,b/2);
    c=(1LL*c*c)%mod;
    if(b%2)
        c=(1LL*c*a)%mod;
    return c;
}
ll mul(ll A, ll B) {
	return (A*B)%mod;
}
struct Fenwick {

    vector<ll>ss;
    int n;
    void init(int n) {
        this->n = n;
        ss.resize(n + 1);
        for(int i = 0;i <= n;++i) {
            ss[i] = 0;
        }
    }
    ll get_val(int pos) {
        return ss[pos];
    }
    void add(int pos, ll x) {
        while(pos <= n) {
            ss[pos] += x;
            pos += (pos & -pos);
        }
    }
    void range_add(int l, int r, int val) {
        add(l, (ll)val);
        add(r + 1, -val);
    }
    ll sum(int pos) {
        ll ans = 0;
        while(pos >= 1) {
            ans += ss[pos];
            pos -= (pos & -pos);
        }
        return ans;
    }
    int point_query(int idx) {
    int ret = 0;
    for (idx; idx > 0; idx -= idx & -idx)
        ret += ss[idx];
    return ret;
    }
};

void done() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    for(int i = 0;i < 1 << n;++i) {
        int p = 0;
        int tot = 0;
        for(int ad  = 0; ad  < n;++ad) {
            if(i >> ad & 1) {
                ++p;
                tot += s[ad] - '0';
            }
        }
        if(tot % 3 == 0)ans = max(ans, p);
    }
    cout << (ans == 0 ? -1 : n - ans) << '\n';
}

struct Edge {
    int u, v, weight;
    bool operator<(Edge const &other) {
        return weight < other.weight;
    }
};

void solve()
{

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

}

void another() {

    ll n;
    cin >> n;
    int sz = to_string(n).size();
    int tot = 0;
    map<int, int>m;
    while(n) {
        m[(n%10)%3]++;
        tot += n % 10;
        n /= 10;
    }
    if(tot % 3 == 0) {
        cout << 0 << '\n';
        return;

    }
    int rem = tot % 3;
    if(sz == 1) {
        cout << -1 << '\n';
        return;
    }
    if(m[rem]) {
        cout << 1 << '\n';
        return;
    }
    if(rem == 2 && m[1] >= 2 && sz > 2) {
        cout << 2 << '\n';
        return;
    }
    cout << -1 << '\n';

}
void test_case() {
    int t;
    cin >> t;
    while(t--)another();
}
int main() {

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

    done();

}


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

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

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

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

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

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

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

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

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

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

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

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

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

void debug_out() { cerr << endl; }

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

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

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

const ll mod = 1e9+7;
ll mul(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
ll sum(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
ll sub(ll a,ll b){return ((a%mod)-(b%mod))%mod;}
ll power(ll a,ll b){
	ll res = 1;
	while(b){
		if(b&1)res = mul(res,a);
		b >>= 1;
		a = mul(a,a);
	}
	return res;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N; cin >> N;
	vector<ll> A(N),sum(N),maxi(N);
	forn(i,0,N)cin >> A[i];
	forn(i,0,N){
		sum[i] = A[i];
		if(i)sum[i] += sum[i-1];
		maxi[i] = sum[i];
		if(i)maxi[i] = max(maxi[i],maxi[i-1]);
	}
	debug(sum);
	debug(maxi);
	ll res = 0;
	ll pos = 0;
	forn(i,0,N){
		res = max(res,pos+maxi[i]);
		debug(i,pos,sum[i],maxi[i]);
		pos += sum[i];
	}
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 ll i,ans,n;
 cin >> n;
 ll a[n],b[n];
 for(i=0;i<n;i++)
 {
  cin >> a[i];
  b[i]=a[i];
 }
 for(i=1;i<n;i++)
 {
  a[i]+=a[i-1];
  b[i]+=b[i-1];
 }
 for(i=1;i<n;i++)
 {
  a[i]=max(a[i],a[i-1]);
  b[i]+=b[i-1];
 }
 ans=0;
 ans=max(ans,a[0]);
 ans=max(ans,b[n-1]);
 for(i=0;i<(n-1);i++)
 ans=max(ans,b[i]+a[i+1]);
 cout << ans;
 return 0;
}


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

map<int, int> mp;
vector<int> A;
int b, c;

int main(){
  int N;
  cin >> N;
  A = vector<int>(N);
  rep(i,N){
    cin >> A[i];
  }
  int N2 = 1 << min(N, 8);
  ll sum = 0;
  rep(s, N2) {
    sum = 0;
    rep(i, min(N,8)) if (s >> i & 1) {
      sum += A[i];
    }
    if (mp[sum%200]) {
      b = mp[sum%200];
      c = s;
      break;
    } else {
      mp[sum%200] = s;
    }
  }
  if (b == 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    int x = pcnt(b);
    int y = pcnt(c);
    cout << x << " ";
    rep(i, min(N,8)) if (b >> i & 1) {
      cout << i+1 << " ";
    }
    cout << endl;
    cout << y << " ";
    rep(i, min(N,8)) if (c >> i & 1) {
      cout << i+1 << " ";
    }
  }
  return 0;
}

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define popcount(v) __builtin_popcount(v)
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=(ll)1<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

int main(){
    INT(n);
    vector<ll> a(n);
    in(a);
    vector<vector<int>> dp(200);
    int to;
    for(int i=0;i<n;i++){
        for(int j=0;j<200;j++){
            if(dp[j].size()==0)continue;
            if(dp[j][dp[j].size()-1]==i+1)continue;
            to=(j+a[i])%200;
            if(dp[j].size()>=1){
               	if(dp[to].size()>=1){
                  out("Yes");
                  out(dp[(j+a[i])%200].size(),dp[(j+a[i])%200]);
                  out(dp[j].size()+1,dp[j],i+1);
                  return 0;
                }else{
                  dp[to]=dp[j];
                  dp[to].push_back(i+1);
                }
            }
        }
        if(dp[a[i]%200].size()>=1){
            out("Yes");
            out(dp[a[i]%200].size(),dp[a[i]%200]);
            out(1,i+1);
            return 0;
        }else{
        	dp[a[i]%200].push_back(i+1);
        }
    }
    out("No");
}


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

int n,m;
int edge[1001][1001];
bool visited[1001][1001];
vector<int> vc[1001][26];

struct PT{
    int st,ed;
    int size;
};

int main(){
    int x,y,sz;
    char c;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x>>y>>c;
        edge[x][y]=edge[y][x]=1;
        vc[x][c-'a'].push_back(y);
        vc[y][c-'a'].push_back(x);
    }
    bool flag=false;
    queue<PT> q;
    PT temp,in;
    temp.st=1; temp.ed=n; temp.size=0;
    visited[temp.st][temp.ed]=true;
    q.push(temp);
  	int ans=1e9;
    while(!q.empty()){
        temp=q.front();
		q.pop();
		x=temp.st; y=temp.ed; sz=temp.size;
        if(edge[x][y]>0||x==y){
            if(x==y) ans=min(ans,sz);
            else ans=min(ans,sz+1);
        }
        for(int t=0;t<26;t++){
            for(auto i:vc[x][t]){
                for(auto j:vc[y][t]){
                    if(visited[i][j]) continue;
                    visited[i][j]=true;
                    temp.st=i; temp.ed=j; temp.size=sz+2;
                    q.push(temp);
                }
            }
        }
    }
    if(ans==1e9) cout<<"-1\n";
    else cout<<ans<<'\n';
}

#include <bits/stdc++.h>
using namespace std;
#define la1ee ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
	la1ee
	int n; cin>>n;
	bool f = false;
	long long int a[n]{}, b[n]{}, c[n]{};
	for(int i=0; i<n; ++i)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	long long int ans = 1e11;
	//cout<<ans;
	for (int i = 0; i < n; ++i)
	{
		if( (c[i] - a[i]) > 0 )
		{
			ans = min(ans,b[i]);
			f = true;
		}
	}
	if(f) cout<<ans;
	else cout<<"-1";
	return 0;
}


#include              <bits/stdc++.h>
#define ll            long long int
#define w(t)          int t; cin>>t; while(t--)
#define F             first
#define S             second
#define pb            push_back
#define mp            make_pair
#define pii           pair<int,int>
#define mii           map<int,int>
#define sp(x,y)       fixed<<setprecision(y)<<x
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int m,h;
    cin>>m>>h;
    if(h%m==0)cout<<"Yes";
    else cout<<"No";
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int M,H;

    cin>>M>>H;

    if(H%M==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=101000;
#define x first
#define y second
struct node{
	int val;
	string ch;
}arr[13456];
bool cmp(node a,node b)
{
	return a.val>b.val;
}
long long dp[105][105];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>arr[i].ch>>arr[i].val;
	sort(arr+1,arr+1+n,cmp);
	cout<<arr[2].ch<<endl;
}

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

int main() {
  int x;
  cin>>x;
  int ans = 100-x%100;

  cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define trace(...) debug(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void debug(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void debug(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " | ";
  debug(comma + 1, args...);
}
#define mp(x,y) make_pair(x,y)
const int INF=1000000000+5;
const int N=2e5+5;
const int M=3e5+5;
const ll oo=1e18+5;
const ll mod=998244353;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	vector<string> ans;
	cin>>n;
	ans.push_back("AB");
	for(int i=1;i<n;++i){
		vector<string> tmp;
		for(string s:ans){
			tmp.push_back(s+s);
			string newS=s;
			for(char ch:s){
				if(ch=='A') newS+='B';
				else newS+='A';
			}
			tmp.push_back(newS);
		}
		string def;
		for(int j=0;j<(1<<i);++j) def+='A';
		for(int j=0;j<(1<<i);++j) def+='B';
		tmp.push_back(def);
		ans=tmp;
	}
	cout<<(int)ans.size()<<endl;
	for(string x:ans) cout<<x<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define each(e, v) for(auto &e: v)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct io_setup{
    io_setup(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout << fixed << setprecision(15);
    }
} io_setup;

int main(){
    int N;
    cin >> N;

    if(N == 1){
        cout << "1\n";
        cout << "AB\n";
        return 0;
    }

    vector<vector<int>> now(1, vector<int>(1, 1));
    rep(i, N){
        int n = sz(now);
        vector<vector<int>> tmp(2*n, vector<int>(2*n));
        rep(i, n){
            rep(j, n){
                tmp[i][j] = now[i][j];
                tmp[n+i][j] = now[i][j];
                tmp[i][n+j] = now[i][j];
                tmp[n+i][n+j] = -now[i][j];
            }
        }
        swap(now, tmp);
    }

    cout << (1<<N)-1 << '\n';
    rep2(i, 1, sz(now)-1){
        each(e, now[i]){
            cout << (e == 1? 'A' : 'B');
        }
        cout << '\n';
    }
}