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

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

    reverse(B.begin(), B.end());
    int dup = -1;
    vector<int> dup_idx, avail_idx;
    for(int i=0; i<N; i++) if(A[i] == B[i]){
        dup = A[i];
        dup_idx.push_back(i);
    }
    for(int i=0; i<N; i++) if(A[i] != dup && B[i] != dup) avail_idx.push_back(i);

    if(dup_idx.size() > avail_idx.size()){
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    for(int i=0; i<int(dup_idx.size()); i++) swap(B[dup_idx[i]], B[avail_idx[i]]);
    for(int i=0; i<N; i++) cout << B[i] << " \n"[i==N-1];
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n),asum(n+1,0),bsum(n+1,0);
  rep(i,n){
    cin >> a[i];
    asum[a[i]]++;
  }
  rep(i,n){
    cin >> b[i];
    bsum[b[i]]++;
  }
  rep(i,n+1){
    if(asum[i] + bsum[i] > n){
      cout << "No\n";
      return 0;
    }
  }
  rep(i,n){
    asum[i+1] += asum[i];
    bsum[i+1] += bsum[i];
  }
  int d = 0;
  rep(i,n+1){
    d = max(asum[i]-bsum[i-1],d);
  }
  cout << "Yes\n";
  rep(i,n){
    cout << b[(n+i-d)%n] << " ";
  }
  return 0;
}


#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
vector< vector<int> > G(100002);
int n_v, n_e;
int prenum[100001], parent[100001], lowest[100001], n_child[100001];
bool is_cut[100001];

void dfs(int u, int f, int t_stamp){
    prenum[u] = t_stamp;
    parent[u] = f;
    lowest[u] = t_stamp;
    int v;
    for(int i=0; i<G[u].size(); i++){
        v = G[u][i];
        if(prenum[v]!=0){
            //this edge is a backedge
            lowest[u] = min(lowest[u], prenum[v]);
        }else{
            n_child[u] += 1;
            dfs(v, u, t_stamp+1);
            lowest[u] = min(lowest[u], lowest[v]);
        }
    }
    return;
}

