//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

const long long M=1000000007;
//typedef long T;
//#include "math/mod.h"

//#include "math/modulo.h"

template<class T, long long M>
struct modulo {
	T n;
	T gcd_ext(T a, T b, T *x, T *y) {
		if (a == 0) {
			*x = 0;
			*y = 1;
			return b;
		}
		T x1, y1;
		T gcd = gcd_ext(b%a, a, &x1, &y1);
		*x = y1 - (b/a) * x1;
		*y = x1;
		return gcd;
	}
	modulo(T n): n(n<0? n%M+M: n%M) {}
	operator T() const { return n; }
	modulo operator-() {
		return modulo(-n);
	}
	modulo operator+(const modulo &o) {
		return modulo(n+o.n);
	}
	modulo operator-(const modulo &o) {
		return modulo(n-o.n);
	}
	modulo operator*(const modulo &o) {
		return modulo(n*o.n);
	}
	modulo operator/(const modulo &o) {
		T x, y;
		T g = gcd_ext(o.n, M, &x, &y);
		if (g != 1) return 0;
		else return modulo(n * (x % M));
	}
	bool operator<(const modulo &o) const {
		return n<o.n;
	}
	bool operator<=(const modulo &o) const {
		return n<=o.n;
	}
	bool operator>(const modulo &o) const {
		return n>o.n;
	}
	bool operator>=(const modulo &o) const {
		return n>=o.n;
	}
	bool operator==(const modulo &o) const {
		return n==o.n;
	}
	bool operator!=(const modulo &o) const {
		return n!=o.n;
	}
};

typedef modulo<long long, M> T;
//#include "math/comb.h"

void comb_inc_k(T &r, int n, int &k) {
        //C(n,k+1) = C(n,k) * (n-k) / (k+1)
	r = r * T(n-k) / T(k+1);
	k++;
}

void comb_dec_k(T &r, int n, int &k) {
        //C(n,k-1) = C(n,k) * k / (n-k+1)
	r = r * T(k) / T(n-k+1);
	k--;
}

void comb_inc_n(T &r, int &n, int k) {
        //C(n+1,k) = C(n,k) * (n+1) / (n+1-k)
	r = r * T(n+1) / T(n+1-k);
	n++;
}

void comb_dec_n(T &r, int &n, int k) {
        //C(n-1,k) = C(n,k) * (n-k) / n
	r = r * T(n-k) / T(n);
	n--;
}

T comb(int n, int k) {
    if (k*2 > n) k = n-k;
    if (n==0) return 0;
    T r = 1; //C(n,0)
    for (int i=0; i<k; ) comb_inc_k(r, n, i);
    return r;
}

int h,w,a,b;

int input() {
	if (scanf("%d %d %d %d", &h, &w, &a, &b) < 0) return 0;
	return 1;
}

void init() {
}

int solve() {
	T r = comb(h+w-2, h-1);

	int xn = h-a+b-1, xk = b-1;
	T x = comb(xn, xk);

	int yn = a-1+w-b-1, yk = w-b-1;
	T y = comb(yn, yk);

	for (int i=0; i<a; i++) {
		//T x = mod_combinations(h-a+i+b-1, b-1, M);
		//T y = mod_combinations(a-1-i+w-b-1, w-b-1, M);
		if (i) {
			comb_inc_n(x, xn, xk);
			comb_dec_n(y, yn, yk);
		}
		r = r-x*y;
	}
	/*
	T r = mod_combinations(h+w-2, h-1, M);
	T x = mod_combinations(h-a+b-1, b-1, M);
	T y = mod_combinations(a-1+w-b-1, w-b-1, M);
	for (int i=0; i<a; i++) {
		//T x = mod_combinations(h-a+i+b-1, b-1, M);
		//T y = mod_combinations(a-1-i+w-b-1, w-b-1, M);
		if (i) {
			T n = h-a+i+b-1, m = b-1;
			x = mod_div(x*n, n-m, M);

			n = a-1-i+w-b-1, m = w-b-1;
			y = mod_div(y*(n+1-m), n+1, M);
		}
		T z = mod_mul(x, y, M);
		//printf("%d: r=%ld %ld %ld %ld\n", i, r, x, y, z);
		r = mod_sub(r, z, M);

	}
	*/
	return r;
}

void output(int ans) {
	printf("%d\n", ans);
}

void cleanup() {
}

int main() {
	//precalc();
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}

///FUCKOUT
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using ll = long long;
using db = long double;
using row = vector<int>;
using ii = pair<ll, ll>;

#define int ll

const int N = 2e5+5, M = 1e6 + 5, LG = 17, MOD = 1e6 + 3;
const int BLOCK = 55;
const int BLOCKN = N / BLOCK + 1;
const long double EPS = 1e-7;
using ull = unsigned long long;
ll t[N<<2];
ll tA[N<<2], tB[N<<2];
void upd(int node, int s, int e, int idx, ll v){
  t[node] = min(t[node], v);
  tA[node] = min(tA[node], v + idx);
  tB[node] = min(tB[node], v - idx);
  if(s==e)return;
  int md = (s+e)>>1;
  if(idx<=md)
    upd(node<<1,s,md,idx,v);
  else
    upd(node<<1|1,md+1,e,idx,v);
}
ll qry(int node, int s, int e, int idx){
  if(e < idx)return idx + tB[node];
  if(s > idx)return tA[node] - idx;
  if(s==e)return t[node];
  int md = (s+e)>>1;
  return min(qry(node<<1,s,md,idx),qry(node<<1|1,md+1,e,idx));
}
int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#endif // ONLINE_JUDGE
  memset(t,63, sizeof t);
  memset(tA,63, sizeof tA);
  memset(tB,63, sizeof tB);
  int n, q, A, B;
  cin >> n >> q >> A >> B;

  upd(1, 1, n, A, 0);

  int prv = B;
  ll ans = 0;
  while(q--){
    int x;
    cin >> x;
    ll val = qry(1, 1, n, x) + ans;
    ans += abs(x - prv);
    upd(1, 1, n, prv, val - ans);
    prv = x;
  }

  cout << ans+t[1]<<'\n';
  return 0;
}


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

int A[100000], n;

int Partition(int p, int r){
	int x = A[r - 1], j = 0;
	//printf("%d ", A[r - 1]);
	for(int i = 0;i < n;i++){
		if(A[i] <= x){
			int tmp = A[j];
			A[j++] = A[i];
			A[i] = tmp;
		}
	}
	return j - 1;
}

main(){
    scanf("%d", &n);
    for(int i = 0;i < n;i++)scanf("%d", &A[i]);
	int j = Partition(0, n);
	for(int i = 0;i < n - 1;i++){
		if(i)printf(" ");
		if(i == j)printf("[");
		printf("%d", A[i]);
		if(i == j)printf("]");
	}
	printf(" %d\n", A[n - 1]);
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define NILL 2000000010
using namespace std;
struct node{
  node *p, *l,*r;
  int key;
};
node *root;

node * mk_node(int key,node *l,node *r,node *p){
  node *n=(node *)malloc(sizeof(node));
  n->key=key;
  n->r=r;
  n->l=l;
  n->p=p;
  return n;
}

void insert(node *z){
  node *y=mk_node(NILL,NULL,NULL,NULL);
  node *x=root;
  while(x!=NULL){
    y=x;
    if((z->key)<(x->key)) x=x->l;
    else x=x->r;
  }
  z->p = y;
  if(y->key==NILL)root = z;
  else if(z->key < y->key) y->l=z;
  else y->r=z;
}

void print(node *pos, int flg){
  if(flg)cout <<" "<<pos->key;
  if(pos->l!=NULL)print(pos->l,flg);
  if(!flg)cout <<" "<<pos->key;
  if(pos->r!=NULL)print(pos->r,flg);
}

node * find(node *pos,int key){
  if(pos==NULL)return pos;
  if(pos->key>key) return find(pos->l,key);
  if(pos->key<key) return find(pos->r,key);
  return pos;
}

node *treeMinimum(node *x){
  while(x->l!=NULL) x=x->l;
  return x;
}

node * treeSuccessor(node *x){
  if(x->r!=NULL) return treeMinimum(x->r);

  node *y=x->p;
  while(y!=NULL&&x==y->r)x=y,y=y->p;
  return y;
}

void del(node *z){
  node *y;
  if(z->l==NULL||z->r==NULL) y = z;
  else y=treeSuccessor(z);

  node *x;
  if(y->l!=NULL) x=y->l;
  else x=y->r;

  if(x!=NULL) x->p=y->p;
  if(y->p==NULL) root=x;
  else if (y==y->p->l) y->p->l=x;
  else y->p->r=x;
  if( y!=z) z->key=y->key;
}

char str[1000];
int main(){
  root=mk_node(NILL,NULL,NULL,NULL);
  int n;
  cin>>n;

  while(n--){
    node *x=mk_node(NILL,NULL,NULL,NULL);
    int a;
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&x->key);
      insert(x);
    }
    else if(str[0]=='p'){
      print(root,0);cout <<endl;
      print(root,1);cout <<endl;
    }
    else if(str[0]=='f'){
      cin>>a;
      cout <<(find(root,a)!=NULL? "yes":"no")<<endl;
    }
    else if(str[0]=='d'){
      cin>>a;
      del(find(root,a));
    }
  }
  return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

bool block[6][110][110];
bool visit[110][110];

int main(){
	int w, h;
	int xs, ys, xg, yg;
	int n, c, d, x, y;
	while(scanf("%d%d%d%d%d%d%d", &w, &h, &xs, &ys, &xg, &yg, &n) == 7){
		memset(block, 0, sizeof block);
		memset(visit, 0, sizeof visit);

		for(int i = 0; i < n; ++i){
			scanf("%d%d%d%d", &c, &d, &x, &y);

			int dx, dy;
			if(d){ dx = 2; dy = 4; }
			else{  dy = 2; dx = 4; }

			for(int j = 0; j < dy; ++j)
			for(int k = 0; k < dx; ++k){
				block[c][y + j][x + k] = true;
			}
		}

		for(c = 5; c > 1 && !block[c][ys][xs]; --c);

		if(c){
			queue<int> q;
			q.push(ys << 16 | xs);
			visit[ys][xs] = true;
			while(!q.empty()){
				y = q.front() >> 16;
				x = q.front() & 0xffff;
				q.pop();

				for(int dy = -1; dy <= 1; ++dy)
				for(int dx = -1; dx <= 1; ++dx){
					if(block[c][y+dy][x+dx] && !visit[y+dy][x+dx]){
						visit[y+dy][x+dx] = true;
						q.push(y+dy << 16 | x+dx);
					}
				}
			}
		}

		puts(visit[yg][xg] ? "OK" : "NG");
	}
}

/*** Mysterious Gems ***/

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

void create_map(int map[][SIZE], int n){
	int x, y;
	REP(j, SIZE){
		REP(i, SIZE){
			map[j][i]=0;
		}
	}
	REP(i, n){
		cin >> x >> y;
		map[y][x]=1;
	}
	return;
}

int main(){
	int N, M;
	int l;
	int map[SIZE][SIZE], flag;
	char d;

	cin >> N;
	while(N!=0){
		create_map(map, N);

		int xx=10, yy=10;
		cin >> M;
		REP(k, M){
			cin >> d >> l;
			while(l>0){
				if(d=='N') ++yy;
				else if(d=='E') ++xx;
				else if(d=='S') --yy;
				else --xx;

				if(map[yy][xx]) map[yy][xx]=0;
				--l;
			}
		}
		flag=0;
		REP(j, SIZE){
			REP(i, SIZE){
				if(map[j][i]){
					flag=1;
					break;
				}
			}
		}

		if(flag) cout << "No" << endl;
		else cout << "Yes" << endl;

		cin >> N;
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define FASTIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inf 1e18
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mod 1000000007
#define pb push_back
#define all(s) s.begin(),s.end()
#define pie 3.14159265358979323846
#define fr(i,a,b)  for(ll i=a;i<b;i++)
#define frr(i,a,b) for(ll i=b-1;i>=a;i--)
#define gcd __gcd
#define con continue
#define pii pair<ll,ll>
signed main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
         ll n;cin>>n;
         ll arr[n],sum=0;
         ll a[n],s=0;
         for(ll i=0;i<n;i++)cin>>a[i];
         for(ll i=n-1;i>=0;i--)s+=a[i],arr[i]=s,s%=mod;
         //for(ll i=0;i<n;i++)cout<<arr[i]<<" ";
         //cout<<"\n";
         for(ll i=0;i+1<n;i++){
            sum=(sum%mod+(a[i]%mod*arr[i+1]%mod)%mod)%mod;
         }
         cout<<sum%mod<<"\n";
    }
}

#include <iostream>
#include <vector>
#include <queue>
#define to first
#define cost second
const int inf=1e9+7;
using namespace std;
int main(){

  int n,tmp,r=0,flag[100]={},v=0;
  cin>>n;
  vector <pair<int,int> > gl[n];
  priority_queue <pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > >q;
  //for(int i=1;i<n;i++) mincost[i]=inf;

  for(int i=0;i<n;i++) for(int j=0;j<n&&cin>>tmp;j++) if(tmp!=-1) gl[i].push_back(make_pair(j,tmp));
  int now=0;
  for(int j=0;j<n-1;j++){
    for(int i=0;i<gl[now].size();i++) if(!flag[gl[now][i].to]) q.push(make_pair(gl[now][i].cost,gl[now][i].to));
    flag[now]=1;
    for(;flag[q.top().second];) q.pop();
    //if(q.empty()) break;
    r+=q.top().first;
    now=q.top().second;
    q.pop();
  }
  cout<<r<<endl;
  return 0;

}


#include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl

template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max

using namespace std;

int main() {
	int N,Q;
	int M,date;
	bool dates[100][50]; //date N

	while(cin >> N >> Q) {
		if (N == 0 && Q == 0) break;
		fill_n((bool *)dates,sizeof(dates)/sizeof(bool),false);
		rep(n,N) {
			cin >> M;
			rep(m,M) { //Dates
				cin >> date;
				dates[date][n] = true;
			}
		}

		/*
		rep(n,N) {
			rep(d,20) {
				cout << dates[d][n];
			}
			cout << endl;
		}
		cout << endl; */

		int cnt=0;
		int max_cnt=0;
		int max_d=0;
		rep(d,100) {
			cnt = 0;
			rep(n,N) { //縦に見る
				if(dates[d][n]) {
					cnt++;
				}
			}
			if (cnt > max_cnt) {
				max_cnt = cnt;
				max_d = d;
			}
		}
		if (max_cnt >= Q) {
			cout << max_d << endl;
		}
		else {
			cout << 0 << endl;
		}
	}

	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

int main(){

	int N,Q,M,Date[101],i,l,k;

	while(0<=scanf("%d%d",&N,&Q)){
		for(i=0;i<101;i++){
			Date[i]=0;
		}

		if((N==0) && (Q==0)){
			break;
		}

		for(k=0;k<N;k++){
			scanf("%d",&M);
			if(M==0){
				continue;
			}else{
				for(i=0;i<M;i++){
					scanf("%d",&l);
					++Date[l];
				}
			}
		}
		l=0;
		i=0;
		for(k=0;k<100;k++){
			if(i<Date[k] && Date[k]>=Q){
				i=Date[k];
				l=k;
			}
		}

		printf("%d\n",l);
	}

	return 0;
}


#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, X;
ll B[MAX_N], L[MAX_N], R[MAX_N];
int idx[MAX_N];
int fid[MAX_N];
ll RS[MAX_N], LS[MAX_N];

bool ok(ll m) {
	int q = m / X;
	int r = m % X;
	rep(i, 0, N) {
		ll tmp = 0;
		if(r == 0) {
			tmp += RS[q];
			tmp += LS[N] - LS[q];
		}
		else {
			if(B[i] > r) tmp += L[i] * (r - B[i]);
			else tmp += R[i] * (r - B[i]);

			if(fid[i] < q) {
				tmp -= R[i] * (X - B[i]);
				tmp += RS[q + 1];
				tmp += LS[N] - LS[q + 1];
			}
			else {
				tmp -= -L[i] * B[i];
				tmp += RS[q];
				tmp += LS[N] - LS[q];
			}
		}
		if(tmp >= 0) {
			return true;
		}
	}
	return false;
}

void solve() {
	cin >> N >> X;
	rep(i, 0, N) {
		cin >> B[i] >> L[i] >> R[i];
		idx[i] = i;
	}
	sort(idx, idx + N, [](int i, int j){
			return R[i] * (X - B[i]) + L[i] * B[i] > R[j] * (X - B[j]) + L[j] * B[j];
			});
	// rep(i, 0, N) {
	// 	debug(R[i] * (X - B[i]) - L[i] * B[i], B[i], L[i], R[i]);
	// }
	// debug(vi(idx, idx + N));
	rep(i, 0, N) {
		int at = idx[i];
		fid[at] = i;
		RS[i + 1] = RS[i] + R[at] * (X - B[at]);
		LS[i + 1] = LS[i] - L[at] * B[at];
	}

	ll lv = -1, rv = 1ll * N * X;
	while(rv - lv > 1) {
		ll m = (lv + rv) / 2;
		if(ok(m)) rv = m;
		else lv = m;
	}
	cout << rv << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

#include<bits/stdc++.h>
#define MN 100000
#define ll long long
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
ll res,v[MN+5],V[MN+5],ans,g[MN+5],G[MN+5];
int n,X,L[MN+5],R[MN+5],b[MN+5],rk[MN+5];
bool cmp(int x,int y){return v[x]+g[x]>v[y]+g[y];}
ll GetV(ll*s,int l,int r,int x){return s[r]-s[l-1]-((x>=l&&x<=r)?s[x]-s[x-1]:0);}
inline int Div(ll x,int y){return (x+y-1)/y;}
int main()
{
    n=read();X=read();
    for(int i=1;i<=n;++i)
    {
        b[i]=read();L[i]=read();R[i]=read();
        v[i]=1LL*(X-b[i])*R[i];g[i]=1LL*b[i]*L[i];
        rk[i]=i;ans+=b[i];
    }
    sort(rk+1,rk+n+1,cmp);
    for(int i=1;i<=n;++i) V[i]=V[i-1]+v[rk[i]],G[i]=G[i-1]+g[rk[i]];
    for(int i=1;i<=n;++i)
    {
        int l=0,r=n-1,mid,res=n;
        while(l<=r)
        {
            mid=l+r>>1;
            ll Val=GetV(V,1,mid,i)-GetV(G,mid+1,n,i)+v[rk[i]];
            if(Val>=0) res=mid,r=mid-1; else l=mid+1;
        }
        ll Val=GetV(V,1,res,i)-GetV(G,res+1,n,i);
        if(Val>=0) ans=min(ans,1LL*(res-(res>=i))*X+max(0,Div(g[rk[i]]-Val,L[rk[i]])));
        else ans=min(ans,1LL*(res-(res>=i))*X+b[rk[i]]+Div(-Val,R[rk[i]]));
    }
    cout<<ans;
	return 0;
}


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

int main() {
  int n,m; cin >> n >> m;
  cout << max(n+m,max(n-m,n*m));
}

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

int main()
 {
 	int a,b,c,d,e;
 	cin>>a>>b>>c;
 	e=c;
 	d=a;
 	a=b;
 	b=d;
 	c=a;
 	a=e;
 	cout<<a<<" "<<b<<" "<<c<<" "<<endl;
 	return 0;
}


#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

int main(){

	int n,tmp,row_sum,col_sum[11];

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		for(int i=0; i < 11; i++)col_sum[i] = 0;

		for(int i=0; i < n; i++){
			row_sum = 0;
			for(int k=0; k < n; k++){
				scanf("%d",&tmp);
				printf("%5d",tmp);
				row_sum += tmp;
				col_sum[k] += tmp;
			}
			printf("%5d\n",row_sum);
			col_sum[n] += row_sum;
		}
		for(int i=0; i <= n; i++)printf("%5d",col_sum[i]);
		printf("\n");
	}

    return 0;
}

#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int cnt[10800];
int main(){
	int n, q, m, d;
	while(cin >> n >> q, n | q){
		fill(cnt, cnt + 10800, 0);
		int res = 0;
		int mx = 0;
		for(int i = 0;i < n;i++){
			cin >> m;
			for(int j = 0;j < m;j++){
				cin >> d;
				cnt[d]++;
				mx = max(mx, cnt[d]);
			}
		}
		for(int i = 10799;i >= 0;i--){
			if(mx >= q && cnt[i] == mx)res = i;
		}
		cout << res << endl;
	}
	return 0;
}


#include<iostream>

using namespace std;

int main() {

	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}

		int point_a = 0;
		int point_b = 0;

		for (int i = 0; i < n; ++i) {
			int a, b;
			cin >> a >> b;
			if (a > b) {
				point_a += a + b;
			}
			else if (a < b) {
				point_b += a + b;
			}
			else {
				point_a += a;
				point_b += b;
			}
		}
		cout << point_a << " " << point_b << endl;
	}
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int n, a, b, count = 0, pointX = 0, pointY = 0;
	cin >> n;
	do {
		cin >> a >> b;
		if (a > b) {
			pointX += (a + b);
		}
		else if (a < b) {
			pointY += (a + b);
		}
		else {
			pointX += a;
			pointY += b;
		}
		count++;
		if (count == n) {
			cout << pointX << " " << pointY << endl;
			pointX = pointY = count = 0;
			cin >> n;
		}
	} while (n != 0);
	return 0;
}


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