int main(){

    scanf("%d %d", &n_v, &n_e);
    int u, v;
    for(int i=0; i<n_e; i++){
        scanf("%d %d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    memset(prenum, 0, sizeof(prenum));
    memset(parent, 255, sizeof(parent));
    memset(n_child, 0, sizeof(n_child));

    for(int i=0; i<n_v; i++){
        if(parent[i]==-1){
            dfs(i, -1, 1);
        }
    }

    memset(is_cut, 0, sizeof(is_cut));
    for(int i=0; i<n_v; i++){
        if(parent[i]==-1 && n_child[i]>=2)
            is_cut[i] = true;
        else if(prenum[parent[i]] <= lowest[i]){
            if(parent[parent[i]] == -1 && n_child[parent[i]]>=2){
                //the parent is a root
                is_cut[parent[i]] = true;
            }else if(parent[parent[i]] != -1){
                //the parent is not a root
                is_cut[parent[i]] = true;
            }
        }
    }

    for(int i=0; i<n_v; i++)
        if(is_cut[i])
            printf("%d\n", i);

    return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1000000007
/*
void dijkstra(vector<vector<pair<ll,int>>> &graph, vll &dist, int s){
    priority_queue<pair<ll,int>> que;
    dist[s]=0;
    que.push({0,s});
    while(!que.empty()){
        auto x=que.top(); que.pop();
        if(dist[x.second]<x.first) continue;
        for(auto v:graph[x.second]){
            if(dist[v.second]<dist[x.second]+v.first) continue;
            dist[v.second]=dist[x.second]+v.first;
            que.push({dist[v.second],v.second});
        }
    }
}
*/

void bfs(vector<vector<pair<ll,int>>> &graph, vll &dist, int s){
    queue<pair<ll,int>> que;
    dist[s]=0;
    que.push({0,s});
    while(!que.empty()){
        auto x=que.front(); que.pop();
        for(auto v:graph[x.second]){
            if(dist[v.second]!=-1) continue;
            dist[v.second]=dist[x.second]+v.first;
            que.push({dist[v.second],v.second});
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<pair<ll,int>>> graph(n);
    rep(i,n-1){
        int a,b;
        ll c;
        cin >> a >> b >> c;
        a--; b--;
        graph[a].push_back({c,b});
        graph[b].push_back({c,a});
    }
    vll dist(n,-1);
    int q,k;
    cin >> q >> k; k--;
    //dijkstra(graph,dist,k);
    bfs(graph,dist,k);
    rep(i,q){
        int x,y;
        cin >> x >> y;
        x--; y--;
        cout << dist[x]+dist[y] << endl;
    }

}


#include <iostream>
#include <vector>
#include <algorithm>
int main() {
    std::vector<int> v;
    std::vector<int> w;
    int n;
    std::cin >> n;
    while (n-- > 0) {
        int m;
        std::cin >> m;
        v.push_back(m);
    }
    std::cin >> n;
    while (n-- > 0) {
        int m;
        std::cin >> m;
        w.push_back(m);
    }
    int c = 0;
    for (auto&& e: w) {
        if (std::find(v.begin(), v.end(), e) != v.end()) {
            ++c;
        }
    }
    std::cout << c << std::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 <math.h> // sqrt
using namespace std;
typedef long long ll;

int main() {
    int N, Q;
    string S;
    cin >> N >> Q;
    cin >> S;
    vector<vector<int>> data(Q, vector<int>(2));
    for (int i = 0; i < Q; i++) {
        for (int j = 0; j < 2; j++) {
            cin >> data.at(i).at(j);
        }
    }
    vector<int> rsum(N + 1, 0);
    int sum = 0;
    for (int i = 0; i < N - 1; i++) {
        if (S.at(i) == 'A' && S.at(i + 1) == 'C') {
            sum++;
        }
        rsum.at(i + 1) = sum;
    }
    int ans;
    for (int i = 0; i < Q; i++) {
        ans = rsum.at(data.at(i).at(1) - 1) - rsum.at(data.at(i).at(0) - 1);
        cout << ans << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
int x[MAXN], st[MAXN][18];
int main()
{
    int n; scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
    int L, Q; scanf("%d%d", &L, &Q);
    // memset(st, 0x3f3f3f3f, sizeof(st));
    for (int i = 1; i <= n; i++)
        st[i][0] = min(n, (int)(upper_bound(x + 1, x + 1 + n, x[i] + L) - x - 1));

    for (int j = 1; j < 18; j++)
        for (int i = 1; i <= n; i++)
            st[i][j] = st[st[i][j - 1]][j - 1];
    while (Q--)
    {
        int l, r; scanf("%d%d", &l, &r);
        if (l > r) swap(l, r);
        int res = 0;
        for (int j = 17; j >= 0; j--)
            if (st[l][j] < r) res += (1 << j), l = st[l][j];
        printf("%d\n", res + 1);
    }
    return 0;
}

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

typedef long long LL;

const LL INF = 0x7ffffffff;
const LL NBDR = -2e7;
const LL BDR = 2e7;
const LL MAXN = 200;
LL G[MAXN][MAXN];

LL n, k, u, v, w;

void init()
{
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			G[i][j] = i == j ? 0 : INF;
}

void floyd()
{
	for(int k = 0; k < n; k++)
	{
		for(int i = 0; i < n; i++)
		{
			if(G[i][k] == INF)
				continue;
			for(int j = 0; j < n; j++)
			{
				if(G[k][j] == INF)
					continue;
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
			}
		}

	}
}

int main()
{
	while(scanf("%lld %lld", &n, &k) != EOF)
	{
		init();
		int flag = 0;
		while(k--)
		{
			scanf("%lld %lld %lld", &u, &v, &w);
			G[u][v] = w;
		}

		floyd();

		for(int i = 0; i < n; i++)
			if(G[i][i] < 0)
			{
				printf("NEGATIVE CYCLE\n");
				flag = 1;
				break;
			}

		if(flag == 1)
			continue;

		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				if(G[i][j] == INF && j < n-1)
					printf("INF ");
				else if(G[i][j] == INF && j < n)
					printf("INF");
				else if(G[i][j] != INF && j < n-1)
					printf("%lld ", G[i][j]);
				else if(G[i][j] != INF && j < n)
					printf("%lld", G[i][j]);
			}
			printf("\n");
		}
	}

	return  0;
}


#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

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

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

const int N = 2e5 + 5;
int a[N];

void solve() {
	int n;
    sc(n);
    fr(i, 0, n - 1) {
        sc(a[i]);
        a[i] = i - a[i];
        debug(a[i]);
    }
    if(a[0] != 0) {
        cout << -1;
        return;
    }
    fr(i, 0, n - 2) {
        if(a[i] > a[i + 1]) {
            cout << -1;
            return;
        }
    }
    ll ans = n - 1 - a[n - 1];
    rf(i, n - 1, 1) {
        if(a[i] != a[i - 1]) { ans += i - 1 - a[i - 1]; debug(i - 1, ans); }
    }
    cout << ans;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin>>n&&n){
    int ans = 0;
    vary(int,dp,n+3,0);
    dp[1]=1,dp[2]=2,dp[3]=4;
    REP(i,1,n+1){
      if(i > 3){
        REP(j,1,4){
          dp[i] += dp[i-j];
        }
      }
      ans += dp[i]/3650;
    }
    cout << 1+ dp[n] / 3650<<endl;
  }
  return 0;
}


#include <iostream>
using namespace std;

struct Dice
{
	Dice(int d[6]){
		for(int i = 0; i < 6; ++i)
			n[i] = d[i];
	}
	void toN(){ shift( n[0], n[1], n[5], n[4] ); }
	void toS(){ shift( n[0], n[4], n[5], n[1] ); }
	void toW(){ shift( n[0], n[2], n[5], n[3] ); }
	void toE(){ shift( n[0], n[3], n[5], n[2] ); }
	void shift( int& a, int& b, int& c, int& d ){
		int t = a;
		a = b;
		b = c;
		c = d;
		d = t;
	}
	int n[6];
};

int main()
{
	int i, d[6] = {};
	for(i = 0; i < 6; ++i)
		cin >> d[i];

	Dice dice(d);
	char c;
	cin.get(c);
	while( cin.get(c) ){
		if( c == '\n' )
			break;
		switch(c)
		{
		case 'N': dice.toN(); break;
		case 'S': dice.toS(); break;
		case 'W': dice.toW(); break;
		case 'E': dice.toE(); break;
		}
	}

	cout << dice.n[0] << "\n";

	return 0;
}

#include<iostream>
using namespace std;
int main () {
    long n, b, min, max;
    long total = 0;
    min = 1000000;
    max = -1000000;
    cin >> n;
    for(int i=0; i < n; i++) {
        cin >> b;
        if (b < min) {
            min = b;
        }
        if (b > max) {
            max = b;
        }
        total = total + b;
    }
    cout << min << " " << max << " " << total << endl;
    return 0;
}


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

int main(){
    int n;
    vector<int> array;

    cin >> n;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        array.push_back(a);
    }

    for(int i=array.size()-1; i>=1; i--){
        cout << array[i] << " ";
    }cout << array[0] << endl;

    return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    string S;
    int w;
    cin >> S >> w;
    int cnt = 0;
    rep(i,SZ(S)){
        if(cnt % w == 0){
            cout << S[cnt];
        }
        cnt++;
    }
    cout << enld;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a*b;
}

#include<iostream>
#include<cstring>
using namespace std;
double eps = 1e-5;
int main() {
    long long a;
    double b;
    string s;
    cin >> a;
    cin >> b;
    cout <<  (long long)(a * (long long)(b*100 + eps * 100)) / 100;
   // system("pause");
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

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

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;

int main() {
//	cout << fixed << setprecision(15);
    int n;
    cin >> n;
    vvi a(n, vi(n));
    rep(i, n) rep(j, n) cin >> a[i][j];

    vll sc(1 << n);
    rep(i, 1 << n) {
        rep(j, n) for(int k = j; k < n; k++) {
            if(!((1 << j) & i && (1 << k) & i)) continue;
            sc[i] += a[j][k];
        }
    }

    vll dp(1 << n, -INFL);
    dp[0] = 0;
    rep(use, 1 << n) {
        int unuse = ((1 << n) - 1) & (~use);
        for(int i = unuse; i > 0; i = (i - 1) & unuse) {
            if(i <= use) continue;
            chmax(dp[use | i], dp[use] + sc[i]);
        }
    }
    cout << dp[(1 << n) - 1] << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

template< typename T >
struct edge {
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}

    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const int &x) {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

signed main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N + 1), GR(N + 1);
    Edges<int> edges;
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        G[A].push_back(B);
        GR[B].push_back(A);
        edges.emplace_back(A, B, -1);
    }
    if (M == 0) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> dist1(N + 1, INF);
    dist1[edges.begin()->src] = 0;
    dist1[edges.rbegin()->src] = 0;
    for(int i = 1; i <= N * 2; i++) {
        for(auto &e : edges) {
            if(dist1[e.src] == INF) continue;
            dist1[e.to] = min(dist1[e.to], dist1[e.src] + e.cost);
        }
    }
    vector<int> dist2(N + 1); copy(dist1.begin(), dist1.end(), dist2.begin());
    for(int i = 1; i <= N * 2; i++) {
        for(auto &e : edges) {
            if(dist2[e.src] == INF) continue;
            dist2[e.to] = min(dist2[e.to], dist2[e.src] + e.cost);
        }
    }
    if (dist1 == dist2) {
        cout << -1 << endl;
        return 0;
    }
    int s = 0, count = INF;
    vector<map<int, int>> res(N + 1);
    for (int i = 1; i <= N; i++) {
        vector<bool> check(N + 1, false);
        queue<int> explore;
        vector<int> dist(N + 1, INF);
        explore.push(i);
        dist[i] = 0;
        check[i] = true;
        while (!explore.empty()) {
            int now = explore.front();
            explore.pop();
            for (auto next : G[now]) {
                if (dist[next] > dist[now] + 1) {
                    dist[next] = dist[now] + 1;
                    res[i][next] = now;
                }
                if (check[next]) continue;
                check[next] = true;
                explore.push(next);
            }
            if (now == i) dist[i] = INF;
        }
        if (dist[i] < count) {
            s = i;
            count = dist[i];
        }
    }
    vector<int> ans = {s};
    int next = res[s][s];
    while (next != s) {
        ans.push_back(next);
        next = res[s][next];
    }
    cout << ans.size() << endl;
    for (auto temp : ans) cout << temp << endl;
}

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

vector<int> G[200005];
int aoki_d[200005], takahashi_d[200005];
bool is_end[200005];

void dfs(int u, bool is_aoki, int p=-1) {
  for (int v : G[u]) {
    if (v == p) continue;
    if (is_aoki) aoki_d[v] = aoki_d[u] + 1;
    else takahashi_d[v] = takahashi_d[u] + 1;
    dfs(v, is_aoki, u);
  }
  is_end[u] = G[u].size() == 1;
}

int main() {
  int n, u, v;
  cin >> n >> u >> v;
  --u; --v;
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(u, false);
  dfs(v, true);
  int ans = 0;
  rep(i, n) {
    if (takahashi_d[i] <= aoki_d[i] && !is_end[i]) {
      ans = max(ans, aoki_d[i]);
    }
  }
  cout << ans << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 998244353
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

vector<ll> bi(5010101);

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

ll comb(ll s,ll t){
    ll q=bi[s]*modinv(bi[t]);
    q%=Mod;
    q*=modinv(bi[s-t]);
    q%=Mod;
    return q;
}

int main(){
    ll i,j;
    ll n,m;
    cin>>n>>m;

    bi[0]=1;

    for(i=1;i<5010101;i++){
        bi[i]=bi[i-1]*i;
        bi[i]%=Mod;
    }

    ll ans1=comb(3*m+n-1,n-1);
    ll ans2=n*comb(m+n-2,n-1);

    ans2%=Mod;

    ll hoge=(ans1-ans2+Mod)%Mod;

    if(n<=m) cout<<hoge<<endl;
    else{
        ll l;
        ll ans3=0;
        for(l=m+1;l<=min(3*m,n);l++){
            if((3*m-l)%2==0) {
                ans3+=comb(n,l)*comb((3*m-l)/2+n-1,n-1);
                ans3%=Mod;
            }
        }

         cout<<(hoge+Mod-ans3)%Mod<<endl;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pi;

#define fi first
#define se second

int read() {
  int res = 0, w = 1; char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), w = -1;
  while (isdigit(c)) res = (res << 1) + (res << 3) + c - '0', c = getchar();
  return res * w;
}

const int Mod = 998244353;

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

int sub(int a, int b) { return (a -= b) < 0 ? a + Mod : a; }

int mul(int a, int b) { return 1ll * a * b % Mod; }

int fast_pow(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1) res = mul(res, a);
  return res;
}

const int N = 3e6 + 10;

int fac[N], inv[N];

void init(int n = N - 1) {
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
  inv[n] = fast_pow(fac[n], Mod - 2);
  for (int i = n - 1; i >= 1; i--) inv[i] = mul(inv[i + 1], i + 1);
}

int C(int a, int b) { return a >= b ? mul(fac[a], mul(inv[b], inv[a - b])) : 0;}

int main() {
#ifdef dream_maker
//  freopen("tst.in", "r", stdin);
#else
  //freopen(".in", "r", stdin);
  //freopen(".out", "w", stdout);
#endif
  init();
  int n = read(), m = read(), ans = 0;
  for (int i = 0; i <= m; i++) if ((3 * m - i) & 1 ^ 1) {
    ans = add(ans, mul(C(n, i), C(((3 * m - i) >> 1) + n - 1, n - 1)));
  }
  ans = sub(ans, mul(n, C(m - 1 + n - 1, n - 1)));
  cout << ans << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    vector<string> s(100, string(100, '#'));
    rep(i, 50) rep(j, 100) s[i][j] = '.';

    int cnt = 0;
    for (int i = 0; i < 50; i += 2) {
        if (cnt == b - 1) break;
        for (int j = 0; j < 100; j += 2) {
            if (cnt == b - 1) break;
            s[i][j] = '#';
            cnt++;
        }
    }

    cnt = 0;
    for (int i = 51; i < 100; i += 2) {
        if (cnt == a - 1) break;
        for (int j = 0; j < 100; j += 2) {
            if (cnt == a - 1) break;
            s[i][j] = '.';
            cnt++;
        }
    }

    printf("100 100\n");
    for (auto &line: s) cout << line << endl;

}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

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

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    const int w = 52;
    const int h = 100;
    char field[h][w];
    int a, b;
    cin >> a >> b;
    a--, b--;

    rep(i, h / 2)
    {
        rep(j, w)
            field[i][j] = '.';
    }
    rep(i, h / 2)
    {
        rep(j, w)
            field[i + h / 2][j] = '#';
    }

    rep(i, 20)
    {
        if (b == 0)
            break;
        else
        {
            rep(j, 25)
            {
                if (b == 0)
                    break;
                else
                {
                    field[2 * i + 1][2 * j + 1] = '#';
                    b--;
                }
            }
        }
    }

    rep(i, 20)
    {
        if (a == 0)
            break;
        else
        {
            rep(j, 25)
            {
                if (a == 0)
                    break;
                else
                {
                    field[2 * i + h / 2 + 1][2 * j + 1] = '.';
                    a--;
                }
            }
        }
    }

    cout << h << " " << w << endl;
    rep(i, h)
    {
        rep(j, w)
                cout
            << field[i][j];
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int INF=INT_MAX;

struct lst
{
    private:
        int n;
        vector<int> node;
        vector<int> lazy;
        vector<bool> lflg;
    public:
        lst(int sz)
        {
            n=1; while(n<sz) n*=2;
            node.resize(2*n-1, INF);
            lazy.resize(2*n-1, 0);
            lflg.resize(2*n-1, false);
        }
    void lazy2node(int k, int l, int r)
    {
        if(lflg[k])
        {
            node[k]=lazy[k];
            lflg[k]=false;
            prop(k, l, r);
        }
    }
    void prop(int k, int l, int r)
    {
        if (r-l>0)
        {
            lazy[2*k+1]=lazy[2*k+2]=node[k];
            lflg[2*k+1]=lflg[2*k+2]=true;
        }
    }

    void update(int qa, int qb, int v, int k=0, int l=0, int r=-1)
    {
        if(r<0) r=n-1;
        lazy2node(k, l, r);
        if(qb<l || r<qa) return;
        if(qa<=l && r<=qb)
        {
            node[k] = v;
            prop(k, l, r);
        }
        else
        {
            int m=(l+r)/2;
            update(qa, qb, v, 2*k+1, l, m);
            update(qa, qb, v, 2*k+2, m+1, r);
        }
    }

    int get(int qa, int qb, int k=0, int l=0, int r=-1)
    {
        if(r<0) r=n-1;
        lazy2node(k, l, r);
        if(qb<l || r<qa) return INF;
        if(qa<=l && r<=qb) return node[k];
        else
        {
            int m=(l+r)/2;
            int lv = get(qa, qb, 2*k+1, l, m);
            int lr = get(qa, qb, 2*k+2, m+1, r);
            return min(lv, lr);
        }
    }
};

int main()
{
    int n, q;
    scanf("%d %d", &n, &q);
    lst tree = lst(n);
    for(int i=0; i<q; i++)
    {
        int t;
        scanf("%d", &t);
        if(t)
        {
            int s;
            scanf("%d", &s);
            printf("%d\n", tree.get(s,s));
        }
        else
        {
            int s, t, v;
            scanf("%d %d %d", &s, &t, &v);
            tree.update(s, t, v);
        }
    }
    return 0;
}

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

#define SEG_NUM (1<<20)

pair<long, long> seg[SEG_NUM*2];

long find(int i){
    i += SEG_NUM;
    long ans = 2147483647;
    int time = 0;
    while(i > 0){
        if(time < seg[i].first) {
            ans = seg[i].second;
            time = seg[i].first;
        }
        i /= 2;
    }
    return ans;
}

void update(int s, int t, long x, long time){
    s += SEG_NUM;
    t += SEG_NUM;
    while(s < t){
        if(s % 2 == 1){
            seg[s].first = time;
            seg[s].second = x;
            s++;
        }
        s /= 2;
        if(t % 2 == 1){
            seg[t-1].first = time;
            seg[t-1].second = x;
            t--;
        }
        t /= 2;
    }
}

int main() {
    for(long i=0;i<2*SEG_NUM;++i){
        seg[i] = make_pair(0, 2147483647);
    }
    int n, q;
    cin>>n>>q;
    long query, s, t, x, i;
    for(int time=0;time<q;++time){
        cin>>query;
        if(query){
            cin>>i;
            cout<<find(i)<<endl;
        }
        else {
            cin>>s>>t>>x;
            update(s, t+1, x, time+1);
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main() {
 int n,m,counter,subcounter;
 string strn,strm;
 cin >> n;
 subcounter = 0;
 vector<string> vecn(0);
 vector<string> vecm(0);
 for (int i = 0; i < n; i++) {
   cin >> strn;
   vecn.push_back(strn);
 }
 cin >> m;
 for (int i = 0; i < m; i++) {
   cin >> strm;
   vecm.push_back(strm);
 }
 for (int i = 0; i < n; i++) {
   counter = 0;
   for (int j = 0; j < n; j++) {
     if  (vecn.at(i) == vecn.at(j)) {
       counter++;
     }
   }
   for (int j = 0; j < m; j++) {
     if (vecn.at(i) == vecm.at(j)) {
       counter = counter -1;
     }
   }
   if (counter > subcounter) {
     subcounter = counter;
   }
 }
 if (subcounter <= 0 ) {
   subcounter = 0;
 }

 cout << subcounter;
}

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

int main(){
  int dice[6],i,dif[6],len;
  string str;
  /********サイコロの目の入力*********/
  for(i = 0 ; i < 6 ; i++)
    {
      cin >> dice[i];
    }
  cin >> str;
  len = str.size();
  for ( int j = 0 ; j < len ; j++){
    if(str[j] == 'S')
      {
	dif[0] = dice[4];
	dif[1] = dice[0];
	dif[2] = dice[2];
	dif[3] = dice[3];
	dif[4] = dice[5];
	dif[5] = dice[1];
      }
    else if (str[j] == 'W')
      {
	dif[0] = dice[2];
	dif[1] = dice[1];
	dif[2] = dice[5];
	dif[3] = dice[0];
	dif[4] = dice[4];
	dif[5] = dice[3];
      }
    else if(str[j] == 'E')
      {
	dif[0] = dice[3];
	dif[1] = dice[1];
	dif[2] = dice[0];
	dif[3] = dice[5];
	dif[4] = dice[4];
	dif[5] = dice[2];
      }
    else if (str[j] == 'N')
      {
	dif[0] = dice[1];
	dif[1] = dice[5];
	dif[2] = dice[2];
	dif[3] = dice[3];
	dif[4] = dice[0];
	dif[5] = dice[4];
      }

    for( i = 0 ; i < 6 ; i++)
      {
	dice[i] = dif[i];
      }
  }
  cout << dice[0] << endl;
  return 0;
}


#include <iostream>
using namespace std;
int main(void){
    // Your code here!]
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = a + b;
    int ans1 = c + d;
    if(ans > ans1){
        cout << "Left" << endl;
    }
    else if(ans == ans1){
        cout << "Balanced" << endl;
    }
    else {
        cout << "Right" << endl;
    }
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a[5];
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a, a + 3);
    if(a[0] == a[2]) return cout << "No", 0;
    for(int i = 1; i < 3; i++) if(a[i] == a[i - 1]) return cout << "Yes", 0;
    cout << "No";

    return 0;
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;

int main(){
    ll N, L;
    cin >> N >> L;

    if(L <= 0 && L + N - 1 > 0){
        cout << N * (L + L + N - 1) / 2 << endl;
    }else if(L + N - 1 <= 0){
        cout << (N - 1) * (L + L + N - 2) / 2 << endl;
    }else{
        cout << (N - 1) * (L + 1 + L + N - 1) / 2 << endl;
    }

    return 0;
}

#include <bits/stdc++.h>
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    int n, k; cin >> n >> k;
    vector<int> v(n);
    int og = 0;
    for(int i = 0; i < n; ++i){
        v[i] = k + i;
        og += v[i];
    }
    int index = 0;
    int maxi = INT_MAX;
    for(int i = 0; i < n; ++i){
        int dif = og - v[i];
        int dist = abs(og - dif);
        if(maxi > dist){
            maxi = dist;
            index = i;
        }
    }
    cout << og - v[index] << '\n';
    return 0;
}


#define LOCAL
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (ll)s; i < (ll)n; i++)
#define rrep(i,n,e) for (int i = (ll)n; i > (ll)e; i--)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // dist between two elements
// #define M_PI 3.14159265358979323846 // CF
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) cout << fixed << setprecision(10) << x << endl; // 小数点を10桁まで表示
#define endl "\n"
#define Case(x) printf("Case #%d: ", x); // gcj

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<char> vch;
typedef vector<vector<char>> vvch;

constexpr ll LINF = 1001002003004005006ll;
constexpr int INF = 1001001001;
constexpr int n_max = 2e5+10;

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

template<class T, class U>
T POW(T x, U n) {T ret=1; while (n>0) {if (n&1) {ret*=x;} x*=x; n>>=1;} return ret;};

// debug
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';};
string to_string(const char c) {return to_string((string) &c);};
string to_string(bool b) {return (b ? "true" : "false");};
template <size_t N>
string to_string(bitset<N> v){
  string res = "";
  for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
  return res;
};
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for(const auto &x : v) {
    if(!first) res += ", ";
    first = false; res += to_string(x);
  }
  res += "}";
  return res;
};
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;};
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); };

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 71
#endif

void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
};

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
};

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
};