int main() {
   int N, K, x;
   x = 1;
   cin >> N >> K;
   int i=0;
   while (2*x < x+K){
        if (i>=N) {break;}
   		x*=2;
        i++;
   }
   for (int j=0; j<N-i; j++){
     	x+=K;
   }
   cout << x << endl;
}

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;
const int inf =2e9;
int N,top=0;
int st[maxn];
int main(){
    cin>>N;
    st[top]=-inf;
    for(int i=1;i<=N;i++){
        int x;
        cin>>x;
        x=-x;
        if(x>=st[top])st[++top]=x;
        else{
            int l=1,r=top;
            while(l<=r){
                int mid=(l+r)/2;
                if(x>=st[mid])l=mid+1;
                else r=mid-1;
            }
            st[l]=x;
        }
    }
    cout<<top<<endl;
}


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

using namespace std;
using namespace __gnu_pbds;

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

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

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

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,M;
int nor, bip, sing, done[MX];
ll ans;
vi adj[MX];
bool ok = 1;

ll sq(ll x) { return x*x; };

void dfs(int x, int y) {
    if (done[x]) {
        if (done[x] != y) ok = 0;
        return;
    }
    // cout << "HUH " << x << "\n";
    done[x] = y;
    for (int i: adj[x]) dfs(i,y^3);
}