PI solve(string &s) {
  int n = s.size();
  vvi table(26);
  rep(i, 0, 26) {
    char ch = 'a'+i;
    rep(j, 0, n) {
      if (s[j] == ch) table[i].pb(j);
    }
  }

  rep(i, 0, 26) {
    rep(j, 0, table[i].size()-1) {
      if (table[i][j+1]-table[i][j] < 3) {
        return make_pair(table[i][j]+1,table[i][j+1]+1);
      }
    }
  }

  return make_pair(-1, -1);
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  PI ans = solve(s);
  cout << ans.first << " " << ans.second << endl;

  return 0;
};

#include <cstdint>
#include <algorithm>
#include <vector>
#include <string>

int main() {
  char buf[131072];
  scanf("%s", buf);
  std::string s = buf;

  for (size_t i = 1; i < s.length(); ++i)
    if (s[i-1] == s[i])
      return !printf("%zu %zu\n", i, i+1);

  for (size_t i = 1; i+1 < s.length(); ++i)
    if (s[i-1] == s[i+1])
      return !printf("%zu %zu\n", i, i+2);

  puts("-1 -1");
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    int sum=0;
    for(int i=v.size()-1;i>=n-k;i--)
    {
        sum+=v[i];
    }
    cout<<sum;
}

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