void solve(int x) {
    if (sz(adj[x]) == 0) {
        sing ++;
        return;
    }
    ok = 1;
    dfs(x,1); // cout << "OOPS " << x << "\n";
    if (ok) bip ++;
    else nor ++;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    F0R(i,M) {
        int u,v; cin >> u >> v;
        adj[u].pb(v), adj[v].pb(u);
    }
    FOR(i,1,N+1) if (!done[i]) {
        //cout << i << "\n";
        solve(i);
    }
    //cout << nor << " " << bip << " " << sing << "\n";
    F0R(i,sing) {
        ans += 2*N-1; N --;
    }
    //cout << ans << "\n";
    ans += sq(bip);
    ans += sq(nor+bip);
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll n, m;
vector<vector<ll>> g;
vector<vector<ll>> rg;
vector<ll> t;
void dfs(ll now, vector<int> &visited){
    visited[now] = 1;
    rep(i, g[now].size()){
        ll next = g[now][i];
        if(visited[next]) continue;
        dfs(next, visited);
    }
    t.push_back(now);
}
int main(void){

    cin >> n >> m;
    g.resize(n);
    rg.resize(n);
    vector<int> appeared(n, 0);
    rep(i, n - 1 + m){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        rg[b].push_back(a);
        appeared[b] = 1;
    }
    ll root = 0;
    rep(i, n){
        if(!appeared[i]){
            root = i;
            break;
        }
    }

    vector<int> visited(n, 0);
    dfs(root, visited);

    reverse(all(t));

    map<ll,ll> mp;
    rep(i, t.size()){
        mp[t[i]] = i;
    }

    rep(i, n){
        sort(all(rg[i]), [&mp](const ll &f, const ll &s){
            return mp[f] > mp[s];
        });
    }
    vector<ll> ans(n);
    rep(i, n){
        if(rg[i].size() == 0){
            ans[i] = 0;
        } else {
            ans[i] = rg[i][0] + 1;
        }
    }

    rep(i, ans.size()){
        cout << ans[i] << endl;
    }

}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
int f[6001][12001],n,mod;
#define inc(x,y) x+=y,x>=mod?x-=mod:0
int main()
{
	read(n),n*=3,read(mod),f[0][n]=1;
	for(res i=1;i<=n;++i)
	  for(res j=n-i;j<=n+i;++j) {
	  	if(j) inc(f[i][j],f[i-1][j-1]);
	  	if(i>1&&j<2*n) inc(f[i][j],(ll)f[i-2][j+1]*(i-1)%mod);
	  	if(i>2) inc(f[i][j],(ll)f[i-3][j]*(i-1)*(i-2)%mod);
	  }
	int tot=0;
	for(res i=n;i<=2*n;++i) inc(tot,f[n][i]);
	print(tot,'\n');
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/

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

bool IsPrime(long long n){
  if(n == 1) return false;
  for(long long i = 2; i * i < n; i++){
    if(n%i == 0) return false;
  }
  return true;
}

vector<pair<long long, long long>> PrimeFactorize(long long n){
  vector<pair<long long, long long>> res;

  long long a = 0;

  for(long long i = 2; i * i <= n; i++){
    a = 0;
    if(n%i == 0){
      if(IsPrime(i)){
        while(n % i == 0){
          n /= i;
          a++;
        }
        res.push_back(make_pair(i, a));
      }
    }
  }

  if(n!= 1) res.push_back(make_pair(n, 1));
  return res;
}

int NumOfDivisor(long long n){
  vector<pair<long long, long long>> res;
  res = PrimeFactorize(n);

  int num = 1;
  for(int i = 0; i < res.size(); i++){
    num *= (1 + res[i].second);
  }

  return num;

}

int main(){
  const int mod = 1e9 + 7;
  int n;
  const int max_n = 1e3;
  cin >> n;

  long long ans = 1;
  long long ex[max_n + 2]  = {};

  for(int i = 1; i <= n; i++){
    vector<pair<long long, long long>> res;
    res = PrimeFactorize(i);
    for(int j = 0; j < res.size(); j++){
      ex[res[j].first - 1] += res[j].second;
    }
  }

  for(int i = 0; i < n; i++){
    ans *= (ex[i] + 1);
    ans %= mod;
  }

  cout << ans << endl;

  return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main(){
  long int n,sum=0;
  cin>>n;
  vector<int>v;
  for(long int i=1;i<=n;i++){

    v.push_back(i);
    if(i%3==0||i%5==0)
      v.pop_back();
  }

  for(long int i=0;i<v.size();i++){
    sum+=v[i];
  }
  cout<<sum;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long int math(long long int x)
{
	long long int ans;
	ans=x*(x+1)/2;
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long int ff,n,fv,th,total,totalff,totalfv,totalth,ans;
	cin>>n;
	total= math(n);
	ff=n/15;
	totalff=15*math(ff);
	th=(n/3);
	totalth=3*math(th);
	fv=(n/5);
	totalfv=5*math(fv);
	ans=total-totalfv-totalth+totalff;
	cout<<ans;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int n,m;
    while(cin>>n>>m){
        if(n==0 && m==0)break;

        int data[600][600]={};
        rep(i,600){
            rep(j,600){
                if(i==j){
                    data[i][j]=0;
                }
                else{
                    data[i][j]=INF;
                }
            }
        }

        rep(i,m){
            int a,b;
            cin>>a>>b;
            a--;b--;
            data[a][b]=1;
            data[b][a]=1;
        }

        rep(k,n){
            rep(i,n){
                rep(j,n){
                    data[i][j]=min(data[i][j],data[i][k]+data[k][j]);
                }
            }
        }
        int c=0;
        for(int i=1;i<n;i++){
            if(data[0][i]<=2)
                c++;
        }
        cout<<c<<endl;
    }
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip;
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){

  int n, m;
  int a[10000], b[10000];
  while( cin >> n >> m, n + m ) {
    map<int, int> maps;
    set<int> all;

    for(int i=0; i<m; i++) {
      cin >> a[i] >> b[i];
      if( a[i] == 1 ) {
	maps[b[i]] = 1;
	all.insert(b[i]);
      }
    }

    for(int i=0; i<m; i++) {
      if( maps[a[i]] == 1 ) {
	all.insert(b[i]);
      }
      if( maps[b[i]] == 1 ) {
	if( a[i]!= 1 ) {
	  all.insert(a[i]);
	}
      }
    }

    cout << all.size() << endl;
  }
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;

  for(int i=1;; i++) {
    if(i*i>N) {
      cout << (i-1)*(i-1) << endl;
      break;
      }
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int n=sqrt(N);
  cout << n*n << endl;
}


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  cout << (int)(floor(sqrt(N))*floor(sqrt(N))) << endl;
}

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

template <class T>
vector<pair<T, T>> prime_factorization(T n) {
    vector<pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        T cnt = 0;
        while(n % i == 0) {
            n /= i; cnt++;
        }
        if(cnt != 0) ret.emplace_back(i, cnt);
    }
    if (n != 1) ret.emplace_back(n, 1);
    return ret;
}

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

    map<int64_t, int64_t> f;
    for (auto i = 2; i <= n; i++) {
        auto p = prime_factorization(i);
        for (auto & elm : p) f[elm.first] += elm.second;
    }

    int64_t ans = 1;
    const int64_t mod = 1e9 + 7;
    for (auto & elm : f) ans = ((elm.second + 1) * ans) % mod;

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


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 30;
int n, m, x, y,q;ll z, w=0, sum = 0, ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
int dp[10010][2][110];
int main(void) {
	string s; int d; cin >> s >> d;
	Fill(dp, 0);
	dp[0][1][0] = 1;
	rep(i, s.size()) {
		rep(j, d) {
			rep(k, 10) {
				dp[i + 1][0][(j + k) % d] += dp[i][0][j];
				dp[i + 1][0][(j + k) % d] %= MOD;
			}
			int Si = s[i] - '0';
			rep(k, Si) {
				dp[i + 1][0][(j + k) % d] += dp[i][1][j];
				dp[i + 1][0][(j + k) % d] %= MOD;
			}
			dp[i + 1][1][(j + Si) % d] = dp[i][1][j];
		}
	}cout << (dp[s.size()][0][0] + dp[s.size()][1][0] - 1 + MOD) %MOD << endl;
}

#include <bits/stdc++.h>

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 2e5 + 10;
int T;

const int mod = 1e9 + 7;

int d;
char s[10010];
int dp[10010][111];
int len;

int dfs(int pos, int cursum, bool ding)
{
    if (pos == len)
    {
        return cursum == 0;
    }

    if (ding == false && dp[pos][cursum] != -1)
    {
        return dp[pos][cursum];
    }

    int ret = 0;

    int ed = 9;
    if (ding) ed = s[pos] - '0';
    for (int i = 0; i <= ed; i++)
    {
        int v = dfs(pos + 1, (cursum + i) % d, ding && i == ed);
        ret = (ret + v) % mod;
    }

    if (!ding) dp[pos][cursum] = ret;
    return ret;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
// freopen("out", "w", stdout);
#endif

    while (~scanf("%s", s))
    {
        scanf("%d", &d);
        len = strlen(s);

        clr(dp, -1);

        int ans = dfs(0, 0, true);
        ans = (ans - 1 + mod) % mod;
        printf("%d\n", ans);
    }

    return 0;
}


 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define  fi0 for(ll i=0;i<n;i++)
string s;
string strd(int n){
    string x;
    while(n){
        int d=n%10;
        x+=(d+'0');
        n/=10;
    }
    reverse(x.begin(),x.end());
    return x;
}
void digit()
{
    cin>>s;
    ll sum=0;
    for(int i=0;i<s.size();i++){
        char a=(char)s[i];
        int d=(int) a-'0';
        sum+=d;
    }
    if(sum%9==0)cout<<"Yes\n";
    else cout<<"No\n";
}
int main()
{
   ll n;
   cin>>n;
   ll cnt=0;
   ll a[n];
  fi0{
    cin>>a[i];
   }

   sort(a,a+n);
   ///fi0 cout<<a[i]<<' ';
   for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        for(int k=j+1;k<n;k++){
             if(a[i]!=a[j]&&a[j]!=a[k]){
                vector<ll>xxx;
                xxx.push_back(a[i]);
                xxx.push_back(a[j]);
                xxx.push_back(a[k]);
                sort(xxx.begin(),xxx.end());
                if(xxx[0]+xxx[1]>xxx[2])cnt++;
             }
        }
    }
   }
   cout<<cnt<<endl;
}

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

int main(){
  int N;
  cin >> N;
  if(N < 3){
    cout << "0" << endl;
    return 0;
  }
  vector<int> a(N);
  for(int i = 0;i < N;i++){
    cin >> a.at(i);
  }
  int count = 0;
  for(int j = 2;j < N;j++){
    for(int k = 1;k < j;k++){
      for(int l = 0;l < k;l++){
        if((a.at(j) == a.at(k)) || (a.at(k) == a.at(l)) || (a.at(l) == a.at(j)))continue;
        if((a.at(j) < a.at(k) + a.at(l)) && (a.at(k) < a.at(l) + a.at(j)) && (a.at(l) < a.at(j) + a.at(k)))count++;
      }
    }
  }
  cout << count <<endl;

}


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

using namespace std;

int main()
{
	string s;
	int q;
	cin >> s >> q;
	cin.ignore();

	string buf;
	while (q)
	{
		getline(cin, buf);

		//cout << "DEBUG:" << buf << endl;

		if (buf.find("replace ") != string::npos)
		{
			char cmd[10] = {0};
			int a1, a2;
			char a3[1001] = {0};
			sscanf(buf.c_str(), "%s %d %d %s", cmd, &a1, &a2, a3);
			s.replace(a1, (a2+1)-a1, string(a3));
			//cout << "DEBUG:replaced:" << s << endl;
		}
		else if (buf.find("reverse ") != string::npos)
		{
			char cmd[10] = {0};
			int a1, a2;
			sscanf(buf.c_str(), "%s %d %d", cmd, &a1, &a2);
			string sub = s.substr(a1, (a2+1)-a1);
			//cout << "DEBUG:sub( ):" << sub << endl;
			reverse(sub.begin(), sub.end());
			//cout << "DEBUG:sub(r):" << sub << endl;
			size_t subsize = sub.size();
			for (int i = a1, j = 0; i < a1 + subsize; i++, j++) {
				s[i] = sub[j];
			}
			//cout << "DEBUG:reversed:" << s << endl;
		}
		else if (buf.find("print ") != string::npos)
		{
			char cmd[10] = {0};
			int a1, a2;
			sscanf(buf.c_str(), "%s %d %d", cmd, &a1, &a2);
			cout << s.substr(a1, (a2+1)-a1) << endl;
		}
		q--;
	}

	return 0;
}

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

int main()
{
	string s1, com, s2;
	int n,a,b;

	cin >> s1 >> n;
	for ( int i = 0; i < n; i++ )
	{
		cin >> com >> a >> b;
		if ( com == "print" )
			{
				cout << s1.substr(a, b-a+1) <<endl;
			}
		else if ( com == "replace" )
		{
			cin >> s2;
			s1 = s1.replace(a, b-a+1, s2);
		}
		else if ( com == "reverse" )
			{
				string s3 = s1.substr(a, b-a+1);
				int m = s3.size();
				for (int k = 0; k < m; k++)
				{
					s1[a+k] = s3[m-1-k];
				}
			}
		}
	return 0;
}


//Misterious Gems
#include <iostream>

using namespace std;

enum Direction{
	N = 1,//y+
	E = 2,//x+
	S = 3,//y-
	W = 4///x-
};

struct Order{
	Direction dir;
	int length;
};

int main(){
	int MaxN;//宝石最大数
	bool GemField[21][21];//宝石の有無保持用フィールド[y][x]
	bool RobotField[21][21];//ロボット通過情報保持用フィールド[y][x]
	int MaxM;//命令数
	Order Ord[30];//命令
	int RobotX, RobotY;//ロボット位置
	bool Gettable;//収集可能性

	int i, j, k, l;//使用する一時変数
	char c;//使用する一時変数

	while (1){
		//フィールド初期化
		for (i = 0; i < 21; ++i){
			for (j = 0; j < 21; ++j){
				GemField[i][j] = false;
				RobotField[i][j] = false;
			}
		}
		RobotField[10][10] = true;
		RobotX = 10; RobotY = 10;
		Gettable = true;
		//代入
		cin >> MaxN;
		if (MaxN == 0)break;
		for (i = 0, j = 0, k = 0; i < MaxN; ++i){
			cin >> j >> k;
			GemField[k][j] = true;
		}
		cin >> MaxM;
		for (i = 0, c = 0; i < MaxM; ++i){
			cin >> c >> Ord[i].length;
			switch(int(c)){
			case 'N':
				Ord[i].dir = N;
				break;
			case 'E':
				Ord[i].dir = E;
				break;
			case 'W':
				Ord[i].dir = W;
				break;
			case 'S':
				Ord[i].dir = S;
				break;
			}
		}

		//命令実行&RobotFieldに反映
		for (i = 0, k = 0, l = 0; i < MaxM; ++i){
			//方向決定
			k = (Ord[i].dir % 2 == 0) ? 1 : 0;//偶数ならX
			l = (Ord[i].dir % 2 == 0) ? 0 : 1;//奇数ならY
			if (Ord[i].dir >= 3){
				k *= -1; l *= -1;
			}
			//移動
			for (int j = 0; j < Ord[i].length; ++j){
				RobotX += k; RobotY += l;
				RobotField[RobotY][RobotX] = true;
			}
		}

		//全収集チェック
		for (i = 0; i < 21 && Gettable ; ++i){
			for (j = 0; j < 21 && Gettable; ++j){
				if (GemField[j][i] && !RobotField[j][i])Gettable = false;
			}
		}

		//出力
		cout << (Gettable ? "Yes" : "No") << endl;
	}

	return 0;
}

#include <stdio.h>

typedef struct _Gem{
	int x;
	int y;
	bool hit;
} Gem;

static void
pick_gem(Gem* g, int n, int x, int y)
{
	for (int i = 0; i < n; i++) {
		if (!g[i].hit && g[i].x == x && g[i].y == y) {
			g[i].hit = true;
			return;
		}
	}
}

static bool
check_gem(Gem* g, int n)
{
	for (int i = 0; i < n; i++) {
		if (g[i].hit == false) {
			return false;
		}
	}

	return true;
}

int
main(void)
{

	char line[80];
	int n;
	int m;

	Gem g[20];

	char d[30];
	int l[30];

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &n) != 1) {
			return 1;
		}

		if (n == 0) {
			break;
		}

		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%d %d", &(g[i].x), &(g[i].y)) != 2) {
				return 1;
			}
			g[i].hit = false;
		}

		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d", &m) != 1) {
			return 1;
		}

		for (int i = 0; i < m; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			if (sscanf(line, "%c %d", &(d[i]), &(l[i])) != 2) {
				return 1;
			}
		}

		int x = 10;
		int y = 10;
		for (int i = 0; i < m; i++) {
			if (d[i] == 'N') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, ++y);
				}
			} else if (d[i] == 'S') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, x, --y);
				}
			} else if (d[i] == 'E') {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, ++x, y);
				}
			} else {
				for (int k = 1; k <= l[i]; k++) {
					pick_gem(g, n, --x, y);
				}
			}
		}
		printf("%s\n", (check_gem(g, n) ? "Yes" : "No"));
	}

	return 0;
}


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

typedef long long int ll;
#define all(x) (x).begin(), (x).end()

using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}