int main(){
  int N;
  string S;
  cin>>N>>S;
  vector<int> a(N),b(N);
  int j=0;
  for(int i=0;i<N;i++){
    int k=0;
    if(S.at(i)=='E')
      k=1;
    j+=k;
    a.at(i)=j;
    b.at(i)=i+1-j;
  }
  j=a.at(N-1)-a.at(0);
  for(int i=1;i<N;i++){
    int k=b.at(i-1)+a.at(N-1)-a.at(i);
    j=min(j,k);
  }
  cout<<j<<endl;
}


#include<iostream>
#include<vector>
using namespace std;
typedef unsigned long long int ull;
vector<ull> allPrimes;

void sieve(int n)
{
    vector<bool> prime(n+1, true);
    for (int p=2; p*p<=n; p++) {
        if (prime[p] == true) {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
        if (prime[p])
            allPrimes.push_back(p);
}
ull factorialDivisors(ull n)
{
    sieve(n);
    ull result = 1;
    for (int  i=0; i < allPrimes.size(); i++)
    {
        ull p = allPrimes[i];
        ull exp = 0;
        while (p <= n)
        {
            exp = exp + (n/p);
            p = p*allPrimes[i];
        }
        result = (result*(exp+1))%1000000007;
    }
    return result;
}

int main()
{
    int n; cin>>n;
    cout << factorialDivisors(n);
    return 0;
}

#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end()
#define rep(i, K, N)  for(long long int i = K; i <= N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

map<ll, ll> M;

void prime_factor(ll N){

bool C = 1;

while(C){

C = 0;

    rep(i, 2, sqrt(N)){

    if(N%i == 0){M[i]++;N /= i;C = 1;break;}

    }

}

M[N]++;

}

int main() {
ll N, Ans = 1;cin >> N;

rep(i, 2, N){

  prime_factor(i);

}

for(auto x : M ){

  Ans *= x.second + 1;Ans %= PP;

}

cout << Ans;

}


#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 <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926

int a[3];

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

}


#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector<s>
#define vvec(s) vector<vector<s>>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    out(a << " " << b << " " << c);
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  string s;
  cin >> k >> s;
  int len;
  len=s.size();
  if(len<=k){
    cout << s << endl;
    return 0;
  }else{
    for(int i=0;i<k;i++){
      cout << s.at(i);
    }
  }
  cout << "..." << endl;
}


#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << endl
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  init();
  ll N, u, v;
  cin >> N >> u >> v;
  u--;
  v--;

  vvll to(N);
  rep(i, N - 1) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].pb(b);
    to[b].pb(a);
  }

  queue<P> q1;
  q1.push({u, 1});
  vll d1(N);
  while (!q1.empty()) {
    ll index = q1.front().first;
    ll distance = q1.front().second;
    q1.pop();
    if (d1[index] != 0) continue;
    d1[index] = distance;
    rep(i, to[index].size()) {
      q1.push({to[index][i], distance + 1});
    }
  }

  debugV(d1);

  queue<P> q2;
  q2.push({v, 1});
  vll d2(N);
  while (!q2.empty()) {
    ll index = q2.front().first;
    ll distance = q2.front().second;
    q2.pop();
    if (d2[index] != 0) continue;
    d2[index] = distance;
    rep(i, to[index].size()) {
      q2.push({to[index][i], distance + 1});
    }
  }

  debugV(d2);

  ll ans = 0;
  rep(i, N) {
    if (d1[i] < d2[i]) ans = max(ans, d2[i]);
  }
  ans--;
  ans--;
  COUT(ans);
  return 0;
}

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

int main(){
    int N,u,v;
    cin >> N >> u >> v;
    vector<vector<int>> A(N);
    for(int i=0;i<N-1;i++){
        int a,b;cin>>a>>b;
        A[a-1].push_back(b-1);
        A[b-1].push_back(a-1);
    }
    queue<int> q1;
    q1.push(u-1);
    vector<int> D1(N,-1);
    D1[u-1]=0;
    while(q1.size()){
        int f=q1.front();
        q1.pop();
        for(int a:A[f]){
            if(D1[a]==-1){
                D1[a]=D1[f]+1;
                q1.push(a);
            }
        }
    }
    queue<int>q2;
    q2.push(v-1);
    vector<int>D2(N,-1);
    D2[v-1]=0;
    while(q2.size()){
        int f=q2.front();
        q2.pop();
        for(int a:A[f]){
            if(D2[a]==-1){
                D2[a]=D2[f]+1;
                q2.push(a);
            }
        }
    }

    vector<int> NG(N,0);
    int M=0,Mi=-1;
    for(int i=0;i<N;i++){
        NG[i]=(D2[i]-D1[i]<0);
        if((!NG[i]) && M<D2[i]){
            M=D2[i];
            Mi=i;
        }
    }
    if(NG[u-1]){
        cout << 0;
        return 0;
    }
    cout << D1[Mi]+(D2[Mi]-D1[Mi])-1 << "\n";
}


#include<stdio.h>
using namespace std;
const int sss=1<<21;
int n;
int a[1000][1000];
int d[1000],p[10000],color[1000];
int prim(){
	int u,minv;
	for(int i=0;i<n;i++){
		d[i]=sss;
		p[i]=-1;
	}
	d[0]=0;
	while(1){
		minv=sss;
		u=-1;
		for(int i=0;i<n;i++){
			if(minv>d[i]&&color[i]!=1){
				u=i;
				minv=d[i];
			}
		}
		if(u==-1) break;
		color[u]=1;
		for(int v=0;v<n;v++){
			if(color[v]!=1&&a[u][v]!=sss){
				if(d[v]>a[u][v]){
					d[v]=a[u][v];
					p[v]=u;
				}
			}
		}
	}
	int sum=0;
	for(int i=0;i<n;i++){
		if(p[i]!=-1) {
			sum+=a[p[i]][i];
		}
	}
	return sum;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int e;scanf("%d",&e);
			a[i][j]=e==-1?sss:e;
		}
	}
	printf("%d\n",prim());
	return 0;
}

#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)    {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for((i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(1){}else
#define drep(i,n)    if(1){}else
#define dstop()      if(1){}else
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF  (0x7fffffff)
#else
#define LINF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}
#define UNION_FIND_MAX_N (112345)
int union_find_par[UNION_FIND_MAX_N];
int union_find_rank[UNION_FIND_MAX_N];

void init(int n)
{
  int i;
  for(i=0;i<n;i++)
    {
      union_find_par[i]=i;
      union_find_rank[i]=0;
    }
}

int find(int x)
{
  if(union_find_par[x]==x)
    return x;
  else
    return union_find_par[x]=find(union_find_par[x]);
}

void unite(int x,int y)
{
  x=find(x);
  y=find(y);
  if(x==y)
    return;
  if(union_find_rank[x]<union_find_rank[y])
    union_find_par[x]=y;
  else
    union_find_par[y]=x;
  if(union_find_rank[x]==union_find_rank[y])
    union_find_rank[x]++;
}

int nsame(int x,int y)
{
  return find(x)!=find(y);
}