void SieveOfEratosthenes(int n,vector <int> &primes)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Print all prime numbers
    for (int p=2; p<=n; p++)
       if (prime[p])
          primes.push_back(p);
}

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

ll power(ll x, ll y,ll mod)
{
    ll temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2,mod);
    if (y%2 == 0)
        return (temp*temp)%mod;
    else
        return (((x*temp)%mod)*temp)%mod;
}

vector <vector <int> > g;
void dfs(int s,vector <int> &p,int &parent,int &child,set <int> &s2,vector <bool> &visited,vector <int> &depth,int &min,vector <int> &path);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),m=nxt();
    vector <int> row;
    g.resize(n+1,row);

    set <pair<int,int> > edges;
    for(int i=0;i<m;i++)
    {//cout<<"came3\n";
        int u=nxt(),v=nxt();
        g[u].push_back(v);
        edges.insert({u,v});
    }

    vector <int> p(n+1);
    int parent=0,child=0,min=INT_MAX;
    vector <int> path(n+1);
    for(int i=1;i<=n;i++)
    {//cout<<"came"<<endl;
        vector <bool> visited;
        visited.resize(n+1,0);
        set <int> s2;
        vector <int> depth(n+1);
        depth[i]=0;
        dfs(i,p,parent,child,s2,visited,depth,min,path);

    }

    if(parent!=0)
        {
            vector <int> test;
            int cur=child;
            test.push_back(cur);
            //cout<<cur<<" "<<parent<<endl;
            //return 0;
            while(cur!=parent)
            {//cout<<cur<<endl;
                cur=path[cur];
                test.push_back(cur);
            }
            cout<<test.size()<<endl;
            for(auto val:test)
                cout<<val<<endl;
            return 0;
        }
    cout<<"-1\n";

    return 0;
}

void dfs(int s,vector <int> &p,int &parent,int &child,set <int> &s2,vector <bool> &visited,vector <int> &depth,int &min,vector <int> &path)
{
    visited[s]=1;
    int x=s;
    s2.insert(x);
        for(int i=0;i<g[x].size();i++)
        {
            if(!visited[g[x][i]])
            {
                p[g[x][i]]=x;
                depth[g[x][i]]=depth[x]+1;
                dfs(g[x][i],p,parent,child,s2,visited,depth,min,path);

            }
            else{
                if(s2.count(g[x][i])&&(depth[x]-depth[g[x][i]])<min)
                {
                    child=x;
                    parent=g[x][i];
                    min=depth[x]-depth[g[x][i]];
                    path=p;
                }
            }
        }
    s2.erase(x);

}

#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int N,M;
vector<int>G[1000];
int cnt[1000];
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;u--,v--;
		G[u].push_back(v);
		cnt[v]++;
	}
	queue<int>P;
	for(int i=0;i<N;i++)
	{
		if(cnt[i]==0)P.push(i);
	}
	int sz=0;
	while(!P.empty())
	{
		sz++;
		int u=P.front();P.pop();
		for(int v:G[u])
		{
			if(--cnt[v]==0)P.push(v);
		}
	}
	cout<<-(sz==N)<<endl;
}


#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

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

constexpr ll MOD = 1000000007, MAX = 55555;

vi prime()
{
  vi ret;

  rep2(i, 3, MAX) {
    bool ok = true;
    rep2(j, 2, sqrt(i)) {
      if (i % j == 0) {
        ok = false;
        break;
      }
    }

    if (ok && i % 10 == 1) ret.eb(i);
  }
  return ret;
}

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

  int n; cin >> n;
  auto v = prime();

  rep(i, n) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;

  return (0);
}


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

int main() {

	ll n; cin >> n;
	map<ll, ll> mp;
	for (int i = 0; i < n; i++) {
		ll a; cin >> a;
		mp[a]++;
	}
	ll cnt = 0;
	for (auto u : mp) {
		if (1 < u.second) cnt++;
	}
	string ans = "YES";
	if (1 <= cnt) ans = "NO";
	cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define inf             1e18
#define no_of_test(x)        int x; cin>>x; while(x--)
const int mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//	no_of_test(x)
	{
      int n;
	  cin>>n;
	  int a[n];
	  set<int>s;
	  for(int i=0;i<n;i++)
	  {
		  cin>>a[i];
		  s.insert(a[i]);
	  }
	  if(s.size()==n)
	  {
		  cout<<"YES"<<'\n';
	  }
	  else
	  {
		cout<<"NO"<<'\n';
	  }

	}
	return 0;
}


#include <bits/stdc++.h>

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  if (n == 1) {
    out("Hello World");
    return 0;
  }
  in(int, a, b);
  out(a + b);
}

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

int main() {
int n,a,b;
cin >> n >> a >> b;
if(n==1) cout << "Hello World" << endl;
else cout << a+b << endl;
}


#include <iostream>
#include <vector>
#include <iterator>
#include <numeric>
#include <algorithm>

typedef long long ll;

using std::cin;
using std::cout;

const int MaxN = 100005;

int n, m; ll k;
int buk[MaxN];
ll arr[MaxN], tmp[MaxN];
bool vis[MaxN];

int main() {
	cin >> n;
	std::copy_n(std::istream_iterator<int>(cin), n, arr);
	cin >> m >> k;
	std::iota(buk, buk + n, 0);
	while (m--) {
		int pos; cin >> pos;
		std::swap(buk[pos - 1], buk[pos]);
	}
	std::adjacent_difference(arr, arr + n, tmp);
	for (int i = 0; i < n; ++i) {
		if (!vis[i]) {
			std::vector<int> vec;
			int j = i;
			do {
				vis[j] = true;
				vec.push_back(j);
				j = buk[j];
			} while (j != i);
			int len = vec.size();
			for (int p = 0; p < len; ++p) {
				int from = vec[p];
				int to = vec[(p + k) % len];
				arr[from] = tmp[to];
			}
		}
	}
	std::partial_sum(arr, arr + n, std::ostream_iterator<ll>(cout, "\n"));
	return 0;
}

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

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DLOG(...)
#endif

void debug(auto f) {
#if DEBUG
  f();
#endif
}

ll mPrime = 1000*1000*1000 + 7;
ll n, x;
vector<ll> s;
vector<ll> facts;
vector<ll> invFacts;
vector<int> tbl;

ll mAdd(ll x, ll y) {
  ll z = x + y;
  if (z < mPrime)  return z;
  else             return (z - mPrime);
}

ll mSub(ll x, ll y) {
  ll z = x - y;
  if (z >= 0)  return z;
  else         return (z + mPrime);
}

ll mMul(ll x, ll y) {
  return (x * y) % mPrime;
}

ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

ll mInv(ll x) {
  ll s, t;
  eGCD(x, mPrime, s, t);
  return s < 0 ? s + mPrime : s;
}

int main() {
  cin >> n >> x;
  s.resize(n);
  for (ll i = 0; i < n; i++) {
    cin >> s.at(i);
  }
  facts.resize(n+1);
  invFacts.resize(n+1);
  facts.at(0) = invFacts.at(0) = 1;
  for (ll i = 1; i <= n; i++) {
    facts.at(i) = mMul(i, facts.at(i-1));
    invFacts.at(i) = mInv(facts.at(i));
  }
  sort(s.begin(), s.end());

  tbl.resize(x+1, 0);
  tbl.at(x) = 1;

  ll lim = x;
  for (ll k = n; k >= 1; k--) {
    ll newLim = 0;
    for (ll r = 1; r <= lim; r++) {
      ll weight = tbl.at(r);
      if (weight == 0)  continue;
      newLim = r;
      ll rem = k;
      for (ll t : s) {
	if (r < t)  break;
	rem--;
	ll newR = r % t;
	tbl.at(newR) = mAdd(tbl.at(newR), weight);
      }
      tbl.at(r) = mMul(tbl.at(r), rem);
    }
    lim = newLim;
  }
  ll ans = 0;
  for (ll r = 1; r <= lim; r++) {
    ans = mAdd(ans, mMul(tbl.at(r), r));
  }
  cout << ans << endl;

  return 0;
}


#include <iostream>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while(cin>>n, n) {
        int now, max;
        cin>>now;
        max=now;
        for(int i=1; i<n; i++) {
            int t;
            cin>>t;
            if(now<=0) now=t;
            else now+=t;
            if(max<now) max=now;
        }
        cout<<max<<'\n';
    }
    return 0;
}

#include <iostream>

int calcMaxSum(int amount_set);

int main()
{
    while (true) {
        int amount_set;
        std::cin >> amount_set;
        if(amount_set == 0) {
            break;
        }
        std::cout << calcMaxSum(amount_set) << std::endl;
    }

    return 0;
}

int calcMaxSum(int amount_set)
{
    const int MAXNUMBER = 100000;//??\????????????????????§??????

    int *data;
    data = new int[amount_set + 1];
    int *sum = new int[amount_set + 1];

    sum[0] = 0;//???????????????????????????????????´??????sum[0]??§??????

    std::cin >> data[1];//?????????????????±???
    sum[1] = data[1];//?????????????????????

    for (int number = 2; number <= amount_set; number++) {
        std::cin >> data[number];//????????????????????????
        sum[number] = sum[number - 1] + data[number];// ????????´??°
    }

    int max = -MAXNUMBER;//????????????????????¨??¨-MAXNUMBER???????????????????????§???????????????????????????????°????

    for (int number_big = 1; number_big <= amount_set; number_big++) {
        for (int number_small = 0; number_small < number_big; number_small++) {
            if (sum[number_big] - sum[number_small] > max) {
                max = sum[number_big] - sum[number_small];
            }
        }
    }
    delete [] data;
    delete [] sum;

    return max;

}


//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

const int MOD = 1e9 + 7;
int n, x, y, z, l, ng;
ll dp[41][1 << 16], ans;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n >> x >> y >> z;
	l = x + y + z - 1;
	int m = (1 << l) - 1;
	ng = (1 << l) | (1 << (l - x)) | (1 << (l - x - y));
	dp[0][0] = 1;
	REP(i, n) {
		FOR(a, 1, 11) {
			REP(s, 1 << l) {
				int t = (s << a) | (1 << (a - 1));
				if ((ng & t) != ng)dp[i + 1][t & m] = (dp[i + 1][t & m] + dp[i][s]) % MOD;

			}
		}
	}
	ans = 1;
	REP(i, n)ans = ans * 10 % MOD;
	REP(s, 1 << l) {
		ans += MOD - dp[n][s]; ans %= MOD;
	}
	print(ans);
}

#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
//const long long MOD = 998244353;
long long MOD;

using namespace std;

ll dp[6010][8005];

void solve()
{
    int n;
    scanf("%d%lld", &n, &MOD);

    dp[0][n] = 1;   // dp[i][j]: 後ろからi文字目まで選択済で、ただし残る2マス数が残る1マス数よりj-n個多い場合の数
    int i, j;
    for (i = 0; i < n * 3; i++) {
        for (j = 0; j <= n*4; j++) {
            if (dp[i][j]) {
                if(j+1<=n*4) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
                if(i+2<=n*3 && j-1>=0)   dp[i + 2][j - 1] = (dp[i + 2][j - 1] + dp[i][j] * (n*3-i-1) % MOD) % MOD;
                if(i+3<=n*3) dp[i + 3][j] = (dp[i + 3][j] + dp[i][j] * (n * 3 - i - 1) % MOD * (n * 3 - i - 2) % MOD) % MOD;
            }
        }
    }
    ll ans = 0;
    for (j = n; j <= n * 4; j++) {
        ans = (ans + dp[n * 3][j]) %MOD;
    }
    printf("%lld\n", ans);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
    return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    vec<ll> X(N);
    rep(i, N) cin >> X[i];

    ll ans = 0;
    ll now = X[0];
    for(int i=1;i<N;++i){
        ans+=min(A*(X[i]-now),B);
        now=X[i];
    }
    cout << ans << '\n';
}


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

const int MOD = 1e9 + 7;
int H, W, K;
vector<int> fib;
ll ans;

void input() {
    cin >> H >> W >> K;
}

int solve(int n) {
    if (n < 0) return 1;
    return fib[n];
}

int main() {
    input();
    fib = vector<int>(W);
    fib[0] = 1;
    fib[1] = 2;
    for (int i = 2; i < W; i++) fib[i] = fib[i-1] + fib[i-2];
    vector<ll> w1, w2;
    w1 = vector<ll>(W, 0);
    w1[0] = 1;
    rep(i, H) {
        w2 = vector<ll>(W, 0);
        for (int j = 0; j < W; j++) {
            if (j > 0) w2[j-1] = (w2[j-1] + w1[j] * solve(j-2) * solve(W-j-2)) % MOD;
            w2[j] = (w2[j] + w1[j] * solve(j-1) * solve(W-j-2)) % MOD;
            if (j < W - 1) w2[j+1] = (w2[j+1] + w1[j] * solve(j-1) * solve(W-j-3)) % MOD;
        }
        w1 = w2;
    }
    cout << w1[K-1] << endl;
}


#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int h, w;
int A[N], B[N], cnt[N];
map<int, int> c;

inline void solve()
{
    scanf("%d%d", &h, &w);
    for (int i = 1; i <= h; ++i)
        scanf("%d%d", &A[i], &B[i]);
    for (int i = 1; i <= w; ++i)
        c.insert(mp(i, i));
    int ans = 0;
    cnt[0] = w;
    for (int i = 1; i <= h; ++i)
    {
        int L = A[i], R = B[i];
        auto it = c.lower_bound(L);
        int pos = 0;
        while (it != c.end() && it->first <= R + 1)
        {
            pos = max(pos, it->second);
            cnt[it->first - it->second]--;
            it = c.erase(it);
        }
        if (pos && R + 1 <= w)
        {
            cnt[R + 1 - pos]++;
            c.insert(mp(R + 1, pos));
        }
        while (!cnt[ans] && ans < w)
            ans++;
        if (ans == w)
            puts("-1");
        else
            printf("%d\n", ans + i);
    }
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

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

/*

dp[i][j]=dp[i-1][j]+1; (j<L[i-1] or R[i-1]<j)
dp[i][j]=dp[i-1][L[i-1]-1]+1+(j-(L[i-1]-1)) (L[i-1]<=j<=R[i-1])
*/

const int M=2e5+5;
const int INF=0x3f3f3f3f;

struct SegT
{
	struct TN
	{
		int mn,fi,add;
		void app_add(int v)
		{
			add+=v;
			mn+=v;
		}
		void app_set(int v) // arthimic
		{
			add=0;
			fi=v;
			mn=v;
		}
	}tn[M*4];
	int P,L,R,V;
	void push(int o,int l,int mi,int r)
	{
		if(tn[o].fi!=-1)
		{
			tn[o<<1].app_set(tn[o].fi);
			tn[o<<1|1].app_set(tn[o].fi+mi-l+1);
			tn[o].fi=-1;
		}
		if(tn[o].add)
		{
			tn[o<<1].app_add(tn[o].add);
			tn[o<<1|1].app_add(tn[o].add);
			tn[o].add=0;
		}
	}
	void pull(int o)
	{
		tn[o].mn=min(tn[o<<1].mn,tn[o<<1|1].mn);
	}
	void build(int o,int l,int r)
	{
		tn[o].mn=tn[o].add=0;
		tn[o].fi=-1;
		if(l==r)
		{
			if(l==0) tn[o].mn=tn[o].add=INF;
			return;
		}
		int mid=(l+r)>>1;
		build(o<<1,l,mid);
		build(o<<1|1,mid+1,r);
		pull(o);
	}
	void add(int o,int l,int r)
	{
		if(L<=l&&r<=R)
		{
			tn[o].app_add(1);
			return;
		}
		int mid=(l+r)>>1;
		push(o,l,mid,r);
		if(L<=mid) add(o<<1,l,mid);
		if(mid<R) add(o<<1|1,mid+1,r);
		pull(o);
	}
	void set(int o,int l,int r)
	{
		if(L<=l&&r<=R)
		{
			tn[o].app_set(V+l-L+1);
			return;
		}
		int mid=(l+r)>>1;
		push(o,l,mid,r);
		if(L<=mid) set(o<<1,l,mid);
		if(mid<R) set(o<<1|1,mid+1,r);
		pull(o);
	}
	int query(int o,int l,int r)
	{
		if(l==r) return tn[o].mn;
		int mid=(l+r)>>1;
		push(o,l,mid,r);
		if(P<=mid) return query(o<<1,l,mid);
		else return query(o<<1|1,mid+1,r);
	}
}segt;

int main()
{
	int h,w; scanf("%d%d",&h,&w);
	segt.build(1,0,w);
	int l,r;
	for(int i=0;i<h;i++)
	{
		scanf("%d%d",&l,&r);
		if(l!=1)
		{
			segt.L=1; segt.R=l-1;
			segt.add(1,0,w);
		}
		if(r!=w)
		{
			segt.L=r+1; segt.R=w;
			segt.add(1,0,w);
		}
		segt.P=l-1;
		segt.V=segt.query(1,0,w);
		segt.L=l; segt.R=r;
		segt.set(1,0,w);
		int ans=segt.tn[1].mn;
		printf("%d\n",ans>=INF ? -1 : ans);
	}
	return 0;
}


#include<iostream>//itp14d.cpp
using namespace std;
int main(void)
{
	long long int n,m,i,max=0,min=10000000,all=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>m;
		all=all+m;
		if(max<=m) max=m;
		if(min>=m) min=m;
	}
	if(n==1) cout<<m<<" "<<m<<" "<<m<<endl;
	else cout<<min<<" "<<max<<" "<<all<<endl;
	return 0;
}


// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int G[500][500];
int ACC[501][501];

int main() {
  int n, m, q; in(n),in(m),in(q);
  loop(i,0,m) {
    int l, r; in(l),in(r);
    l--;r--;
    G[l][r]++;
  }

  loop(y,0,n) {
    loop(x,0,n) {
      ACC[y+1][x+1] = ACC[y+1][x] + ACC[y][x+1] - ACC[y][x] + G[y][x];
    }
  }

  // loop(y,0,n+1) {
  //   loop(x,0,n+1) {
  //     print(ACC[y][x], " ");
  //   }
  //   print("");
  // }

  loop(i,0,q) {
    int l,r; in(l),in(r);
    int cnt = ACC[r][r];
    cnt += ACC[l-1][l-1];
    cnt -= ACC[l-1][r];
    cnt -= ACC[r][l-1];
    // print(ACC[r][r]);
    // print(ACC[l-1][l-1]);
    // print(ACC[l-1][r]);
    // print(ACC[r][l-1]);
    print(cnt);
  }
  return 0;
}

#include<bits/stdc++.h>
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 Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

pair<int, bool> P[100001];
bool dame[100001];

pair<int, bool> Find(int A) {
	if (P[A].first < 0) return mp(A, 0);
	auto p = Find(P[A].first);
	P[A].first = p.first;
	P[A].second ^= p.second;
	return P[A];
}

bool Unite(int A, int B) {
	auto a = Find(A);
	auto b = Find(B);
	if (a.first == b.first) {
		if(a.second == b.second) dame[a.first] = true;
		return false;
	}
	if (P[a.first].first > P[b.first].first) swap(a, b);
	P[a.first].first += P[b.first].first;
	dame[a.first] |= dame[b.first];
	P[b.first] = mp(a.first, !(a.second ^ b.second));
	return true;
}

int Size(int A) {
	return -P[Find(A).first].first;
}

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

	int N = getint(), M = getint();
	rep1(i, N) P[i] = mp(-1, 0);
	rep(i, M) {
		int a = getint(), b = getint();
		Unite(a, b);
	}

	ll x = 0, y = 0, z = 0;
	rep1(i, N) {
		if (Find(i).first == i) {
			if (Size(i) > 1) {
				if (dame[i]) y++;
				else x++;
			}
			else z++;
		}
	}
	co(x * x + (x + y) * (x + y) + 2 * N * z - z * z);

	Would you please return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> cn(n + 1, 0);
  rep(i, n) cin >> a[i];
  cn[0] = 3;
  ll ans = 1;
  rep(i, n){
    if(cn[a[i]] <= 0){
      cout << 0 << endl;
      return 0;
    }
    ans *= cn[a[i]];
    ans %= MOD;
    cn[a[i]]--;
    cn[a[i] + 1]++;
  }
  cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;