typedef struct edge
{
  int u;
  int v;
  int cost;
  bool operator>(const edge&right)const
  {
    return cost>right.cost;
  }
  bool operator<(const edge&right)const
  {
    return cost<right.cost;
  }
}Edge;

signed main(void)
{
  int n;
  Edge edge[112345]={};
  int i,j,k=0;
  int sum=0;
  cin>>n;
  init(n);
  rep(i,n)rep(j,n)
    {
      cin>>edge[k].cost;
      edge[k].u=i;
      edge[k].v=j;
      k++;
    }
  sort(edge,edge+k);
  rep(i,k)
    if(edge[i].cost!=-1)
      if(nsame(edge[i].u,edge[i].v))
	unite(edge[i].u,edge[i].v),sum+=edge[i].cost;

  cout<<sum<<endl;
  return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define si short int
using namespace std;
const int N=101;
si n,m,x,y,ans,dp[N][N][N][N],sum[N][N];
char g[N][N];
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
template<typename I>inline I mx(const I&a,const I&b){return a>b ? a : b;}
template<typename I>inline I mi(const I&a,const I&b){return a<b ? a : b;}
template<typename I>inline void swp(I&a,I&b){I t=a; a=b; b=t;}
inline void cmx(si &a,si b){if(b>a) a=b;}
inline si s(int a,int b,int c,int d){
	if(a>c) swp(a,c); if(b>d) swp(b,d);
	return sum[c][d]-sum[c][b-1]-sum[a-1][d]+sum[a-1][b-1];
}
int main()
{
//	freopen("Salvage Robots.in","r",stdin);
	read(n,m);
	for(RG int i=1;i<=n;i++)
	{
		scanf("%s",g[i]+1);
		for(RG int j=1;j<=m;j++)
		{
			if(g[i][j]=='o') sum[i][j]=1;
			else if(g[i][j]=='E') x=i, y=j;
			sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
		}
	}
	for(int i=x;i;i--)
	 for(int j=y;j;j--)
	  for(int k=x;k<=n;k++)
	   for(int l=y;l<=m;l++)
	   {
			ans=mx(ans,dp[i][j][k][l]);
			int li=l-y+1, ri=m-y+j, us=k-x+1, ds=n-x+i;
			if(i-1>=us) cmx(dp[i-1][j][k][l],dp[i][j][k][l]+s(i-1,mx(li,j),i-1,mi(ri,l)));
			if(j-1>=li) cmx(dp[i][j-1][k][l],dp[i][j][k][l]+s(mx(i,us),j-1,mi(k,ds),j-1));
			if(k+1<=ds) cmx(dp[i][j][k+1][l],dp[i][j][k][l]+s(k+1,mx(li,j),k+1,mi(ri,l)));
			if(l+1<=ri) cmx(dp[i][j][k][l+1],dp[i][j][k][l]+s(mx(i,us),l+1,mi(k,ds),l+1));
	   }
	cout<<ans<<endl;
	return 0;
}

#include <algorithm>
#include <cstdio>
char str[105];
int row_pre[105][105], col_pre[105][105], dp[105][105][105][105];
int main()
{
	// freopen("AGC004-E.in", "r", stdin);
	int n, m, x, y;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
	{
		scanf("%s", str);
		for (int j = 0; j < m; j++)
		{
			row_pre[i][j] = (j ? row_pre[i][j - 1] : 0) + (str[j] == 'o');
			col_pre[i][j] = (i ? col_pre[i - 1][j] : 0) + (str[j] == 'o');
			if (str[j] == 'E')
			{
				x = i;
				y = j;
			}
		}
	}
	auto calc_row = [&] (int idx, int l, int r)
	{
		int ll = std::max(l, r - y), rr = std::min(r, m - 1 - y + l);
		if (ll > rr)
			return 0;
		return row_pre[idx][rr] - (ll ? row_pre[idx][ll - 1] : 0);
	};
	auto calc_col = [&] (int idx, int l, int r)
	{
		int ll = std::max(l, r - x), rr = std::min(r, n - 1 - x + l);
		if (ll > rr)
			return 0;
		return col_pre[rr][idx] - (ll ? col_pre[ll - 1][idx] : 0);
	};
	auto upd = [&] (int &a, const int &b)
	{
		if (a < b)
			a = b;
	};
	for (int i = 0; i <= x; i++)
	{
		for (int j = n - 1; j >= x; j--)
		{
			for (int k = 0; k <= y; k++)
			{
				for (int t = m - 1; t >= y; t--)
				{
					if (i > j - x)
						upd(dp[i][j][k][t], dp[i - 1][j][k][t] + calc_row(i - 1, k, t));
					if (j < n - 1 - x + i)
						upd(dp[i][j][k][t], dp[i][j + 1][k][t] + calc_row(j + 1, k, t));
					if (k > t - y)
						upd(dp[i][j][k][t], dp[i][j][k - 1][t] + calc_col(k - 1, i, j));
					if (t < m - 1 - y + k)
						upd(dp[i][j][k][t], dp[i][j][k][t + 1] + calc_col(t + 1, i, j));
				}
			}
		}
	}
	printf("%d\n", dp[x][x][y][y]);
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int m[50],d[50];
    int x = 0;
    string Day[7] = {"Thursday", "Friday","Saturday","Sunday","Monday", "Tuesday", "Wednesday"};
    int BanyakHari[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string ThatDayIs[50];

    do
    {
        int DayinBetween = 0;
        cin >> m[x] >> d[x];
        if((m[x] == 0) && (d[x] == 0))
        {
            break;
        }
        //Check banyak hari antara 1 Januari - Input
        for(int y = 0; y < m[x]-1; y++)
        {
            DayinBetween = DayinBetween + BanyakHari[y];
        }
        DayinBetween = (DayinBetween + d[x] - 1)%7;

        ThatDayIs[x] = Day[DayinBetween];

        x++;
    }
    while(x < 50);

    for(int z = 0; z < x; z++)
    {
        cout << ThatDayIs[z] << endl;
    }

}

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

int main(){
  string y[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int num[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

  while(1){
    int m,d;
    cin >> m >> d;
    if( m == 0 && d == 0 ) break;
    while( m != 0 ){
      d += num[m-1];
      m--;
    }
    cout << y[d%7] << endl;
  }

  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>

int main() {
    int n;
    std::cin >> n;
    while (n != 0) {
        std::vector<int> vec(n+1, 0);
        int x;
        for (int i = 1; i <= n; ++i) {
            std::cin >> x;
            vec[i] = x;
        }
        std::vector<int> sum;
        sum.assign(n+1, 0);
        sum[1] = vec[1];
        for (int i = 1; i < n; i++) {
            sum[i+1] = sum[i] + vec[i+1];
        }
        int ans = -1000000000;
        for (int l = 1; l <= n; ++l) {
            for (int r = l; r <= n; ++r) {
                ans = std::max(ans, sum[r] - sum[l-1]);
            }
        }
        std::cout << ans << std::endl;
        std::cin >> n;
    }
}

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 200500;

int n;
ll p[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;

	cin >> n;

	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		p[i] = p[i - 1] + x;
	}

	ll ans = inf;

	for (int i = 2, pl = 1, pr = 2; i < n; i++) {
		while (pl + 1 < i && abs(p[pl + 1] - (p[i] - p[pl + 1])) <= abs(p[pl] - (p[i] - p[pl])))
			pl++;
		while (pr + 1 < n && abs(p[pr + 1] - p[i] - (p[n] - p[pr + 1])) <= abs(p[pr] - p[i] - (p[n] - p[pr])))
			pr++;
		ans = min(ans, max({p[pl], p[i] - p[pl], p[pr] - p[i], p[n] - p[pr]}) - min({p[pl], p[i] - p[pl], p[pr] - p[i], p[n] - p[pr]}));
	}

	cout << ans;

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


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

struct Candidate{
	int num;
};

int main(void) {
	for (;;) {
		int n, p;
		cin >> n >> p;
		if (n == 0 && p == 0)
			break;
		Candidate candidate[50];
		for (int i = 0; i < 50; i++) {
			candidate[i].num = 0;
		}

		int winner;
		int t = p;
		for (int i = 0; i <= 1000000; i=(i+1)%n) {
			if (p != 0) {
				candidate[i].num++;
				p--;
			}
			else if (p == 0) {
				p+=candidate[i].num;
				candidate[i].num = 0;
			}
			if (candidate[i].num == t) {
				winner = i;
				break;
			}
		}
		printf("%d\n", winner);
	}
	return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector <int> a;
vector <int> all;
int n,m;

int main() {

  while(1) {
    scanf("%d%d",&n,&m);
    if(n == 0 && m ==0) break;
    a.resize(n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);

    a.push_back(0);
    all.clear();

    for(int i=0;i<a.size();i++)
      for(int j=i;j<a.size();j++)
	all.push_back(a[i]+a[j]);

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

    int ans = 0;
    int allsize = all.size();
    int b = 0;
    for(int i=allsize-1;i>= 0;i--) {
      for(int j=b;j<allsize;j++) {
	int sum = all[i] + all[j];
	if(sum > m) break;
	b++;
	if(ans < sum) ans = sum;
      }
      if(ans == m) break;
    }

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

}


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

int main(){
    int n;
    cin >> n;
    map<int, int> memo;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(memo.count(a)) memo.erase(a);
        else memo[a] = 1;
    }

    cout << memo.size() << endl;
    return 0;
}

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

main(){
  int n;cin >> n;
  int a[n];for(int i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  int ans=0;
  for(int i=0;i<n;){
    int cc = a[i];
    int cnt = 0;
    int j=i;
    while(a[j] == cc){
        cnt++;
        i++;
        j++;
      }
    ans+=cnt%2;
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } 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 << '\n';
}
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;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, N, M, Q);

  VV<int> trains(N + 1, V<int>(N + 1));
  rep(i, M) {
    in(int, L, R);
    trains[L][R]++;
  }

  VV<int> sum(N + 2, V<int>(N + 2));
  for (int l = N; l >= 1; --l) {
    for (int r = 1; r <= N; ++r) {
      sum[l][r] =
          sum[l + 1][r] + sum[l][r - 1] - sum[l + 1][r - 1] + trains[l][r];
    }
  }

  rep(i, Q) {
    in(int, p, q);
    out(sum[p][q]);
  }
}

#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<map<int, int>> start_length(N, map<int, int>());
    for (int i = 0; i < M; ++i) {
        int l, r;
        cin >> l >> r;
        --l;
        --r;
        if (start_length[l].count(r - l) == 0) {
            start_length[l].insert(make_pair(r - l, 0));
        }
        start_length[l][r - l] += 1;
    }
    vector<vector<int>> start_lengthLess(N, vector<int>());
    for (int i = 0; i < N; ++i) {
        const map<int, int>& length_num = start_length[i];
        vector<int> length(N + 1, 0);
        for (auto e : length_num) {
            length[e.first] = e.second;
        }
        vector<int> accumLength(N + 1, 0);
        accumLength[0] = length[0];
        for (int j = 1; j < accumLength.size(); ++j) {
            accumLength[j] = accumLength[j - 1] + length[j];
        }
        start_lengthLess[i] = accumLength;
    }

    for (int i = 0; i < Q; ++i) {
        int p, q;
        cin >> p >> q;
        --p;
        --q;
        int ans = 0;
        for (int j = p; j <= q; ++j) {
            ans += start_lengthLess[j][q - j];
        }
        cout << ans << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


#include <iostream>
using namespace std;

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    int pm[n], pe[n], pj[n];
    double average[n];
    double ave_me[n];
    for(int i = 0; i < n; i++) {
      cin >> pm[i] >> pe[i] >> pj[i];
      average[i] = (pm[i]+pe[i]+pj[i])/3.0;
      ave_me[i] = (pm[i]+pe[i])/2.0;
    }
    char grade[n];
    for(int i = 0; i < n; i++) {
      if(pm[i] == 100 || pe[i] == 100 || pj[i] == 100) {
	grade[i] = 'A';
      } else if(ave_me[i] >= 90) {
	grade[i] = 'A';
      } else if(average[i] >= 80) {
	grade[i] = 'A';
      } else if(average[i] >= 70) {
	grade[i] = 'B';
      } else if(average[i] >= 50 && (pm[i] >= 80 || pe[i] >= 80)) {
	grade[i] = 'B';
      } else {
	grade[i] = 'C';
      }
      cout << grade[i] << endl;
    }
  }
  return 0;
}

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

int main() {

  while( true ) {

    long long int a, b, c;
    cin >> a >> b >> c;
    if ( a == 0 ) break;

    vector< long long int > ans;
    for ( long long int i = 0; i < a + b + c; i++ ) {
      ans.push_back( 2 );
    }

    long long int n;
    cin >> n;

    vector< long long int > v_a, v_b, v_c;

    for ( long long int i = 0; i < n; i++ ) {

      long long int in_a, in_b, in_c, r;
      cin >> in_a >> in_b >> in_c >> r;

      if ( r == 1 ) {
	ans[ in_a - 1 ] = 1;
	ans[ in_b - 1 ] = 1;
	ans[ in_c - 1 ] = 1;
      }else {
	v_a.push_back( in_a );
	v_b.push_back( in_b );
	v_c.push_back( in_c );
      }

    }

    for ( long long int i = 0; i < v_a.size(); i++ ) {
      if ( ans[ v_a[i] - 1 ] == 1 && ans[ v_b[i] - 1 ] == 1 ) ans[ v_c[i] - 1 ] = 0;
      if ( ans[ v_a[i] - 1 ] == 1 && ans[ v_c[i] - 1 ] == 1 ) ans[ v_b[i] - 1 ] = 0;
      if ( ans[ v_b[i] - 1 ] == 1 && ans[ v_c[i] - 1 ] == 1 ) ans[ v_a[i] - 1 ] = 0;
    }

    for ( long long int i = 0; i < a + b + c; i++ ) {
      cout << ans[i] << endl;
    }

  }

  return 0;

}


#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <assert.h>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;

int main()
{
    int N, X, T;
    cin >> N >> X >> T;
    cout << (N+X-1)/X*T;

}

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

const int MAX = 510000;
const int MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  long long N, M, K;
  cin >> N >> M >> K;
  vector<long long> vec(N+1);// i個のブロックの塊をM色で隣合う色が異なるように塗る数
  vec[0] = 0;
  vec[1] = M;
  COMinit();
  for(int i = 2; i <= N; i++){
    vec[i] = vec[i-1] * (M-1) % MOD;
    vec[i] %= MOD;
  }
  long long sum = 0;
  for(int i = 0; i <= K; i++){
    sum += COM(N-1, i) * vec[N - i] % MOD;
    sum %= MOD;
  }
  cout << sum <<endl;
}


#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
set<int> si;
int n,k;
int fin = -1;
int s_int(string s){
    return atoi(s.c_str());
}
int check(int n){
    bool ok = 1;
    while(n >= 0){
        if(si.find(n%10) != si.end()){
            return 0;
        }
        n /= 10;
        if(n == 0) break;
    }
    return 1;
}
vector<int> solve(){
    vector<int> ans;
    queue<string> que;
    rep(i,10){
        string s = "";
        s += char('0' + i);
        que.push(s);
    }
    while(1){
        string fa = que.front(); que.pop();
        if(fa.size() > fin) return ans;
        if(!check(s_int(fa))){
            continue;
        }
        if(s_int(fa) >=n){
            if(fin == -1) fin = fa.size();
            ans.push_back(s_int(fa));
        }
        rep(i,10){
            que.push(string(fa + char('0' + i)));
        }
    }
}
int main(){
    cout << fixed << setprecision(10);
    cin >> n >> k;
    rep(i,k){
        int x;
        cin >> x;
        si.insert(x);
    }
    vector<int> ans = solve();
    sort(ans.begin(),ans.end());
    cout << ans[0] << endl;
    return 0;
}

#include<cstdio>
#include<queue>
#include<iostream>
#define ll long long
using namespace std;
ll res[4][2]={-1,0,0,1,0,-1,1,0};
char map1[60][60];
ll step[60][60];
ll n,m;
ll bfs()
{
	map1[0][0]='#';
	step[0][0]=0;
	queue<ll>qu;
	qu.push(0);
	qu.push(0);
	while(!qu.empty())
	{
		ll x=qu.front();qu.pop();
		ll y=qu.front();qu.pop();
		if(x==n-1&&m-1==y)return step[x][y];
		for(int i=0;i<4;++i)
		{
			ll dx=x+res[i][0];
			ll dy=y+res[i][1];
			if(dx>=0&&dx<n&&dy>=0&&dy<m&&map1[dx][dy]=='.')
			{
				map1[dx][dy]='#';
				step[dx][dy]=1+step[x][y];
				qu.push(dx);
				qu.push(dy);
			}
		}
	}
	return -1;
}
int main()
{
	while(cin>>n>>m)
	{
		for(ll i=0;i<n;++i)
		    cin>>map1[i];
		ll sum=0;
		for(ll i=0;i<n;++i)
		{
			for(int j=0;j<m;++j)
			    if(map1[i][j]=='.')
			        sum++;
		}
		ll ss=bfs();
		if(ss==-1)puts("-1");
		else printf("%lld\n",sum-ss-1);
	}
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 5000000000000000000;

int main() {
    ll x;
    cin >> x;
    ll ans = 0;
    ans += x / 11 * 2;
    x -= x / 11 * 11;
    if (x >= 1 && x <= 6) ans += 1;
    if (x >= 7) ans += 2;
    cout << ans << "\n";
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//ワーシャルフロイト法のテンプレ.graphに最短経路が格納される.
//負の重みがある場合inf + const = inf に気を付けること.
//graphは隣接行列.
void WF(vector<vector<int>> &graph){
	int n = graph.size();
	for (int k = 0; k < n; k++){
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
			}
		}
	}
}

//素因数分解をする関数.
map<long long int, int> prime_factorization(long long int a)
{
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;
	return ans;
}

int main()
{
	ll x;
	cin >> x;
	ll ans = (x / 11) * 2;
	x = x % 11;
	if (x > 6)
		ans += 2;
	else if (x > 0)
		ans++;
	cout << ans << endl;

	return 0;

}


#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <unordered_set>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

//#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
//typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

int n, m;
vector<int> graph[550000];
int color[550000];
int BITPARTITE = 1;
vector<int> bp, p;
int SZ = 0;

int dfs(int v, int fl)
{
    color[v] = fl;
    SZ++;
    for (auto u : graph[v])
    {
        if (color[u] == 0) dfs(u, 3 - fl);
        if (color[u] == fl) BITPARTITE = 0;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int v, u;
        cin >> v >> u;
        v--, u--;
        graph[v].push_back(u);
        graph[u].push_back(v);
    }
    ll ans = 0;
    ll cnt = n - 1;
    for (int i = 0; i < n; i++)
    {
        if (graph[i].size() == 0)
        {
            ans += 2 * cnt + 1;
            cnt--;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (color[i] == 0 && graph[i].size() != 0)
        {
            BITPARTITE = 1;
            SZ = 0;
            dfs(i, 1);
            if (BITPARTITE) bp.push_back(SZ);
            else p.push_back(SZ);
        }
    }
    cout << ans + 2LL * bp.size() * bp.size() + p.size() * p.size() + 2LL * bp.size() * p.size();
}

#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, M;
    cin >> N >> M;
    VEC(VEC(int)) Edges(N);
    FOR(i, 0, M) {
        int u, v;
        cin >> u >> v;
        Edges[u - 1].push_back(v - 1);
    }

    VEC(VEC(int)) Reach(N, VEC(int)(N, 10000));
    FOR(i, 0, N) {
        VEC(int)& Bfs = Reach[i];
        queue<int> q;
        q.push(i);

        while (q.size()) {
            int v = q.front();
            q.pop();
            for (int u : Edges[v])
                if (Bfs[u] >= 10000) {
                    q.push(u);
                    int dist = v == i ? 0 : Bfs[v];
                    Bfs[u] = 1 + dist;
                }
        }
    }

    VEC(int) cycle(10000, 0);
    FOR(i, 0, N)
        if (cycle.size() >= 10000 || Reach[i][i] < cycle.size()) {
            cycle.clear();
            int node = i, dist = Reach[i][i];
            while (dist--) {
                cycle.push_back(node);
                for (int next : Edges[node]) {
                    if (next == i) {
                        goto done;
                    }

                    if (Reach[next][i] == dist) {
                        node = next;
                        break;
                    }
                }
            }

done:
            continue;
        }

    if (cycle.size() >= 10000) {
        cout << -1 << endl;
        return 0;
    }

    cout << cycle.size() << endl;
    for (int v : cycle)
        cout << (v + 1) << endl;
    return 0;
};


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

#define INF 99999999

int n, k;
int dis[100][100];
int t, a, b, c, d, e;

signed main()
{
	while (true) {
		cin >> n >> k;
		if (n == 0 && k == 0) break;

		rep(i,n) rep(j,n) if (i == j) {
			dis[i][j] = 0;
		} else {
			dis[i][j] = INF;
		}

		rep(i,k) {
			cin >> t;
			if (t == 0) {
				cin >> a >> b;
				a--; b--;

				if (dis[a][b] == INF) {
					cout << -1 << endl;
				} else {
					cout << dis[a][b] << endl;
				}
			} else if (t == 1) {
				cin >> c >> d >> e;
				c--; d--;

				dis[c][d] = min(dis[c][d], e);
				dis[d][c] = min(dis[d][c], e);

				rep(i,n) rep(j,n) {
					dis[i][j] = min(dis[i][j], min(dis[i][c] + dis[c][d] + dis[d][j], dis[i][d] + dis[d][c] + dis[c][j]));
					dis[j][i] = min(dis[j][i], min(dis[j][c] + dis[c][d] + dis[d][i], dis[j][d] + dis[d][c] + dis[c][i]));
				}
			}
		}
	}
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

typedef pair<int,int> pii;

int w,h;
int xs, ys, xg, yg;
int ba[100][100];

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

bool solve() {
  queue<pii> Q;
  bool visited[w][h];
  memset(visited, 0, sizeof(visited));
  Q.push(pii(xs,ys));
  int col = ba[xs][ys];
  while(Q.size()){
    pii a = Q.front();
    int x = a.first, y = a.second;
    Q.pop();
//    printf("%d %d   %d\n", x,y, visited[x][y]);
    visited[x][y] = 1;
    REP(k,4) {
      int xx = x + dx[k];
      int yy = y + dy[k];
      //    cout << " " <<x << endl;
      if (xx<0 || w<=xx || yy<0 || h<=yy) continue;
      if (visited[xx][yy]) continue;
      if (col != ba[xx][yy]) continue;

      if (xx == xg && yy == yg)
        return true;
      //cout << xx << ". " << yy << endl;
      Q.push(pii(xx,yy));
    }
  }
  return false;
}

int main() {
  while(cin>>w>>h,w+h) {
    cin >>xs>>ys>>xg>>yg;
    xs--;ys--;xg--;yg--;
    int n;
    cin >> n;
    REP(i,n) {
      int c,d,x,y;
      cin >> c>>d>>x>>y;
      x--;y--;
      REP(i,8) {
        if (d==0)
          ba[x+i%4][y+i/4] = c;
        else
          ba[x+i/4][y+i%4] = c;
      }
    }
    // REP(y,h) {
    //   REP(x,w)
    //     cout << ba[x][y] << " ";
    //   cout << endl;
    // }
    if (solve())
      cout << "OK" << endl;
    else
      cout << "NG" << endl;
  }
}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y, ll z){
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        if(y%2==0)
         return (p*p)%z;
        else
        return (x*((p*p)%z))%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
ll po(ll x)
{
    ll c=0;
    while(x>0)
    {
        x=x&(x-1);
        c++;
    }
    return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n,x;
    cin>>n>>x;
    if(n>=10)
    cout<<x;
    else
    cout<<x+100*(10-n);}

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

int main() {
int n;
int r;
int x;
cin >> n;
cin >> r;
x = 100*(10-n)+r;
if (n >= 10) {
  cout << r;
} else {
 cout << x;
}
	return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 2000005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h >> w;
    vector<string> grid(h+2);
    string s = "";
    rep(i,w+2) s += '.';
    grid[0] = s;
    grid[h+1] = s;
    rep(i,h){
        cin >> grid[i+1];
        grid[i+1] = '.'+grid[i+1]+'.';
    }
    rep(i,1,h+1){
        rep(j,1,w+1){
            bool out = 1;
            if (grid[i][j] == '#'){
                rep(k,4){
                    ll xn = i+nx[k];
                    ll yn = j+ny[k];
                    if (grid[xn][yn] == '#') out = 0;
                }
                if (out){
                    PRINT("No");
                    return 0;
                }
            }
        }
    }
    PRINT("Yes");
}

#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

int n, x, a[200];

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

    cin >> n >> x;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    ll dp[209][100009];
    rep(i, 100009) dp[0][i] = i;
    rep(i, n) rep(j, 100009) dp[i + 1][j] =
        (dp[i][j % a[i]] + i * dp[i][j]) % mod;
    cout << dp[n][x] << endl;
}


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

bool upd[(1<<18)];
int val[(1<<18)];

void Set(int a,int b,int x,int k=0,int l=0,int r=(1<<17)){
	if(b<=l || r<=a)return;

	if( r-l>1 && upd[k] ){
		upd[k*2+1] = upd[k*2+2] = 1;
		val[k*2+1] = val[k*2+2] = val[k];
	}
	upd[k]=0;

	if(a<=l && r<=b){
		upd[k]=1;
		val[k]=x;
	}
	else{
		Set(a,b,x,k*2+1,l,(l+r)/2);
		Set(a,b,x,k*2+2,(l+r)/2,r);
		val[k]=min(val[k*2+1],val[k*2+2]);
	}
}
int Find(int a,int b,int k=0,int l=0,int r=(1<<17)){
	if(b<=l || r<=a)return INT_MAX;

	if( r-l>1 && upd[k] ){
		upd[k*2+1] = upd[k*2+2] = 1;
		val[k*2+1] = val[k*2+2] = val[k];
	}
	upd[k]=0;

	if(a<=l && r<=b) return val[k];
	else{
		int L = Find(a,b,k*2+1,l,(l+r)/2);
		int R = Find(a,b,k*2+2,(l+r)/2,r);
		return min(L,R);
	}
}

int n,m,a,b,c,d;

int main(){
	memset(upd,0,sizeof(upd));
	fill(val,val+(1<<18),INT_MAX);
	cin>>n>>m;
	while(m--){
		cin>>a>>b;
		if(a){
			cout<<Find(b,b+1)<<endl;
		}
		else{
			cin>>c>>d;
			Set(b,c+1,d);
		}
	}
}


#include <iostream>
using namespace std;

int x[100010], nx[100010][20];

int main() {
	int N, L, Q;
	cin >> N;
	for(int i=1; i<=N; ++i) cin >> x[i];
	cin >> L;
	int now=1;
	for(int i=1; i<=N; ++i){
		while(now<N){
			if(x[now+1]-x[i]<=L){
				++now;
			}
			else break;
		}
		nx[i][0]=now;
	}
	nx[N][0]=nx[N+1][0]=N+1;
	int mx=0;
	while(nx[1][mx]<N){
		for(int j=1; j<=N+1; ++j){
			nx[j][mx+1]=nx[nx[j][mx]][mx];
		}
		++mx;
	}
	cin >> Q;
	for(int q=0; q<Q; ++q){
		int a, b;
		cin >> a >> b;
		if(a>b) swap(a, b);
		int ans=0, tak=a;
		for(int i=mx; i>=0; --i){
			if(nx[tak][i]<b){
				ans |= (1<<i);
				tak=nx[tak][i];
			}
		}
		cout << ans+1 << endl;
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
}
void dfs(ll v,ll par,set<ll> &st,vl &ans, vvl &g){
    for(auto nv:g[v]){
        if(par==nv)continue;
        if(ans[nv]==-1){
            ans[nv]=v;
            st.ins(v);dfs(nv,v,st,ans,g);st.erase(v);
        }
        else{
            if(st.count(ans[nv]))ans[nv]=v;
        }
    }
}
int main(){
    ll n,m;cin >>n >>m;
    vvl g(n);
    vl ans(n,-1);
    set<ll> st;rep(i,n)st.ins(i);
    rep(i,n-1+m){
        ll a,b;cin >> a >> b;a--;b--;
        g[a].pb(b);
        st.erase(b);
    }
    ll s=*st.begin();st.clear();
    dfs(s,-1,st,ans,g);
    for(auto p:ans)cout << p+1 <<endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll K, X;

int main() {
  std::cin >> K >> X;

  repi( i, X-(K-1), X+K )
    std::cout << i << (i==X+K-1 ? '\n': ' ');

  return 0;
}

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

/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}

/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*最大公約数*/
unsigned long long GCD(long long L,long long R){
    if(L>R){
        long long temp=R;
        R = L;
        L = temp;
    }
    unsigned long long pp=0,ppt=0;
    unsigned long long ans=0;
    if(R%L==0){
        ans = L;
    }else{
        while(true){
            ppt = pp;
            pp=R%L;
            if(pp == 0){
                ans = ppt;
                break;
            }
            R = L;
            L = pp;
        }
    }
    return ans;
}

/*最小公倍数*/
unsigned long long LCM(long long L,long long R){
    unsigned long long ans;
    unsigned long long gcd = GCD(L,R);
    ans = (L/gcd)*R;
    return ans;
}

/*Combination set*/
#define mod 1000000007
#define maxcomb 3000/*大きいものを求めるときはここを変える*/
vector<long long> fc(maxcomb+1);
vector<long long> ifc(maxcomb+1);
long long modpow(long long x,long long n){
    long long ans = 1;
    while(n > 0){
        if(n & 1) {
            ans = ans*x%mod;
        }
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}
void Conb(){
    fc[0]= 1;
    ifc[0]=1;
    for(long long i=0;i<maxcomb;i++){
        fc[i+1] = fc[i]*(i+1)%mod;//n!(mod)
        ifc[i+1] = ifc[i]*modpow(i+1,mod-2)%mod;//k!^{M-2} (mod)
    }
}
unsigned long long Combination(long long L,long long R){
    unsigned long long up=1,ans;
    Conb();
    if(L==0&&R==0){
        return 1;
    }else if(L<R||L<0){
        return 0;
    }else{
        long long t = ifc[L-R]*ifc[R]%mod;
        ans = t*fc[L]%mod;
    }
    return ans;
}
/*Combination set ここまで*/

/*ここから*/
int main() {
    int K,X;
    cin >> K >> X;
    for(int i=X-K+1;i<X+K;i++){
        cout << i ;
        if(i!=X+K-1){
            cout << " ";
        }else{
            cout << endl;
        }
    }
    return 0;
}


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

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

    int cnt = 0;
    for(int i = a; i <= b; i++){
        int l = i;
        vector<int> vec(5);
        rep(j, 5){
            vec[j] = l % 10;
            l /= 10;
        }
        if(vec[0] == vec[4] && vec[1] == vec[3]) cnt++;
    }

    cout << cnt << endl;
}

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

using namespace std;

int main(){
  int n, r;
  cin >> n >> r;
  if(n<10){
   cout << r - 100*n + 1000 << endl;
  }else{
    cout << r << endl;
  }
}


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

int main() {
  int m; cin>>m;
  vector<ll> d(m),c(m);
  for (int i=0;i<m;i++) cin>>d[i]>>c[i];
  ll res=0, digit=0;
  for (int i=0;i<m;i++) {
    res+=c[i];
    digit+=d[i]*c[i];
  }
  res=res-1+(digit-1)/9;
  cout<<res<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,f,ans=0,k,g;
	cin>>a>>b>>c>>d>>e>>f;
	k=min(min(a,b),min(c,d));
	g=min(e,f);
	ans=a+b+c+d+e+f-k-g;
	cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N, L;
  cin >> N >> L;
  vector<int> A;
  for (int i = 1; i <= N; i++) {
    A.push_back(L+i-1);
  }
  sort(A.begin(), A.end(), [](int x, int y) {
    return abs(x) < abs(y);
  });
  int total = 0;
  for (int i = 1; i < N; i++) {
    total += A[i];
  }
  cout << total << '\n';
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define mod 1000000007
bool isPrime[1000001];
ll power(ll a,ll b)
{
    ll result = 1;
    while(b>0)
    {
        if(b%2)
        {
            result = (a*result)%mod;
        }
        a = (a*a)%mod;
        b = b/2;
    }
    return result;
}
int gcd(int a,int b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void sieve()
{
    memset(isPrime,1,sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for(int i=2;i*i<=1000000;i++)
    {
        if(isPrime[i])
        {
            for(int j=i*i;j<=1000000;j+=i)
            {
                isPrime[j] = 0;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int t,n;
    t = 1;
    for(int i=0;i<t;i++)
    {
        int n,m;
        cin>>n>>m;
        unordered_map <int,int> mp;
        int penalties = 0,correct = 0;;
        for(int i=0;i<m;i++)
        {
            string s;
            int x;
            cin>>x>>s;
            if(s=="WA")
            {
                if(mp[x]!=1000000)
                {
                    mp[x]++;
                }
            }
            if(s=="AC")
            {
                if(mp[x]!=1000000)
                {
                    penalties+=mp[x];
                    correct ++;
                    mp[x] = 1000000;
                }
            }
        }
        cout<<correct<<" "<<penalties;
    }
    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm( int m, int n ){
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main(){
    int n; cin>>n;
    vi v(n,0);rep(i,n)cin>>v[i];
    sort(all(v));
    for(int i=1;i<=v[0];i++){
        bool flag=true;
        rep(j,n){if(v[j]%i)flag=false;}
            if(flag)cout<<i<<endl;
    }
}

#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {

	int n;
	string sn;
	getline(cin, sn);
	n = atoi(sn.c_str());
	REP(i, n){
		string s;
		getline(cin, s);
		while (s.find("Hoshino") != string::npos){
			s[s.find("Hoshino") + 6] = 'a';
		}
		cout << s << endl;
	}
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a,b,c;
	while(cin>>a>>b>>c,a+b+c){
		vector<int>in(a+b+c+1,2);
		int n;
		cin>>n;
		vector<vector<int> >tmp(n,vector<int>(4));
		rep(i,n)rep(j,4)cin>>tmp[i][j];
		rep(i,n)if(tmp[i][3]==1){
			in[tmp[i][0]]=1;
			in[tmp[i][1]]=1;
			in[tmp[i][2]]=1;
		}
		rep(i,n){
			int co=0;
			rep(j,3)if(in[tmp[i][j]]!=1)co++;
			if(co==1){
				rep(j,3)if(in[tmp[i][j]]==2)in[tmp[i][j]]=0;
			}
		}
		loop(i,1,a+b+c+1)cout<<in[i]<<endl;
	}
}

#include <iostream>
using namespace std;

int main() {
	int a,b,c,n,buhin[300],kensa[1000][4];
	while(1){
	for(int i = 0;i < 300;i++) buhin[i] = 2;
	cin >> a >> b >> c >> n;
	if(a == 0 && b == 0 && c == 0) break;
	for(int i = 0;i < n;i++){
		cin >> kensa[i][0] >> kensa[i][1] >> kensa[i][2] >> kensa[i][3];
		if(kensa[i][3]){
			buhin[kensa[i][0] - 1] = 1;
			buhin[kensa[i][1] - 1] = 1;
			buhin[kensa[i][2] - 1] = 1;
		}
	}
	for(int i = 0;i < n;i++){
		if(!kensa[i][3]){
			if(buhin[kensa[i][0] - 1] == 1 && buhin[kensa[i][1] - 1] == 1) buhin[kensa[i][2] - 1] = 0;
			if(buhin[kensa[i][0] - 1] == 1 && buhin[kensa[i][2] - 1] == 1) buhin[kensa[i][1] - 1] = 0;
			if(buhin[kensa[i][2] - 1] == 1 && buhin[kensa[i][1] - 1] == 1) buhin[kensa[i][0] - 1] = 0;
		}
	}
	for(int i = 0;i < a + b + c;i++) cout << buhin[i] << endl;
	}
	return 0;
}