int n, k;
int a[100010];
bitset<100010> al;
vector<int> adj[100010];
int ans = 0;
int dist[100010];

void dfs(int u){
    al[u] = true;
    dist[u] = 1;

    for(auto v : adj[u]){
        if(!al[v]){
            dfs(v);
            dist[u] = max(dist[u], dist[v] + 1);
        }
    }

    if(u != 1 && dist[u] == k && a[u] != 1) dist[u] = 0, ans++;
}

int main(){
    scanf("%d%d", &n, &k);

    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        if(i != 1) adj[a[i]].emplace_back(i);
    }

    if(a[1] != 1) ans++;

    dfs(1);

    printf("%d\n", ans);

    return 0;
}


#include <stdio.h>
#include <string.h>

int main(){
	int A, B, len;
	scanf("%d %d", &A, &B);
	char S[100];
	scanf("%s", &S);
	len = strlen(S);
	if(len != A+B+1){
		printf("No\n");
		return 0;
	}
	if(S[A] == '-'){
		for(int i=0; i<len; i++){
			if(i != A){
				if(S[i] < 48 || S[i] > 57){
					printf("No\n");
					return 0;
				}
			}
		}
		printf("Yes\n");
		return 0;
	}else{
		printf("No\n");
		return 0;
	}
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main() {
    int K = 0;
    vector<int> in(5, 0);
    for (int i = 0; i < 5; i++) cin >> in[i];
    cin >> K;
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            if (max(in[i], in[j]) - min(in[i], in[j]) > K && i != j) {
                printf("%s\n", ":(");
                return 0;
            }
        }
    }
    printf("%s\n", "Yay!");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

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

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

#define VACANT 0
#define BLOCK 1
#define START 2
#define GOAL 3

#define INF (1<<29)
#define MAX 21

int w, h;
int brd[MAX][MAX];
int ans;

int sx, sy;
int gx, gy;

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

void dfs(int depth, int y, int x)
{
/*
rep(j, h) {
	rep(i, w) {
		char ch;
		switch(brd[j][i]) {
		case VACANT: ch = '.'; break;
		case BLOCK: ch = '#'; break;
		}
		if (j == y && i == x)
			ch = 'X';
		if (j == gy && i == gx)
			ch = 'G';
		printf("%c ", ch);
	}
	puts("");
}
puts("-------");
*/
	if (depth >= 10) return;

	rep(i, 4) {
		REP(t, 1, max(w, h)) {
			int ny = y+dy[i]*t, nx = x+dx[i]*t;
			if (ny == gy && nx == gx) {
				ans = min(ans, depth+1);
				return;
			}
			if (!(0 <= ny && ny < h)) goto NEXT;
			if (!(0 <= nx && nx < w)) goto NEXT;
			if (t == 1 && brd[ny][nx] == BLOCK) goto NEXT;
			if (brd[ny][nx] == BLOCK) {
				int ty = ny-dy[i], tx = nx-dx[i];
				brd[ny][nx] = VACANT;
				dfs(depth+1, ty, tx);
				brd[ny][nx] = BLOCK;
				break;
			}
		}
NEXT:
		;
	}
}

int main(void)
{
	while (cin >> w >> h, w|h) {
		rep(j, h)
			rep(i, w) {
				cin >> brd[j][i];
				if (brd[j][i] == START) {
					brd[j][i] = VACANT;
					sx = i, sy = j;
				} else if (brd[j][i] == GOAL) {
					brd[j][i] = VACANT;
					gx = i, gy = j;
				}
			}

		ans = INF;
		dfs(0, sy, sx);
		printf("%d\n", ans==INF?-1:ans);
	}
	return 0;
}

// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

int di[] = {1, 0, -1, 0}, dj[] = {0, 1, 0, -1};

void solve() {
  for (;;) {
    vs s(12);
    rep(i, 12) if (!(cin >> s[i])) return;
    int c = 0;
    rep(i, 12) rep(j, 12) {
      function<void(int, int)> dfs = [&](int i, int j) {
        if (i < 0 || j < 0 || i >= 12 || j >= 12 || s[i][j] == '0') return;
        s[i][j] = '0';
        rep(k, 4) dfs(i + di[k], j + dj[k]);
      };
      c += s[i][j] == '1';
      dfs(i, j);
    }
    cout << c << endl;
  }
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
const ll INF = 1LL << 60;

int main() {

    int N,L;
    cin >> N >> L;

    int R[N];
    rep(i,N){
        R[i] = (L + i);
    }

    int abs_min = 10000;
    int abs_idx;
    rep(i,N){
        if(abs_min > (R[i]*R[i])){
            abs_min = (R[i]*R[i]);
            abs_idx = i;
        }
    }

    int sum = 0;
    rep(i,N){
        sum += R[i];
    }

    sum -= R[abs_idx];

    cout << sum << endl;

}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L;
  cin>>N>>L;
  int A;
  A=L;
  int R=A+N-1;
  int eat;
  if(R<=0){
    eat=R;
  }
  else if(L>=0){
    eat=L;
  }
  else{
    eat=0;
  }
  int ans=(R+L)*(R-L+1)/2-eat;
  cout<<ans<<endl;
}


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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

int main(){
  int n;
  cin >> n;
  int odd[100002]={}, even[100002]={};
  int omax=0, emax=0, io, ie;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    if(i%2==0){
      odd[a]++;
      if(odd[a]>omax){
        omax = odd[a];
        io = a;
      }
    }else{
      even[a]++;
      if(even[a]>emax){
        emax = even[a];
        ie = a;
      }
    }
  }
  sort(odd, odd+100000, greater<int>());
  sort(even, even+100000, greater<int>());
  int ans;
  if(io!=ie) ans = n - omax - emax;
  else ans = n - max(omax+even[1], odd[1]+emax);
  cout << ans << endl;
  return 0;
}

/*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const int N=1e5+5;
int read(){
	int s=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
	return s*f;
}
int n,m,a[N],num[2][N],f[2][2],g[2][2];
int main(){
//	freopen("_.in","r",stdin);
//	freopen("_.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++){a[i]=read();num[i&1][a[i]]++;}
	for(int t=0;t<2;t++){
		for(int i=1;i<N;i++){
			if(f[t][0]<=num[t][i]){
				f[t][1]=num[t][g[t][1]=g[t][0]];
				f[t][0]=num[t][g[t][0]=i];
			}
			else if(f[t][1]<=num[t][i]){
				f[t][1]=num[t][g[t][1]=i];
			}
		}
	}
	if(g[0][0]!=g[1][0])printf("%d\n",n-f[0][0]-f[1][0]);
	else printf("%d\n",min(n-f[0][0]-f[1][1],n-f[0][1]-f[1][0]));
	return 0;
}


#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T>
void chmax(T &a, T b){ a = max(a, b); };
template<typename T>
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int N, K, L;
vector<int> G[2][200000];

int d[2][200000];

int ans[200000];
map<P, int> m;
void bfs(int s, int c, int b){
	queue<int> q;
	q.push(s);
	d[b][s] = c;
	while(!q.empty()){
		int n = q.front(); q.pop();
		rep(i, G[b][n].size()){
			int to = G[b][n][i];
			if(d[b][to] == 0){
				d[b][to] = c;
				q.push(to);
			}
		}
	}
}
void solve(){
	rep(i, 2){
		int c = 1;
		rep(j, N){
			if(d[i][j] == 0){
				bfs(j, c, i);
				c++;
			}
		}
	}
	rep(i, N){
		m[P(d[0][i], d[1][i])]++;
	}
	rep(i, N){
		cout << m[P(d[0][i], d[1][i])] << (i == N - 1 ? '\n' : ' ');
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> K >> L;
	rep(i, K) {
		int p, q;
		cin >> p >> q;
		p--; q--;
		G[0][p].pub(q);
		G[0][q].pub(p);
	}
	rep(i, L) {
		int r, s;
		cin >> r >> s;
		r--; s--;
		G[1][r].pub(s);
		G[1][s].pub(r);
	}
	solve();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
    register int x=0;
    register char ch=getchar();
    while(ch<'0'||ch>'9')
        ch=getchar();
    while(ch>='0'&&ch<='9')
        x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x;
}
inline void write(int x)
{
	register char st[10];
	register int top=0;
	if(!x)
		putchar('0');
	while(x)
		st[++top]=(x%10)+48,x/=10;
   	while(top)
		putchar(st[top--]);
	putchar('\n');
}
const int N=200001;
int f1[N],f2[N];
int find(int x,int *f)
{
	return f[x]==x? f[x]:f[x]=find(f[x],f);
}
map<pair<int,int>,int>mp;
int main()
{
	register int n=read(),k=read(),l=read(),a,b;
	for(register int i=1;i<=n;++i)
		f1[i]=f2[i]=i;
	while(k--)
		if(find(a=read(),f1)!=find(b=read(),f1))
			f1[find(a,f1)]=find(b,f1);
	while(l--)
		if(find(a=read(),f2)!=find(b=read(),f2))
			f2[find(a,f2)]=find(b,f2);
	for(register int i=1;i<=n;++i)
		find(i,f1),find(i,f2);
	for(register int i=1;i<=n;++i)
		++mp[make_pair(f1[i],f2[i])];
	for(register int i=1;i<=n;++i)
		write(mp[make_pair(f1[i],f2[i])]);
	return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue;
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> vec){ return (ll)vec.size(); }
ll sz(string s){ return (ll)s.size(); }

ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }

int main(){
    ll n,m,q;
    cin >> n >> m >> q;
    ll imos[n][n] = {};

    rep(i,0,m){
        ll l,r;
        cin >> l >> r;
        imos[0][r-1] += 1;
        if(l != n) imos[l][r-1] -= 1;
    }

    rep(i,0,n) rep(j,1,n) imos[i][j] += imos[i][j-1];
    rep(j,0,n) rep(i,1,n) imos[i][j] += imos[i-1][j];

    rep(i,0,q){
        ll l,r;
        cin >> l >> r;
        cout << imos[l-1][r-1] << 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 ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(){
    int n,m;
    int s[6];
    char c[6];
    cin >> n >> m;
    rep(i,m)cin >> s[i] >> c[i];
    bool ok =false;

        rep(i,1000){
            string now = to_string(i);
            if(now.size()==n){
                ok = true;
                rep(j,m){
                    if(now[s[j]-1]!=c[j]){
                        ok = false;
                        break;
                    }
                }
            }
            if(ok){
                cout << stoi(now);
                return 0;
            }
        }

    cout << -1;

    return 0;
}


using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int CtoI(char c){
	if(c=='I')return 1;
	else if(c=='V')return 5;
	else if(c=='X')return 10;
	else if(c=='L')return 50;
	else if(c=='C')return 100;
	else if(c=='D')return 500;
	else if(c=='M')return 1000;
}
int main()
{
	string s;
	while(getline(cin,s)){
		int ans=0;
		for(int i=1;i<(int)s.length();i++){
			int x=CtoI(s[i-1]);
			if(x<CtoI(s[i]))ans-=x;
			else ans+=x;
		}
		ans+=CtoI(s[(int)s.length()-1]);
		cout<<ans<<endl;
	}
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int ans;
string str;

int main() {
	while ( ( cin >> str ) ) {
		ans = 0;
		for ( int i = 0; i < str.size(); i++ ) {
			if ( str[ i ] == 'M' ) {
				if ( ans % 1000 ) {
					ans += 800;
				}
				else {
					ans += 1000;
				}
			}
			else if ( str[ i ] == 'D' ) {
				if ( ans % 500 ) {
					ans += 300;
				}
				else {
					ans += 500;
				}
			}
			else if ( str[ i ] == 'C' ) {
				if ( ans % 100 ) {
					ans += 80;
				}
				else {
					ans += 100;
				}
			}
			else if ( str[ i ] == 'L' ) {
				if ( ans % 50 ) {
					ans += 30;
				}
				else {
					ans += 50;
				}
			}
			else if ( str[ i ] == 'X' ) {
				if ( ans % 10 ) {
					ans += 8;
				}
				else {
					ans += 10;
				}
			}
			else if ( str[ i ] == 'V' ) {
				if ( ans % 5 ) {
					ans += 3;
				}
				else {
					ans += 5;
				}
			}
			else {
				ans++;
			}
		}
		printf( "%d\n", ans );
	}
	return 0;
}


#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
	while(true){
		int a, b, c, N, i, j, t1, t2, t3, r;
		scanf("%d %d %d", &a, &b, &c);
		if(a == 0 && b == 0 && c == 0) return 0;
		scanf("%d", &N);

		vector< vector<int> > results;
		vector<int> ans(a+b+c+1, 2);

		for(i = 0;i < N;++i){
			vector<int> re;
			scanf("%d %d %d %d", &t1, &t2, &t3, &r);
			re.push_back(t1);re.push_back(t2);re.push_back(t3);re.push_back(r);
			results.push_back(re);

			if(r == 1){
				ans[t1] = 1;ans[t2] = 1;ans[t3] = 1;
			}
		}

		for(i = 0;i < N;++i){
			vector<int> re = results[i];
			if(re[3] == 0){
				if(ans[re[0]] == 1 && ans[re[1]] == 1){
					ans[re[2]] = 0;
				}else if(ans[re[1]] == 1 && ans[re[2]] == 1){
					ans[re[0]] = 0;
				}else if(ans[re[2]] == 1 && ans[re[0]] == 1){
					ans[re[1]] = 0;
				}
			}
		}

		for(i = 1;i < a+b+c+1;++i) printf("%d\n", ans[i]);
	}
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    int n;
    cin >> n;
    int a = 0, out = 0;
    int base[4] = {0};
    string s;
    while (cin >> s) {
        if (s == "HIT") {
            for (int i = 2; i >= 0; i--) {
                if (base[i]) base[i+1] = 1, base[i] = 0;
            }
            base[0] = 1;
            if (base[3]) {
                a++;
                base[3] = 0;
            }
        }else if (s == "HOMERUN") {
            REP(i,3) a += base[i];
            a++;
            REP(i,3) base[i] = 0;
        }else {
            out++;
        }
        if (out == 3) {
            cout << a << endl;
            out = 0;
            a = 0;
            REP(i,4) base[i] = 0;
        }
    }
}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n; cin >> n;
  int mi = n;
  for (int i = 1; i <= 5; i++) {
    int t; cin >> t;
    mi = min(mi, t);
  }
  cout << (n + mi - 1) / mi + 4 << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}

#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;

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

    int num[n-1];

    for (int i = 0; i < n; ++i)
    {
        cin >> num[i];
    }

    for (int i = 0; i < n; ++i)
    {
        if (i) cout << " ";
        cout << num[n-1-i];
    }
    cout << endl;
}


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

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

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, H, W;
    cin >> N >> H >> W;
    cout << max(0LL, N - H + 1) * max(0LL, N - W + 1) << endl;
    return 0;
}

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

int main(){
    int a,b;
    string s;
    vector<char> lst(10);
    cin>>a>>b>>s;
    bool ans=true;
    // for(int i=0;i<s.size();i++){
    //     cin>>lst.at(i);
    // {

    for(int i=0;i<s.size();i++){
        if (i!=a && s[i]=='-'){
            ans=false;
            break;
        }
        if (i==a && s[i]!='-'){
            ans=false;
            break;
        }
    }
    if(ans==true){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

class UnionFind{
private:
  vector<int> par, rank;
public:
  UnionFind(int n){
	par.assign(n, 0);
	rank.assign(n, 0);
	for(int i=0;i<n;++i)
	  par[i] = i;
  }

  //find root of x
  int find(int x){
	if(par[x] == x)
	  return x;
	return (par[x] = find(par[x]));
  }

  void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(rank[x] < rank[y])
	  par[x] = y;
	else{
	  par[y] = x;
	  if(rank[x] == rank[y])
		++rank[x];
	}
  }

  bool same(int x, int y){
	return find(x) == find(y);
  }
};

struct Edge{
  int to, cost;

  Edge(int t, int c): to(t), cost(c)
  {}
  bool operator>(const Edge& rhs) const{
	return cost > rhs.cost;
  }
  bool operator<(const Edge& rhs) const{
	return cost < rhs.cost;
  }
};
typedef vector< vector<Edge> > Graph;

void add_edge(Graph& graph, int u, int v, int cost){
  graph[u].push_back(Edge(v,cost));
  graph[v].push_back(Edge(u,cost));
}

int kruskal(const Graph& G){
  int N = SZ(G);
  UnionFind uf(N);
  vector<pair<Edge,int>> edges;
  REP(i,N) for(auto& e:G[i]){
	edges.push_back(MP(e, i));
  }
  sort(ALL(edges));

  int res = 0;
  for(int i=0,n=1;n<N;++i){
	auto& e = edges[i].first;
	int v = edges[i].second;
	if(!uf.same(e.to,v)){
	  uf.unite(e.to, v);
	  res += e.cost;
	  ++n;
	}
  }
  return res;
}

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

  int V, E; cin >> V >> E;
  Graph G(V);
  REP(i,E){
	int a, b, c; cin >> a >> b >> c;
	add_edge(G, a, b, c);
  }

  cout << kruskal(G) << endl;

  return 0;
}

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

constexpr int STR_MAX_LEN = 1000;

int main(){
    char s1[STR_MAX_LEN], s2[STR_MAX_LEN];
    int dp[STR_MAX_LEN + 1][STR_MAX_LEN + 1];
    scanf("%s%s", s1, s2);
    int s1_len = strlen(s1), s2_len = strlen(s2);

    for(int i = 1; i <= s1_len; ++i){
        dp[i][0] = i;
    }
    for(int i = 1; i <= s2_len; ++i){
        dp[0][i] = i;
    }

    for(int i = 1; i <= s1_len; ++i){
        for(int j = 1; j <= s2_len; ++j){
            if(s1[i - 1] == s2[j - 1]){
                dp[i][j] = dp[i - 1][j - 1];
            }
            else{
                dp[i][j] = std::min({dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + 1});
            }
        }
    }
    printf("%d\n", dp[s1_len][s2_len]);
    return 0;
}


#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>

//メイン関数
int main()
{
  char str[81];
   while(fgets(str,sizeof(str),stdin)!=NULL){
  // while(scanf("%[^/n]s",str)!=EOF){

    //strstrで探索
  if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that"))){
    printf("%s",str);
    continue;
  }
  int len=strlen(str);
    for(int i=1;i<=26;i++){
      for(int j=0;j<len;j++){
	if(str[j]>='a' && str[j]<='z'){
	  str[j]++;
	  if(str[j]=='{'){
	    str[j]='a';
	  }
	}
      }
      //strstrで探索
      if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that")))break;
    }
    printf("%s",str);
  }
   return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int main(){
    cin.sync_with_stdio(false);
    int n;
    while(cin >> n, n) {
        int key[n];
        rep(i, n) cin >> key[i];
        string s;
        cin >> s;
        int i = 0;
        rep(j, s.size()) {
            if ('a' <= s[j] && s[j] <= 'z') {
                if (key[i] <= 26) {
                    if (s[j] - 'a' >= key[i]) s[j] = (char)(s[j] - key[i]);
                    else s[j] = (char)('Z' - (key[i] - (s[j] - 'a') - 1));
                } else {
                    s[j] = (char)(s[j] + ('A' - 'a'));
                    if (s[j] - 'A' >= key[i] - 26) s[j] = (char)(s[j] - key[i] + 26);
                    else s[j] = (char)('z' - (key[i] - (s[j] - 'A') - 27));
                }
                i = (i + 1) % n;
            } else {
                if (key[i] <= 26) {
                    if (s[j] - 'A' >= key[i]) s[j] = (char)(s[j] - key[i]);
                    else s[j] = (char)('z' - (key[i] - (s[j] - 'A') - 1));
                } else {
                    s[j] = (char)(s[j] - ('A' - 'a'));
                    if (s[j] - 'a' >= key[i] - 26) s[j] = (char)(s[j] - key[i] + 26);
                    else s[j] = (char)('Z' - (key[i] - (s[j] - 'a') - 27));
                }
                i = (i + 1) % n;
            }
        }
        cout << s << endl;
    }

    return 0;
}