#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

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

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	int a,b,c; cin>>a>>b>>c;
	cout<<max(a*b, max(a+b,a-b));
	return 0;
}

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const int MOD=1000000007;
int INF=100100100100100;
int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}

int beki(int a,int b)
{
	if(b==0)return 1;
	int x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

int inv(int a)
{
	return beki(a,MOD-2);
}

int kaijou(int a)
{
	int ans=1;
	for(int i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}
	return ans;
}

/*int combi(int a,int b)
{
	int ret=1;
	for(int i=1;i<=b;i++)
	{
		ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
	}
	return ret;
}*/
/*
const int MAX_a=200010;
int cb[MAX_a+1]
void combi(int a,int b)
{
    int ret=1;
    cb[0]=1;
    for(int i=1;i<=b;i++)
    {
	ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
        cb[i]=ret;
    }

}*/

vector<P> prime_factorize(int N)
{
	vector<P> res;
	for(int a=2;a*a<=N;a++)
	{
		if(N%a!=0)continue;
		int ex=0;
		while(N%a==0)
		{
			ex++;N/=a;
		}
		res.push_back(P(a,ex));
	}
	if(N!=1)res.push_back(P(N,1));
	return res;
}

//ここから書く
signed main(){
  int a,b;cin>>a>>b;
  cout<<max(a+b,max(a-b,a*b))<<endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int N, D1, D2, M;
int A1[610][610], A2[610][610];
vector<pair<int, int>> v1, v2;
vector<pair<int, int>> V[4];
void dfs1(int x, int y, int c){
	A1[x][y] = c;
	for(auto p : v1){
		int nx = x + p.first; int ny = y + p.second;
		if(nx < 0 || nx > M || ny < 0 || ny > M) continue;
		if(A1[nx][ny]) continue;
		dfs1(nx, ny, 3 - c);
	}
}
void dfs2(int x, int y, int c){
	A2[x][y] = c;
	for(auto p : v2){
		int nx = x + p.first; int ny = y + p.second;
		if(nx < 0 || nx > M || ny < 0 || ny > M) continue;
		if(A2[nx][ny]) continue;
		dfs2(nx, ny, 4 - c);
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> D1 >> D2;
	M = 2 * N - 1;
	for(int i = -M; i <= M; i++){
		for(int j = -M; j <= M; j++){
			int d = i * i + j * j;
			if(d == D1) v1.emplace_back(i, j);
			if(d == D2) v2.emplace_back(i, j);
		}
	}
	for(int i = 0; i <= M; i++){
		for(int j = 0; j <= M; j++){
			if(!A1[i][j]) dfs1(i, j, 1);
			if(!A2[i][j]) dfs2(i, j, 1);
		}
	}
	for(int i = 0; i <= M; i++){
		for(int j = 0; j <= M; j++){
			int t = A1[i][j] + A2[i][j] - 2;
			V[t].emplace_back(i, j);
		}
	}
	int idx = -1;
	for(int t = 0; t < 4; t++){
		if(V[t].size() >= N * N) idx = t;
	}
	for(int i = 0; i < N * N; i++){
		cout << V[idx].at(i).first << " " << V[idx].at(i).second << "\n";
	}
}

#include <bits/stdc++.h>

using namespace std;

typedef long long int lli;

lli employees[4001];
bool checked[4001];

signed main()
{
	lli n;
	while (cin >> n, n) {
		for (lli i = 1; i <= 4000; ++i) employees[i] = checked[i] = false;

		vector<lli> ans;

		for (lli i = 0; i < n; ++i) {
			lli num, a, b; cin >> num >> a >> b;

			if (checked[num]) continue;

			employees[num] += a * b;

			if (employees[num] >= 1000000) {
				ans.push_back(num);
				checked[num] = true;
			}
		}

		if (ans.size()) {
			for (lli i = 0; i < ans.size(); ++i) {
				cout << ans[i] << endl;
			}
		} else {
			cout << "NA" << endl;
		}
	}
}


#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
    string s;
    cin >> s;

    if (s.size() == 3) {
        reverse(ALL(s));
    }

    cout << s << endl;

    return 0;
}

//
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int fun(int x){
	return x*x;
}

int main(){
	int d;
	while(cin >> d){
		int n = 600/d;
		int sum = 0;
		for(int i=0; i<n; i++){
			sum += fun(d*i)*d;
		}
		cout << sum << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<lint> A(N);
  REP(i, N) cin >> A[i];
  map<lint, lint> ma;
  REP(i, N) {
    ma[-A[i]]++;
  }
  int ans = 0;
  for(auto itr=ma.begin(); itr!=ma.end(); itr++) {
    lint a = -(itr->first);
    lint b = 1;
    while(b <= a) b *= 2;
    b -= a;
    if(ma.find(-b) != ma.end()) {
      if(a != b && ma[-a] >= 1 && ma[-b] >= 1) {
        int t = min(ma[-a], ma[-b]);
        ma[-a] -= t;
        ma[-b] -= t;
        ans += t;
      } else if(a == b && ma[-a] >= 2){
        int t = ma[-a] / 2;
        ma[-a] -= t*2;
        ans += t;
      }

    }
  }
  cout << ans << endl;
}

#pragma GCC optimize ("O3")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ull unsigned long long
#define y1 ljhadglkjsadf
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter multiset<int>::iterator
#define iter1 set<int>::iterator
#define int long long
using namespace std;
using namespace __gnu_pbds;

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

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=2e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=4e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    if (mpos>=MAX_MEM){
//        cout<<"BAD"<<endl;
//        exit(0);
//    }
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

int st[50];

main ()
{
    st[0]=1;
    for (int i=1;i<35;++i){
        st[i]=st[i-1]*2;
    }
    ios;
    int n;
    multiset<int>setik;
    cin>>n;
    for (int i=1;i<=n;++i){
        int x;
        cin>>x;
        setik.insert(x);
    }
    int ans=0;
    while(setik.size()>0){
        iter it=setik.end();
        --it;
        int x=(*it);
        setik.erase(it);
        int k=0;
        while(st[k]<=x)++k;
        int l=st[k]-x;
        iter it1=setik.find(l);
        if (it1!=setik.end()){
            ++ans;
            setik.erase(it1);
        }
    }
    cout<<ans<<endl;
}
//1
//3 15
//1 4
//3 5


#include<iostream>
using namespace std;
int main(){
  char str[20];
  cin>>str;
  for(int i=20;i>0;i--)
    cout<<str[i-1];
  cout<<endl;
  return 0;
}

#include <iostream>
using namespace std;
using lint = long long;

lint K;
lint N = 50;
const int MAX_N = 55;
lint a[MAX_N];

int main(){
	ios::sync_with_stdio(false);
	cin>>K;

	for(int i=0;i<N;i++){
		a[i] = (K+N-1)/N+(N-1);
	}

	int t = N-K%N;
	if(t==N)t=0;
	for(int i=0;i<t;i++){
		a[i]-=K%N+1;
	}

	cout << N << endl;
	for(int i=0;i<N;i++){
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){

  int N, K ;
  cin >> N >> K;

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

  for(int i = 0;i < N ; i++){
    int max = i;
    for(int j = i+1;j < N;j++){
      if(array[max] < array[j]){
	max = j;

      }

    }
          swap(array[i],array[max]);
  }
  /*for (int i = 0; i < N ;i++){
    cout <<array[i];
    } */

  int sum = 0;
  for(int i = 0;i < K;i++){

    sum += array[i];
  }

  cout << sum << endl;

  return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int n, k; cin >> n >> k;
    vi l(n); REP(i, n) cin >> l[i];

    sort(ALL(l), greater<>());
    int ans = accumulate(l.begin(), l.begin() + k, 0);

    print(ans);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;
ll gcd(ll a, ll b){
    if (a % b == 0)
    {  return(b);}
    else{return(gcd(b, a % b));}
}
ll lcm(ll a, ll b)
{return a * b / gcd(a, b);}

int main(){
  int n;
  cin >>n;
  vector<int>a(n);
  vector<ll>x(n+1);
  rep(i,n){cin>>a[i];}
  x[0]=abs(a[0]-0ll);
  for(int i=1;i<n;i++){
  	x[i]=abs(a[i]-a[i-1]);
  }
  x[n]=abs(a[n-1]-0ll);
  ll sum=0;
  rep(i,n+1){sum+=x[i];}
  //i=0のとき
  cout<<sum-x[0]-x[1]+abs(a[1]-0ll)<<endl;
  for(int i=1;i<=n-2;i++){
  	cout<<sum-x[i]-x[i+1]+abs(a[i+1]-a[i-1])<<endl;
  }
  cout<<sum-x[n-1]-x[n]+abs(a[n-2]-0);
}

#include<bits/stdc++.h>

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N;
    cin >> N;
    vector<pair<pair<unsigned long, unsigned long>, unsigned long>> tapi(1048576, {{1, 0}, 0});
    unsigned long ans{0}, t{500000004}, a{0}, z{0}, A;
    while(cin >> A)if(a ^= A){
        (tapi[a].first.second += (tapi[a].first.first += tapi[a].first.second * (z - tapi[a].second)) %= MOD) %= MOD;
        ans += tapi[a].first.first;
        tapi[a].second = z;
    }else ++z, (t *= 2) %= MOD;
    cout << (a ? tapi[a].first.first : (ans + t) % MOD) << endl;
    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,x,n) for (int i= x;i<n;i++)
#define all(v) v.begin(), v.end()
#define nepe(v) next_permutation(all(v))
#define F first
#define S second
#define PB push_back
#define MP make_pair
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vp =vector<pair<int,int>>;

typedef pair<int,int> P;
string s;
int k;
ll INF = 10000000000000000;

int main(){
    int N;
    cin >> N;
    vp r(N),b(N);
    rep(i,N) cin >>r[i].F>>r[i].S;
    rep(i,N) cin >>b[i].F>>b[i].S;
    vi left(N,0);
    vi max(N,0);

    sort(all(b));
    sort(all(r));

    int jj=0;
    int ans=0;
    rep(i,N){//ao
        bool judge=false;
        rep(j,N){//aka
            if(left[j] ==0){
                if(r[j].F<b[i].F && r[j].S<b[i].S && r[j].S>=max[i]){
                    max[i]=r[j].S;
                    jj = j;
                    judge = true;
                }
            }
        }
        if(judge) {
            ans++;
            left[jj] = 1;
        }
    }
    cout <<ans<<endl;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;
//////////////////////////////
// ?????£?????????????§£
void dfs(int v, int *used, vector< vector<int> > &G, vector<int> &vs){
  used[v] = true;
  REP(i, G[v].size()){
    int next = G[v][i];
    if(!used[next]) dfs(next, used, G, vs);
  }
  vs.push_back(v);
}
void rdfs(int v, int cnt, int *used, vector<int> &cmp, vector< vector<int> > &G){
  used[v] = true;
  cmp[v] = cnt;
  REP(i, G[v].size()){
    int next = G[v][i];
    if(!used[next]) rdfs(next, cnt, used, cmp, G);
  }
}
//G????????????????????°???????????£??\????????????RG????????????????????????????????£??\?????????
//?????????????????????????????????????????????????????£?????????????±?????????????cmp[a] == cmp[b]??????????????°a, b???????????????????±??????????
vector<int> scc(int V, vector< vector<int> > &G, vector< vector<int> > &RG){
  int used[V];
  memset(used, 0, sizeof(used));
  vector<int> vs, cmp(V);
  REP(i, V) if(!used[i]) dfs(i, used, G, vs);
  memset(used, 0, sizeof(used));
  int cnt = 0;
  reverse(vs.begin(), vs.end());
  REP(i, vs.size()) if(!used[vs[i]]) rdfs(vs[i], cnt++, used, cmp, RG);
  return cmp;
}

int main() {
	int v, e; cin >> v >> e;
	vector<vi> vvi(v), rvvi(v);
	REP(i, e) {
		int a,b; cin >> a >> b;
		vvi[a].pb(b);
		rvvi[b].pb(a);
	}
	vi ans = scc(v, vvi, rvvi);
	int q; cin >> q;
	while(q--) {
		int a, b; cin >> a >> b;
		cout << (ans[a] == ans[b]) << endl;
	}

	return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 12;
const int S = 1e5+5501;

int dp[N][S];
int p[N], c[N];

int rek(int pos, int tot) {
  if (tot <= 0) return 0;
  if (pos < 0) return 1e4;
  int &ret = dp[pos][tot];
  if (ret != -1) return ret;
  ret = rek(pos-1, tot);
  for (int i = 1; i < p[pos]; ++i) {
    ret = min(ret, i+rek(pos-1, tot-i*(pos+1)));
  }
  return ret = min(ret, p[pos]+rek(pos-1, tot-p[pos]*(pos+1)-c[pos]));
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int d, g; scanf("%d%d", &d, &g);
  g /= 100;
  for (int i = 0; i < d; ++i) {
    scanf("%d%d", p+i, c+i);
    c[i] /= 100;
  }
  printf("%d", rek(d-1, g));
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  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 P = pair<int,int>;
using Graph = vector<vector<int>>;

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

    int d;
    ll g;
    cin >> d >> g;
    vector<int> p(d);
    vector<ll> c(d),a(d);
    rep(i,d){
        cin >> p[i] >> c[i];
    }
    rep(i,d){
        a[i]=(i+1)*100*(p[i]-1);
    }
    ll ans=100000000000000000;
    for(int bit=0;bit<(1<<d);++bit){
        ll pr=0,preans=0;
        vector<int> t;
        for(int i=0;i<d;++i){
            if(bit&(1<<i)){
                pr+=((i+1)*100*p[i]+c[i]);
                preans+=p[i];
            }else{
                t.push_back(i);
            }
        }
        int x=0;
        ll res=0;
        for(auto u:t){
            if(res<a[u]) x=u;
            res=max(res,a[u]);
        }
        if(g>pr){
            ll y=g-pr;
            if(y%(100*(x+1))!=0 && (pr+res)>=g){
                preans+=(y/(100*(x+1))+1);
            }else if(y%(100*(x+1))==0 && (pr+res)>=g){
                preans+=y/(100*(x+1));
            }else{
                continue;
            }
        }
        ans=min(ans,preans);
    }
    cout << ans << "\n";
    return 0;
}


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

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

    vector<pair<int, int>> odd(100100, make_pair(0, 0)), even(100100, make_pair(0, 0));
    rep (i, n)
    {
        int v;
        cin >> v;
        if (i % 2)
        {
            odd[v].first++;
            odd[v].second = v;
        }
        else
        {
            even[v].first++;
            even[v].second = v;
        }
    }

    sort(odd.rbegin(), odd.rend());
    sort(even.rbegin(), even.rend());

    if (odd[0].second != even[0].second)
        cout << (n / 2 - odd[0].first) + (n / 2 - even[0].first) << endl;
    else
        cout << min((n / 2 - odd[0].first) + (n / 2 - even[1].first), (n / 2 - odd[1].first) + (n / 2 - even[0].first)) << endl;
}

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

int main() {
    ll n;
    cin >> n;
    map<ll,ll> m, p;
    rep(i,n/2) {
        ll a, b;
        cin >> a >> b;
        m[a]++, p[b]++;
    }
    vector<P> even, odd; //回数 値
    for(auto x : m) even.push_back(make_pair(x.second, x.first));
    for(auto x : p) odd.push_back(make_pair(x.second, x.first));
    sort(all(even)); sort(all(odd));;
    reverse(all(even)); reverse(all(odd));
    ll A = 0, B = 0, ans;
    if(even[0].second==odd[0].second){
        ans = min(n-even[0].first-odd[1].first, n-even[1].first-odd[0].first);
    }
    else{
        A = even[0].first;
        B = odd[0].first;
        ans = n-A-B;
    }
    cout << ans << endl;
    return 0;
}


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

using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'

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

  string s,t;
  cin >> s >> t;
  cout << (t+s) << endl;

}

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

int main(int argc, char const *argv[]) {
    int n, l;
    cin >> n >> l;

    int ans = 0;
    if (l + n - 1 < 0) {
        for (int i = 0; i < n-1; i++) ans += l + i;
    } else if (l < 0) {
        for (int i = 0; i < n; i++) ans += l + i;
    } else {
        for (int i = 1; i < n; i++) ans += l + i;
    }

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


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define INF (1ll<<60)
#define mod 1000000007
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
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; }

vector<ll> sums,sumg;
void pre_process(vector<ll> &a,vector<ll> &s){//累積和のvector
    ll n=(ll)a.size();
    s.assign(n+1,0);
    for(ll i=0;i<n;i++){
        s[i+1]=s[i]+a[i];
    }
}

int main(){
    ll n,m,Q;cin>>n>>m>>Q;
    vector<P> pairs;

    rep(i,m){
        ll pf,ps;cin>>pf>>ps;
        pf--;ps--;
        pairs.push_back({pf,ps});
    }
    sort(pairs.begin(),pairs.end());

    vector<vector<ll>> list(510,vector<ll>(510)),sum(510);
    rep(i,m){
        list[pairs[i].fi+1][pairs[i].se]++;
    }
    rep(i,510){
        pre_process(list[i],sum[i]);
    }
/*
    rep(i,11){
        rep(j,11){
            cout<<sum[i][j]<<" ";
        }
        cout<<endl;
    }
*/
    rep(i,Q){
        ll p,q,ans=0;cin>>p>>q;
        for(ll i=p;i<=q;i++){
            ans+=sum[i][q];
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

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

signed main() {
  init();
  ll N, M, Q;
  cin >> N >> M >> Q;

  vector<vll> mat(N, vll(N, 0));
  rep(i, M) {
    ll l, r;
    cin >> l >> r;
    l--;
    r--;
    mat[l][r]++;
  }

  vector<vll> wa(N, vll(N, 0));
  rep(i, N) {
    rep(j, N) {
      if (i == 0 && j == 0) {
        wa[i][j] = mat[i][j];
        continue;
      }
      if (i == 0) {
        wa[i][j] = wa[i][j - 1] + mat[i][j];
        continue;
      }
      if (j == 0) {
        wa[i][j] = wa[i - 1][j] + mat[i][j];
        continue;
      }
      wa[i][j] = wa[i - 1][j] + wa[i][j - 1] - wa[i - 1][j - 1] + mat[i][j];
    }
  }

  rep(i, Q) {
    ll p, q;
    cin >> p >> q;
    p--;
    q--;

    if (p == 0 && q == 0) {
      COUT(wa[0][0]);
      continue;
    }

    if (p == 0) {
      COUT(wa[q][q]);
      continue;
    }

    ll a = wa[q][q];
    ll b = wa[q][p - 1];
    ll c = wa[p - 1][q];
    ll d = wa[p - 1][p - 1];
    ll ans = a - b - c + d;
    COUT(ans);
  }

  return 0;
}


#include <iostream>
#include <string>
using namespace std;
int main(){
	string a;
	while(getline(cin,a)){
	int k=0;
	int check=0;
	while(true){
		if(k>52)
			break;
		for(int j=0;j<a.size();j++){
			if(isalpha(a[j])!=0)
				if(a[j]=='z')
					a[j]='a';
				else
				    a[j]++;
		}
		for(int i=0;i<a.size()-2;i++){
			if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='e'&&check==0){
				for(int i=0;i<a.size();i++)
		            cout<<a[i];
	            cout<<endl;
				check=1;
			}
			if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='i'&&a[i+3]=='s'&&check==0){
				for(int i=0;i<a.size();i++)
		            cout<<a[i];
	            cout<<endl;
				check=1;
			}
			if(a[i]=='t'&&a[i+1]=='h'&&a[i+2]=='a'&&a[i+3]=='t'&&check==0){
				for(int i=0;i<a.size();i++)
		            cout<<a[i];
	            cout<<endl;
				check=1;
			}
		}
		k++;
	}
	}
	return 0;
}

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	while(cin>>n,n){
		map<int,int> data;
		data.clear();
		for(int i =0;i <n;i++){
			int x;
			cin>>x;
			data[x]++;
		}
		for(int i =0;i <=9;i++){
			if(data[i]==0)cout <<"-"<<endl;
			else{
				for(int j =0;j <data[i];j++){
					cout <<"*";
				}
				cout <<endl;
			}
		}
	}
	return 0;
}


#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;

//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A & a, const B & b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A & a, const B & b) { a = max(a, (A)b); };

void factorize(ll X, vector<pair<ll,ll>>& ret) {
	for (ll i = 2; i * i <= X; ++i) {
		if (X % i != 0) continue;
		ret.push_back(pair<ll, ll>{i, 0});
		while (X % i == 0) {
			X /= i;
			ret.back().second++;
		}
	}
	if (X != 1) ret.push_back(pair<ll, ll>{X, 1});
}

int main() {
	ll mod = 1e9 + 7;
	ll N, M;
	cin >> N >> M;
	vector<vector<ll>> dp(N+1);
	vector<pair<ll, ll>> P;
	factorize(M, P);
	ll maxn = 0;
	for (const auto& p : P) maxs(maxn, p.second);
	REP(i, 0, N + 1) dp[i].resize(maxn + 1, 0);
	REP(i, 0, maxn + 1)dp[1][i] = 1;
	REP(i, 0, N + 1)dp[i][1] = i;
	REP(i, 2, N + 1) REP(j, 2, maxn + 1) dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
	ll ans = 1;
	for (const auto& p : P) ans = ans * dp[N][p.second] % mod;
	PRI(ans);
	return 0;
}


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

int main()
{
    char ch[3];
    cin>>ch;

    if(ch[0]=='S')
        {
            if(ch[1]=='U')cout<<"7"<<endl;
            else cout<<"1"<<endl;
        }
    else if(ch[0]=='T')
        {
            if(ch[1]=='U')cout<<"5"<<endl;
            else cout<<"3"<<endl;
        }
    else if(ch[0]=='M')cout<<"6"<<endl;
    else if(ch[0]=='W')cout<<"4"<<endl;
    else cout<<"2"<<endl;

    return 0;
}

#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);
    string s[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string x;
    cin >> x;
    int ans = 0;
    for(int i = 0; i < 7; i++) if(s[i] == x) ans = i;
    cout << 7 - ans;

    return 0;
}


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

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

#define MOD 1000000007LL

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

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

int main(void) {
    string X;
    ll count = 0;
    ll s = 0;
    cin >> X;
    iter(c, X) {
        if(c == 'S') s++;
        else if(s > 0) count++, s--;
    }
    cout << X.size() - 2 * count << endl;
    return 0;
}

#pragma GCC optimize("O2,unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using vi = vector<int>;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	string s, t;
	cin >> s;
	for(auto i : s) {
		if(i == 'S') t.pb(i);
		else if(t.size() && t.back() == 'S') t.pop_back();
		else t.pb(i);
	}
	cout << t.size();
}


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

#define inf 1e+9
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep_rev(i, n) for (int i = n-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

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

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(T first, T end){
    for (auto i = first; i < end - 1; i++) cout << *i << " ";
    cout << *(end-1) << endl;
}

template<class... T>
void debug_print(T... args){
    vector<lint> tmp = initializer_list<lint>{args...};
    print_vec(all(tmp));
}
template<class T>
void print(T a){ cout << a << endl;}

vector<string> Yes = {"No", "Yes"};
vector<string> YES = {"NO", "YES"};

int ord(char x){ return (int)(x - 'a');}
char chr(lint x){ return (char)(x + (lint)('a'));}
lint mod = 1e9+7;
// lint mod =

lint sum(vlint a){lint ret = 0; for(auto&& v:a) ret += v; return ret;}
lint vmini(vlint a, lint &index){
    lint ret = LLONG_MAX;
    rep(i, Size(a)){ if (chmin(ret, a[i])) index = i;}
    return ret;
}
lint vmaxi(vlint a, lint &index){
    lint ret = -LLONG_MAX;
    rep(i, Size(a)){ if (chmax(ret, a[i])) index = i;}
    return ret;
}

lint vmin(vlint a){
    lint ret = LLONG_MAX; for (auto && v : a) chmin(ret, v); return ret;
}
lint vmax(vlint a){
    lint ret = -LLONG_MAX; for (auto && v : a) chmax(ret, v); return ret;
}

int main(){
    INT(n); STR(s);
    vlint leftw(n+1, 0), rightw(n+1, 0);
    vlint lefte(n+1, 0), righte(n+1, 0);
    rep(i, n){
        if (s[i] == 'W'){
            leftw[i] ++;
        }
        else{
            lefte[i] ++;
        }
        leftw[i+1] += leftw[i]; lefte[i+1] += lefte[i];
    }
    for (int i = n-1; i > 0; --i){
        if (s[i] == 'W'){
            rightw[i]++;
        }
        else{
            righte[i]++;
        }
        rightw[i-1] += righte[i];
        righte[i-1] += righte[i];
    }

    lint ans = 2 * n;
    rep1(i, n-1){
        chmin(ans, leftw[i-1] + righte[i+1]);
    }
    chmin(ans, righte[1]); chmin(ans, leftw[n-2]);
    print(ans);

}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    int w = 0, e = 0;
    for(int i=0; i<n; ++i){
        if(s[i]=='W'){w++;}
    }
    e = n-w;
    int nw = 0, ne = e;
    int mi = INT32_MAX; int c;
    for(int i=0; i<n; ++i){
        if(s[i]=='W' && i>0){nw++;}
        if(s[i]=='E' && i>0){ne--;}
        int pen = nw + ne;
        if(mi>pen){mi = pen; c=i;}
    }
    int res = 0; //cout << "c:" << c << endl;
    for(int i=0; i<n; ++i){
        if(s[i]=='W' && i<c){res++;}
        if(s[i]=='E' && i>c){res++;}
    }
    cout << res << endl;
    return 0;
}


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

int main()
{
  string s;
  cin >> s;

  string x = "";
  for(int bit = 0; bit < (1 << 3); bit++){
    int seven = s[0] - '0';
    x += s[0];
    for(int i = 1; i < 4; i++){
      if(bit & (1 << (i-1))){
        seven += s[i] - '0';
        x += '+';
        x += s[i];
      }else{
        seven -= s[i] - '0';
        x += '-';
        x += s[i];
      }//eles
    }//for

    if(seven == 7){
      break;
    }
    seven = 0;
    x = "";
  }//for

  cout << x << "=7" << endl;
}


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

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

#define DEBUG(x) cerr << #x << " = " << x << endl
int F[20][20];

const int INF = (int)1e9;
const int dy[4] = { 0, -1, 0, 1 };
const int dx[4] = { 1, 0, -1, 0 };

int W, H;
int ans;

void solve(const int y, const int x, const int depth) {
  if(F[y][x] == 3) {
    ans = min(ans, depth);
    return;
  }
  if(depth >= 10) return;
  for(int k = 0; k < 4; ++k) {
    int ny = y, nx = x;
    if(0 <= ny + dy[k] && ny + dy[k] < H && 0 <= nx + dx[k] && nx + dx[k] < W && F[ny + dy[k]][nx + dx[k]] == 1) continue;
    bool ok = true;
    int sy = -1, sx = -1;
    while(true) {
      if(F[ny][nx] == 3) break;
      ny += dy[k];
      nx += dx[k];
      if(ny < 0 || ny >= H || nx < 0 || nx >= W) {
        ok = false;
        break;
      }
      if(F[ny][nx] == 1) {
        sy = ny;
        sx = nx;
        F[sy][sx] = 0;
        ny -= dy[k];
        nx -= dx[k];
        break;
      }
    }
    if(ok)
      solve(ny,nx,depth+1);
    if(sy != -1 && sx != -1) {
      F[sy][sx] = 1;
    }
  }
}

int main() {
  while(true) {
    cin >> W >> H;
    if(W == 0 && H == 0) break;
    REP(i,H) REP(j,W) cin >> F[i][j];
    ans = INF;
    REP(i,H) REP(j,W) {
      if(F[i][j] == 2) solve(i,j,0);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
  }
}


#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp
struct PrimeNumber
{
    //O(sqrt(n))
    //sosu hantei
    bool is_prime(long long n){
        for(long long i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return n != 1;
    }

    //O(sqrt(n))  isn't sorted
    //yakusu rekkyo
    vector<long long> divisor(long long n){
        vector<long long> res;
        for(long long i = 1; i * i <= n; i++){
            if(n % i == 0){
                res.push_back(i);
                if(i != n / i) res.push_back(n / i);
            }
        }
        return res;
    }

    //O(sqrt(n))
    //soinsu bunkai
    map<long long, long long> prime_factor(long long n){
        map<long long, long long> res;
        for(long long i = 2; i * i <= n; i++){
            while(n % i == 0){
                n /= i;
                res[i]++;
            }
        }
        if(n != 1) res[n] = 1;
        return res;
    }

    //O(n log log n)
    //n madeno sosu rekkyo
    vector<long long> eratosthenes(long long n){
        vector<long long> prime;
        vector<bool> is_prime(n + 1, true);
        long long p = 0;
        is_prime[0] = false; is_prime[1] = false;
        for(long long i = 2; i <= n; i++){
            if(is_prime[i]) prime.push_back(i);
            for(long long j = 2 * i; j <= n; j += i) is_prime[j] = false;
        }
        return prime;
    }
};

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n, m; cin >> n >> m;
    ll ans = 1;
    PrimeNumber p;
    vector<ll> vec = p.divisor(m);
    rep(i, vec.size()){
        ll d = m / vec[i];
        if(d >= n) ans = max(ans, vec[i]);
    }
    cout << ans << endl;
}

/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */

#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main()
{

    ll n,m;
    lscf(n),lscf(m);

    ll a=1;

    for(ll i=m/n;i>1;i--)
    {
        if((m-i*n)%i==0)
        {
            a=i;
            break;
        }

    }

    lprin(a);

}


#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 x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  return 0;
}

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

int main(){
  string S;
  cin >> S;
  S.at(3) = '8';
  cout << S;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
const double PI=acos(-1.0);
signed main(){
    ll n;cin>>n;
    vector<ll>x(n),y(n);
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    rep(i,n){
        vector<double>a(0);
        rep(j,n){
            if(i==j)continue;
            a.pb(atan2(y[j]-y[i],x[j]-x[i]));
        }
        ll m=a.size();
        rep(i,m){
            a.pb(a[i]+2.0*PI);
        }
        sort(all(a));
        double ma=0.0;
        rep(i,m*2-1){
            ma=max(ma,a[i+1]-a[i]);
        }
        ma=max(0.0,ma-PI);
        cout<<fixed<<setprecision(10)<<ma/PI/2.0<<endl;
    }
}

//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
#define fi   first
#define se   second
using namespace std;
struct P{int x,y;};
P mns(P x,P y){x.x-=y.x,x.y-=y.y;return x;}
ll det(P x,P y){return x.x*1ll*y.y-x.y*1ll*y.x;}
int n;
pair<pair<int,int>,int> p[105];
int U,D,iu[105],id[105],Q,iq[105];
P pu[105],pd[105],pq[105];
double ans[105],PI=6.2831853071795864769;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d%d",&p[i].fi.fi,&p[i].fi.se),p[i].se=i;
	sort(p+1,p+n+1);
	for(int i=1;i<=n;++i){
		P a;
		a.x=p[i].fi.fi,a.y=p[i].fi.se;
        while(U>1&&det(mns(pu[U],pu[U-1]),mns(a,pu[U]))>=0)--U;
        pu[++U]=a;
        iu[U]=p[i].se;
    }
    for(int i=1;i<=n;++i){
		P a;
		a.x=p[i].fi.fi,a.y=p[i].fi.se;
        while(D>1&&det(mns(pd[D],pd[D-1]),mns(a,pd[D]))<=0)--D;
        pd[++D]=a;
        id[D]=p[i].se;
    }
    for(int i=1;i<=U;++i)++Q,iq[Q]=iu[i],pq[Q]=pu[i];
    for(int i=D-1;i>1;--i)++Q,iq[Q]=id[i],pq[Q]=pd[i];
    if(Q==2){
    	ans[iq[1]]=ans[iq[2]]=0.5;
    }
    else{
    	pq[Q+1]=pq[1];
    	pq[0]=pq[Q];
    	for(int i=1;i<=Q;++i){
    		P p1=mns(pq[i],pq[i-1]),p2=mns(pq[i+1],pq[i]);
    		double d=acos((p1.x*1.0*p2.x+p1.y*1.0*p2.y)/sqrt(p1.x*1.0*p1.x+p1.y*1.0*p1.y)/sqrt(p2.x*1.0*p2.x+p2.y*1.0*p2.y));
    		ans[iq[i]]=d/PI;
    	}
    }
    for(int i=1;i<=n;++i)printf("%.10lf\n",ans[i]);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int N, K;
    cin >> N >> K;
    cout << (N % K > 0 ? 1 : 0) << endl;
}

/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    int N, R;
    cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else{
        cout << R + 100 * (10 - N) << endl;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}


#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>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b;
    cin>>a>>b;
    int ans=1;
    for(int i=0;;i++){
        if(ans>=b){
            cout<<i<<endl;
            return 0;
        }
        ans=ans-1+a;
    }
}

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

int main()
{
  int a,b;
  cin>>a>>b;
  if((b-1)%(a-1)==0)
    cout<<(b-1)/(a-1)<<endl;
  else
    cout<<(b-1)/(a-1)+1<<endl;
}


#include <bits/stdc++.h>		//万能头文件
using namespace std;

int main()
{
	string a;
	int pos=0;		//记录位置
	cin>>a;
	a=a+"D";		//为防止最后一个字母是"A",添加一个不是"C"的字母
	while(1)
	{
		pos=a.find("A",pos);		//find()函数查找位置
		if(pos<0)		//如果没找到，返回-1
		{
			cout<<"No"<<endl;		//endl养成好习惯
			break;		//跳出循环
		}
		if(a[pos+1]=='C')		//判断"A"下一个是不是"C"
		{
			cout<<"Yes"<<endl;
			break;		//跳出循环
		}
		pos++;		//下一次从pos+1找起
	}
	return 0;
}

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))

// #define DEBUG

#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;

const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}

random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    string in; cin >> in;
    int n = in.size();
    rep(i, n-1){
        if(in.substr(i, 2) == "AC"){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}
ll tree[Max];

ll query(ll idx)
{
    ll sum=0;

    while(idx>0)
    {
        sum+=tree[idx];

        idx-= idx & (-idx);

    }

    return sum;
}

void update(ll idx,ll x,ll n)
{
    while(idx<=n)
    {
        tree[idx]+=x;

        idx+= idx & (-idx);
    }
}

int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      cin>>n;

      for(i=1; i<=n; i++)
      {
          cin>>a;

          update(a,1,n);

          if(query(n)-query(a-1)==i)ans++;
      }

      cout<<ans<<endl;

}

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    policy_set;

#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define ALL(c) c.begin(),c.end()
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

void preprocess(){

}
const ll N=3e5+7;
const ll INF=1e18+1;
const ll MOD=1e9+7;
//Have to ramp up more on implementation skillz to do it fast,
// and debug skillz, it is not as easy as you think with two pointers
ll n,a[N],pref[N];
ll f(ll l1,ll r1,ll l2, ll r2){
    return abs((pref[r1]-pref[l1-1])-(pref[r2]-pref[l2-1]));
}
// So we will implement the two pointer solution to this also
// very well
// So in ternary search we always need to check 4 values near, the start,end
// like in that cf problem, no need to do this all over again
ll find_left(ll i){
    ll start=1,end=i-1;
    while(start<=end){
        ll mid1=(2*start+end)/3,mid2=(start+2*end)/3;
        // cout<<start<<" "<<mid1<<" "<<mid2<<" "<<end<<"\n";
        if(f(1,mid1,mid1+1,i)>f(1,mid2,mid2+1,i))
            start=mid1+1;
        else
            end=mid2-1;
    }
        // cout<<start<<" "<<end<<"\n";
    ll arr[]={start,end},ans=1e18,ansidx=start;
    for(ll j=0;j<2;j++)
        for(ll jj=-1;jj<=1;jj++){
            ll idx=arr[j]+jj;
            if(idx<1 || idx>i-1)continue;
            if(ans>f(1,idx,idx+1,i))ans=f(1,idx,idx+1,i),ansidx=idx;
        }

    return ansidx;
}
// I remember facing this problem before
ll find_right(ll i){
    ll start=i+1,end=n-1;
    while(start<=end){
        ll mid1=(2*start+end)/3,mid2=(start+2*end)/3;
        if(f(i+1,mid1,mid1+1,n)>f(i+1,mid2,mid2+1,n))
            start=mid1+1;
        else
            end=mid2-1;
    }

    ll arr[]={start,end},ans=1e18,ansidx=start;
    for(ll j=0;j<2;j++)
        for(ll jj=-1;jj<=1;jj++){
            ll idx=arr[j]+jj;
            if(idx<i+1 || idx>n)continue;
            if(ans>f(i+1,idx,idx+1,n))ans=f(i+1,idx,idx+1,n),ansidx=idx;
        }
    return ansidx;
}
void solve(){
    cin>>n;
    for(ll i=1;i<=n;i++)cin>>a[i],pref[i]=pref[i-1]+a[i];
    ll ans=INT64_MAX;
    // cout<<find_left(4)<<" "<<f(1,1,2,4)<<" "<<f(1,2,3,4)<<" "<<f(1,3,4,4)<<"\n";
    // return;
    for(ll i=1;i<=n;i++){
        //i ins the middle split, in this case
        // 1..left left+1..i i+1..right right+1..n
        ll left=find_left(i),right=find_right(i);
        // cout<<left<<" "<<right<<"\n";
        vector<ll> vecs({pref[left],pref[i]-pref[left],pref[right]-pref[i],pref[n]-pref[right]});
        sort(all(vecs));
        ans=min(ans,vecs.back()-vecs[0]);
    }
    cout<<ans<<"\n";
}
int main() {
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	preprocess();
	int t=1;
	//cin>>t;
	//cout<<t<<endl;
	for(int i=0;i<t;i++)
		solve();
	return 0;
}


#include<bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

char in[1000100];

int main(){
	fgets(in, sizeof(in), stdin);
	vector<pi> v;
	int cnt = 0, ans = 0;

	for(int i = 0; ; i++){
		if(i && in[i] != in[i - 1]){
			v.pb(mp(in[i - 1], cnt));
			cnt = 1;
		}
		else cnt++;
		if(!in[i]) break;
	}

	rep(i, v.size() - 2) if(v[i].first == 'J'
		&& v[i + 1].first == 'O'
		&& v[i + 2].first == 'I'){

		if(v[i + 1].second <= v[i].second && v[i + 1].second <= v[i + 2].second)
		ans = max(ans, v[i + 1].second);
	}

	cout << ans << endl;

	return 0;
}

#include "bits/stdc++.h"

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
//constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

constexpr long double EPS=1e-8;

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

	int ans=0;
	string s;
	cin>>s;
	s='P'+s+'P';
	for(int i=1;i<=s.size();i++){
		if(s[i]=='O'){
			int add=0;
			while(s[i+add]=='O')add++;
			bool flag=true;
			for(int k=i-1;k>=i-add;k--){
				//cout<<"J "<<k<<endl;
				flag&=s[k]=='J';
				if(!flag)break;
			}
			for(int k=i+add;k<i+2*add;k++){
				//cout<<"I "<<k<<endl;
				flag&=s[k]=='I';
				if(!flag)break;
			}
			if(flag)ans=max(ans,add);
			i+=add-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  cout<<fixed<<setprecision(12);
  int N,K;cin>>N>>K;
  vector<double> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  //vector<double> ans(N-K+1);
  priority_queue<double> ans;
  double X=0;
  for(int i=0;i<K;i++) X+=(A.at(i)+1.0)/2;
  ans.push(X);
  for(int i=1;i<N-K+1;i++){
    X-=(A.at(i-1)+1.0)/2;
    X+=(A.at(i+K-1)+1.0)/2;
    ans.push(X);
  }
  cout<<ans.top()<<endl;
}

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii;
#define hashset unordered_set
#define hashmap unordered_map
#define newline fast_writechar('\n')
#define unify(arr) arr.resize(unique(arr.begin(), arr.end()) - arr.begin())
#define getbit(x, i) (((x) >> (i)) & 1)

template <typename T>
vector<T> readvector(size_t sz) {
    vector<T> res(sz);
    for (size_t i = 0; i < sz; ++i) {
        cin >> res[i];
    }
    return res;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, " "));
    return out;
}

int mylog(int n) {
    return 63 - __builtin_clzll(n);
}

inline int binPow(int x, int deg, int mod) {
    int ans = 1;
    for (int i = sizeof(deg) * CHAR_BIT - 1; i >= 0; i--) {
        ans *= ans;
        ans %= mod;
        if (getbit(deg, i)) ans *= x;
        ans %= mod;
    }
    return ans;
}

/** Interface */

inline int readInt();
inline int readUInt();
inline void readWord(char *s);
inline int fast_readchar();  // you may use readchar() instead of it

inline void writeInt(int x);
inline void fast_writechar(int x);  // you may use putchar() instead of it
inline void writeWord(const char *s);
inline void fast_flush();

// ====================== END ======================
const int MAXN = 2e6 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e18;

void solve() {
    int n, k;
    cin >> n >> k;
    auto arr =readvector<int>(n);
    arr.insert(arr.begin(), 0);
    for (int i = 1; i <= n; i++) arr[i] += arr[i - 1];
    int ans = 0;
    for (int i = 0; i + k <= n; i++) {
        ans = max(ans, arr[i + k] - arr[i] + k);
    }
    cout << fixed << setprecision(1) << ans / 2. << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // t = readInt();
    // cin >> t;
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }
    // fast_flush();
    return 0;
}

/** Read */

static const int buf_size = 4096;

inline int fast_readchar() {
    static char buf[buf_size];
    static int len = 0, pos = 0;
    if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin);
    if (pos == len) return -1;
    return buf[pos++];
}

inline int readUInt() {
    int c = fast_readchar(), x = 0;
    while (c <= 32) c = fast_readchar();
    while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = fast_readchar();
    return x;
}

inline int readInt() {
    int s = 1, c = fast_readchar();
    int x = 0;
    while (c <= 32) c = fast_readchar();
    if (c == '-') s = -1, c = fast_readchar();
    while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = fast_readchar();
    return x * s;
}

inline void readWord(char *s) {
    int c = fast_readchar();
    while (c <= 32) c = fast_readchar();
    while (c > 32) *s++ = c, c = fast_readchar();
    *s = 0;
}

/** Write */

static int write_pos = 0;
static char write_buf[buf_size];

inline void fast_writechar(int x) {
    if (write_pos == buf_size) fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
    write_buf[write_pos++] = x;
}

inline void fast_flush() {
    if (write_pos) fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}

inline void writeInt(int x) {
    if (x < 0) fast_writechar('-'), x = -x;

    char s[24];
    int n = 0;
    while (x || !n) s[n++] = '0' + x % 10, x /= 10;
    while (n--) fast_writechar(s[n]);
}

inline void writeWord(const char *s) {
    while (*s) fast_writechar(*s++);
}


#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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

int g(int a,int b){
	int c=max(a,b),d=min(a,b);
	if(c%d==0) return d;
	else return g(d,c%d);
}
int main(){

	int n,p,q,r;
	cin >> n;

	if(n==2){
		cin >> p >> q;

		REP(i,1,g(p,q))
		if(g(p,q)%i==0) cout << i << endl;

	}

	if(n==3){
		cin >> p >> q >> r;

		REP(i,1,g(g(p,q),r))
		if(g(g(p,q),r)%i==0) cout << i << endl;

	}

	return 0;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cctype>
using namespace std;
void _2();
void _3();
int main(){

    int n;
    scanf("%d",&n);

    (n == 2) ? _2() : _3();

    return 0;
}
void _2(){

    int a,b;
    scanf("%d%d",&a,&b);
    int mi = min(a,b);
    for(int i = 1; i <= mi; i++){
        if(a % i == 0 && b % i == 0){
            printf("%d\n",i);
        }
    }
    return;
}
void _3(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int mi = min(a,min(b,c));
    for(int i = 1; i <= mi; i++){
        if(a % i == 0 && b % i == 0 && c % i == 0){
            printf("%d\n",i);
        }
    }
    return;
}


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

int main() {
	int n, p;
	while( cin >> n >> p, n || p ) {
		vector<int>data( n );
		int now = 0, P = p;
		while( 1 ) {

			for( size_t i = 0; i < n; i++ ) {
				data[i] += p / n;
			}

			p %= n;

			for( size_t i = 0; i < p; i++ ) {
				now++;
				now %= n;
				data[now]++;
			}

			now++; now %= n;
			while( !data[now] ) {
				now++; now %= n;
			}
			p = data[now];
			if( P == p ) {
				break;
			}
			data[now] = 0;
			//cout << p << P << endl;
			//cout << data[0] << data[1] << data[2] << endl;
		}
		now--;
		if( now < 0 ) {
			now = n - 1;
		}
		cout << now << endl;
	}
}

#include<bits//stdc++.h>
using namespace std;
int main(){
	int n,p;
	while(cin>>n>>p&&n!=0&&p!=0){
		int a[50];
		fill(a,a+n,0);
		int m=0,p2=p;
		while(true){
			if(p==0){
				p+=a[m];
				a[m]=0;
			}
			else{
				p--;
				a[m]++;
			}
			if(p==0&&a[m]==p2) break;
			m++;
			if(m==n) m=0;
		}
		cout<<m<<endl;
	}
}


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

int main(){
  int K,N;
  cin>>N>>K;
  double p[N];
  vector<double>t(N+1,0);
  for(int i=0;i<N;i++){
    cin>>p[i];
    t[i+1]=t[i]+p[i]*(0.5)+0.5;
    //cout<<i<<" "<<t[i]<<endl;
  }
  double maxp=0;
  for(int i=0;i<N-K+1;i++){
    maxp=max(maxp,t[i+K]-t[i]);
  }
  cout<<setprecision(18)<<maxp<<endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/********************************************************************/
#define M1 1000000007
#define M2 998244353
const double pi = 3.14159265;

#define ll long long
#define pll pair<ll,ll>

#define forr(i, n) for(ll i=0;i<n;i++)

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>

#define CASE(t) ll t; cin>>t; while(t--)

#define endl '\n'
#define space ' '
#define enter cout<<endl
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define collect(v, n) for(ll i = 0; i < n;i++){cin>>v[i];}

#define deci(n) fixed << setprecision(n)		//sets no of digits to show after decimal
#define setcount(n) __builtin_popcount(n)       //the number of ones in the int
#define setcountll(n) __builtin_popcountll(n)   //the number of ones in the ll
#define parity(n) __builtin_parity(n)			//the parity (even or odd) of the number of ones
#define clz(n) __builtin_clz(n)					//the number of zeros at the beginning of the number
#define clzll(n) __builtin_clzll(n)				//the number of zeros at the beginning of the ll
#define ctz(n) __builtin_ctz(n)					//the number of zeros at the end of the number

void deb(ll x) { cout << x << endl;}
void deb(int x) { cout << x << endl;}
void deb(unsigned int x) { cout << x << endl;}
void deb(unsigned ll x) { cout << x << endl;}
void deb(float x) { cout << x << endl;}
void deb(double x) { cout << x << endl;}
void deb(long double x) { cout << x << endl;}
void deb(char x) {cout << '\'' << x << '\'' << endl;}
void deb(string s) { cout << '\"' << s << '\"' << endl;}
void deb(vector<ll> v) { for (auto x : v) cout << x << ' '; cout << endl;}
void deb(bool bb) {cout << (bb ? "True" : "False") << endl;}
void deb(map<ll, ll> mpp) {for (auto x : mpp) cout << x.first << ' ' << x.second << endl;}
void deb(pair<ll, ll> pp) { cout << "{" << pp.first << "," << pp.second << "}" << endl;}

ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd((ll) y % x, (ll) x);
}

template<typename T>
#define o_set(T) tree<T, null_type,less_equal<T>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
// MULTISET ==> less_equal
// SET ==> less

ll powM(ll x, ll y, ll m) {
	ll ans = 1, r = 1;
	x %= m;
	while (r > 0 && r <= y) {
		if (r & y) {
			ans *= x;
			ans %= m;
		}
		r <<= 1;
		x *= x;
		x %= m;
	}
	return ans;
}

map<long long, long long> factorize(long long n) {
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}

ll countBits(ll n) {
	ll count = 0;
	while (n)
	{
		count++;
		n >>= 1;
	}
	return count;
}

ll isP(ll n) {
	if (n == 0 || n == 1)
		return 0;
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)
			return 0;
	}
	return 1;
}

/* **********END OF TEMPLATE*********** */

ll check(ll ar[], ll mid, ll k, ll n) {
	ll tmp = 0;
	for (ll i = 0; i < n; i++) {
		tmp += (ar[i] / mid + (ar[i] % mid != 0) - 1);

	}
	if (tmp <= k)
		return 1;

	return 0;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	ll k;
	cin >> n >> k;
	double ar[n];
	for (ll i = 0; i < n; i++) {
		cin >> ar[i];
		ar[i] = (double)(ar[i] + 1) / (double)2;
	}
	double prefs[n + 1];
	prefs[0] = 0.0000;
	for (ll i = 0; i < n; i++) {
		prefs[i + 1] = prefs[i] + ar[i];
	}
	double mx = -1;
	for (ll i = k; i <= n; i++) {
		if (prefs[i] - prefs[i - k] > mx)
			mx = (prefs[i] - prefs[i - k]);
	}
	cout << deci(10) << mx << endl;

	return 0;
}


// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

// Main Code
int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n) rep(j, m) {
        cin >> a[i][j];
        --a[i][j];
    }

    vector<bool> use(m, true);
    int ans = inf;
    while (true) {
        vector<int> cnt(m, 0);
        rep(i, n) rep(j, m) {
            if (use[a[i][j]]) {
                ++cnt[a[i][j]];
                break;
            }
        }
        int mx = 0;
        rep(i, m) chmax(mx, cnt[i]);
        if (mx == 0) break;
        chmin(ans, mx);
        rep(i, m) {
            if (cnt[i] == mx) use[i] = false;
        }
    }

    cout << ans << "\n";
    return 0;
}

#include<stdio.h>

int h,w;
int map[20][20];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};

int ans;
int out(int y,int x){
	return y<0||h<=y||x<0||w<=x;
}
void search(int depth,int y,int x){
	int i,ny,nx;
	if(ans <= depth)return;
	for(i=0;i<4;i++){
		ny = y+dy[i];
		nx = x+dx[i];
		if(out(ny,nx) || map[ny][nx]==1)continue;
		do{
			if(map[ny][nx]==3){
				ans = depth;
				return;
			}
			ny += dy[i];
			nx += dx[i];
		}while(!out(ny,nx) && map[ny][nx]!=1);
		if(!out(ny,nx) && map[ny][nx]==1){
			map[ny][nx]=0;
			search(depth+1,ny-dy[i],nx-dx[i]);
			map[ny][nx]=1;
		}
	}
}
int main(){
	int i,j;
	int sy,sx;
	while(scanf("%d%d",&w,&h), w|h){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				scanf("%d",&map[i][j]);
				if(map[i][j]==2){
					sy=i;sx=j;
				}
			}
		}
		ans=11;
		search(1,sy,sx);
		printf("%d\n",ans==11?-1:ans);
	}
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<double, double> pdd;
typedef pair<ll, pii> key;

ll facs[1005];
ll ifacs[1005];
const int MOD = 1000000007;

ll modpow(ll b, ll e, ll m) {
  ll r = 1;
  while(e) {
    if(e%2) {
      r*=b;
      r%=m;
    }
    b*=b;
    b%=m;
    e/=2;
  }
  return r;
}

ll solve(int sz, int num) {
  ll ret = facs[sz*num];
  for(int i = 0; i < num; i++) {
    ret *= ifacs[sz];
    ret %= MOD;
  }
  ret *= ifacs[num];
  ret %= MOD;
  // cout << num << " groups of size " << sz << " is " << ret << endl;
  return ret;
}

ll dp[1005];
ll ndp[1005];

void solve() {
  facs[0] = 1;
  for(int i = 1; i <= 1000; i++) {
    facs[i] = facs[i-1] * i;
    facs[i] %= MOD;
  }
  ifacs[1000] = modpow(facs[1000], MOD-2, MOD);
  for(int i = 999; i >= 0; i--) {
    ifacs[i] = ifacs[i+1] * (i+1);
    ifacs[i] %= MOD;
  }
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  dp[0] = 1;
  for(int x = a; x <= b; x++) {
    memset(ndp, 0, sizeof(ndp));
    for(int y = c; y <= d; y++) {
      for(int i = 0; i + x*y <= n; i++) {
        if(dp[i] == 0) continue;
        ll scale = facs[i+x*y];
        scale *= ifacs[x*y];
        scale %= MOD;
        scale *= ifacs[i];
        scale %= MOD;
        scale *= solve(x, y);
        scale %= MOD;
        ndp[i+x*y] += dp[i] * scale;
        ndp[i+x*y] %= MOD;
      }
    }
    for(int i = 0; i <= n; i++) {
      dp[i] += ndp[i];
      dp[i] %= MOD;
    }
  }
  cout << dp[n] << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << " ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}

#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    vector<string>s(N);
    rep(i, N)cin >> s[i];
    int M; cin >> M;
    vector<string>t(M);
    rep(i, M)cin >> t[i];
    vector<int>v(N+1);
    rep(i, N) {
        rep(j, N)if (s[i] == s[j])v[i]++;
        rep(j, M)if (s[i] == t[j])v[i]--;
    }
    sort(v.begin(), v.end());
    cout << v[N] << endl;
}


#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string solve(string s)
{
    int n = s.size();
    for(;;){
        for(int i=0; i<n; ++i){
            if('a' <= s[i] && s[i] <= 'z'){
                if(s[i] == 'z')
                    s[i] = 'a';
                else
                    ++ s[i];
            }
        }
        istringstream iss(s);
        string s1;
        while(iss >> s1){
            if(s1 == "the" || s1 == "this" || s1 == "that")
                return s;
        }
    }
}

int main()
{
    for(;;){
        string s;
        getline(cin, s);
        if(s == "")
            return 0;

        cout << solve(s) << endl;
    }
}

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    string result="";
    while(n){
        n--;
        result+=(char)('a'+(n%26));
        n/=26;
    }

    reverse(result.begin(),result.end());
    cout<<result<<endl;
}


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

void solve(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    vector<long long> ac(N+1, 0);
    vector<long long> wa(N+1, 0);
    for(int i = 0; i < M; ++i){
        if(ac[p[i]] == 0){
            if(S[i] == "AC") ac[p[i]] = 1;
            else wa[p[i]] += 1;
        }
    }
    //for(auto i : ac) cout << "AC: " << i << endl;
    //for(auto i : wa) cout << "WA: " << i << endl;
    long long cnt_wa = 0;
    for(int i = 0; i < N + 1; ++i){
        if(ac[i] == 1) cnt_wa += wa[i];
    }
    cout << accumulate(ac.begin(), ac.end(), 0LL) << " " << cnt_wa << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

const double PI = 3.14159265358979323846;

int main() {
    int n, m, a[1001], b[1001];
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }

    int r[1001] = {};

    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) {
            if (a[j] <= b[i]) {
                r[j]++;
                break;
            }
        }
    }

    int max = 0;
    int maxI = 0;
    for (int k = 0; k < n; ++k) {
        if (max < r[k]) {
            max = r[k];
            maxI = k;
        }
    }

    cout << maxI + 1 << endl;

    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>;
const int MAX = 100000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
//setprecision(15)

#define MAX_T 1000+1
int T[MAX_T];

// 素因数分解O(√n)
map<int, int> prime_factor(int n) {
	map<int, int> res;
	for (int i = 2; i*i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

int main() {
	int N; cin >> N;
	for (int i = 2; i <= N; i++) {
		map<int, int> ma = prime_factor(i);
		for (auto j = ma.begin(); j != ma.end(); j++) {
			T[j->first] += j->second;
		}
	}
	ll ans = 1;
	for (int i = 2; i < MAX_T; i++) {
		if (T[i] == 0) continue;
		ans = ans * (T[i] + 1) % MOD;
	}
	cout << ans << endl;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <map>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main()
{
    int x,y,z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << " " << y << " " << z << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b,c;
    int x,y;
    cin>>a>>b>>c;
    x=a.size();
    y=b.size();
    if(a[x-1]==b[0] && b[y-1]==c[0])
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a,b;
    cin >> a >> b;
    if(a == b) cout << a + b << endl;
    else if(a > b) cout << a*2-1 << endl;
    else cout <<b*2-1 << endl;
    return 0;
}

#include<iostream>
using namespace std;
int main ()
{
    int a,b;
    int m,n,j,k;
    cin>>a>>b;
    m=a+(a-1);
    n=b+(b-1);
    k=a+b;
    if( m>n && m>k)
        cout<<m<<endl;
    else if (n>m &&n>k)
        cout<<n<<endl;
    else
        cout<<k<<endl;
    return 0;
}


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

const int limit = 100010;
vector<int> graph[2][limit];

void add_edge(int from, int to) {
	graph[0][from].push_back(to);
	graph[1][to].push_back(from);
}

auto scc(int n) {
	vector<int> order(n);
	iota(begin(order), end(order), 0);
	vector<int> comp;

	rep(type, 2) {
		stack<int> stk;
		vector<int> norder;
		vector<int> itr(n, 0);

		comp.assign(n, -1);
		int idx = 0;

		/*
		rep(i, n) cerr << order[i] << " ";
		cerr << endl;
		*/

		for (auto &it : order) {
			if (comp[it] != -1) continue;
			stk.push(it);

			while (!stk.empty()) {
				const int v = stk.top();
				comp[v] = idx;

				for(int &i = itr[v]; i < graph[type][v].size();++i){
					const int v2 = graph[type][v][i];
					if (comp[v2] == -1){
						stk.push(v2);
						break;
					}
				}

				if(itr[v] == graph[type][v].size()){
					norder.push_back(v);
					stk.pop();
				}
			}
			idx++;
		}

		if (type == 1) break;
		reverse(begin(norder), end(norder));
		order = norder;
	}

	return make_tuple(order, comp);
}

vector<int> order, comp;

int main(void) {
	int n, m;
	cin >> n >> m;

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		add_edge(a, b);
	}

	tie(order, comp) = scc(n);

	int q;
	cin >> q;
	rep(loop,q){
		int u,v;
		cin >> u >> v;
		if(comp[u]==comp[v])
			puts("1");
		else
			puts("0");
	}

	return 0;
}

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

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

const double PI = 3.14159265358979;

struct Edge{ ll cost, to; };
void solve()
{
  ll n, a, b, c;
  cin >> n;
  vector< vector<Edge> > G(n, vector<Edge>());
  for(int i = 0; i < n - 1; ++i)
  {
    cin >> a >> b >> c;
    a--; b--;
    G[a].emplace_back(Edge{c, b});
    G[b].emplace_back(Edge{c, a});
  }

  ll q, k, x, y;
  cin >> q >> k;
  k--;

  const ll INF = 1LL << 60;
  vector<ll> d(n, INF);
  d[k] = 0;
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, k)); // P(cost, start)
  while (!que.empty())
  {
    P p = que.top();
    que.pop();
    ll node = p.second;
    if (d[node] < p.first) continue;
    for (const auto& edge : G[node])
    {
        if (d[edge.to] > d[node] + edge.cost)
        {
            d[edge.to] = d[node] + edge.cost;
            que.push(P(d[edge.to], edge.to));
        }
    }
  }

  for(int i = 0; i < q; ++i)
  {
    cin >> x >> y;
    x--; y--;
    cout << d[x] + d[y] << endl;
  }

}

int main()
{
  fastio;
  solve();

  return 0;
}


#include<iostream>
#include<queue>
#include<utility>
using namespace std;

long int inf=100000*100000+100;
int main()
{
    int v,e,r;
    int s[500000];
    int t[500000];
    int d[500000];
    long int dis[100000];
    cin>>v>>e>>r;
    for(int i=0;i<e;i++)
    {
        cin>>s[i]>>t[i]>>d[i];
    }

    for(int i=0;i<v;i++)
    {
        dis[i]=inf;
    }
    dis[r]=0;

    for(int i=0;i<v-1;i++)
    {
        int end=1;
        for(int j=0;j<e;j++)
        {
            if(dis[t[j]]>dis[s[j]]+d[j])
            {
                dis[t[j]]=dis[s[j]]+d[j];
                end=0;
            }
        }

        if(end==1)
            break;
    }

    for(int i=0;i<v;i++)
    {
        if(dis[i]==inf)
            cout<<"INF"<<endl;
        else
            cout<<dis[i]<<endl;
    }
}

#include <iostream>
#define N 21
using namespace std;

int main(){
  int n,m,x,y,rx,ry,l,cnt,d[N][N];
  char c;
  while(1){
    for(int i=0;i<N;i++)
      for(int j=0;j<N;j++) d[i][j]=0;
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++) cin>>x>>y,d[N-y-1][x]=1;
    cin>>m;
    rx=ry=10;
    cnt=0;
    while(m--){
      cin>>c>>l;
      while(l--){
	if(c=='N') ry--;
	if(c=='E') rx++;
	if(c=='S') ry++;
	if(c=='W') rx--;
	if(d[ry][rx]) d[ry][rx]=0,cnt++;
      }
    }
    if(cnt==n) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b=180;
  cin>>a;
  cout<<b*(a-2)<<"\n";
}

/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

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

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}

	int N;
	std::cin >> N;
	std::cout << (180 * (N-2)) << "\n";
}


#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

const int oo=1000000000;

int n,m;
int f[1<<15][16][16];
int g[16][16];

int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	while (cin>>n>>m)
	{
		memset(g,255,sizeof(g));
		REP(i,m)
		{
			int x,y,z;
			cin>>x>>y>>z;
			--x;
			--y;
			g[x][y]=g[y][x]=z;
		}
		REP(set,two(n))
		{
			REP(x,n) REP(y,n) f[set][x][y]=oo;
			if (!contain(set,0)) continue;
			if (contain(set,n-1) && set!=two(n)-1) continue;
			REP(x,n) f[set][x][x]=0;
			for (int set1=set-1;set1>0;set1=((set1-1)&set))
			{
				if (!contain(set1,0)) continue;
				int set2=(set^set1);
				int base=0;
				REP(x,n) if (contain(set1,x)) REP(y,n) if (contain(set2,y) && g[x][y]>=0) base+=g[x][y];
				REP(x,n) if (contain(set1,x)) REP(y,n) if (contain(set1,y)) REP(z,n) if (contain(set2,z) && g[y][z]>=0)
				{
					ckmin(f[set][x][z],base+f[set1][x][y]-g[y][z]);
				}
			}
		}
		printf("%d\n",f[two(n)-1][0][n-1]);
#ifndef _MSC_VER
		system("pause");
#endif
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <list>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,b,n) for(int i=b;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

int B[102][102];
int M[102][102];
int w, h, xs, ys, xg, yg, n, res;

void bfs(int x, int y, int c) {
  if(x <= 0 || y <= 0 || x > w+1 || y > h+1)
    return;
  if(B[x][y] != c)
    return;
  if(M[x][y] == 1) {
    return;
  } else {
    M[x][y] = 1;
  }
  if(x == xg && y == yg) {
    res = 1;
    return;
  }
  bfs(x+1, y, c);
  bfs(x, y+1, c);
  bfs(x-1, y, c);
  bfs(x, y-1, c);
}

int main() {
  while(cin >> w >> h, w) {
    // ?????????
    rep(i, w+1) {
      rep(j, h+1) {
        B[i][j] = 0;
        M[i][j] = 0;
      }
    }
    res = 0;
    cin >> xs >> ys;
    cin >> xg >> yg;
    cin >> n;
    // ??????????????????
    rep(i, n) {
      int c, d, x, y;
      cin >> c >> d >> x >> y;

      B[x][y] = c;
      B[x+1][y] = c;
      B[x][y+1] = c;
      B[x+1][y+1] = c;
      if ( d == 0 ) {
        B[x+2][y] = c;
        B[x+3][y] = c;
        B[x+2][y+1] = c;
        B[x+3][y+1] = c;
      } else {
        B[x][y+2] = c;
        B[x][y+3] = c;
        B[x+1][y+2] = c;
        B[x+1][y+3] = c;
      }
    }
    if(B[xs][ys] != 0)
      bfs(xs, ys, B[xs][ys]);
    if(res)
      cout << "OK" << endl;
    else
      cout << "NG" << endl;
  }

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll sum[1000000+5];
void Get(ll l,ll r,ll &first,ll &second)
{
    ll res =INT_MAX;
    ll left = l;
    ll right = r-1;
    while(left<=right)
    {
        ll mid = (left+right)>>1;
        ll a = sum[mid]-sum[l-1];
        ll b = sum[r]-sum[mid];
        if(abs(a-b)<res)
        {
            res = abs(a-b);
            first= a;
            second  = b;
        }
        if(a<=b)
        {
            left = mid+1;
        }
        else
        {
            right = mid-1;
        }
    }
}
int main()
{
    ll n;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
    	int x;
    	cin>>x;
    	sum[i] =sum[i-1]+x;
    }
    // for(int i=0;i<=n;i++)
    // {
    // 	cout<<sum[i]<<" ";
    // }
    // cout<<endl;
    ll result =INT_MAX;
    for(ll i=2;i<=n-2;i++)
    {
        ll a;
        ll b;
        Get(1,i,a,b);
        ll c,d;
        Get(i+1,n,c,d);
	//	cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
        ll mx = max(max(a,b),max(c,d));
        ll mn = min(min(a,b),min(c,d));
        result = min(result,abs(mx-mn));
    }
    cout<<result<<endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> A(N);
	vector <ll> B(N);
	vector <ll> C(N);
	for (int ii = 0; ii < N; ++ii) cin >> A[ii];
	for (int ii = 0; ii < N; ++ii) cin >> B[ii];
	for (int ii = 0; ii < N; ++ii) cin >> C[ii];
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());

	ll ans = 0;
	for (int ii = 0; ii < N; ++ii){
		ll sum = 0;
		auto aitr = lower_bound(A.begin(), A.end(), B[ii]);
		ll anum = (aitr!=A.begin()) ? aitr - A.begin() : 0;

		auto citr = upper_bound(C.begin(), C.end(), B[ii]);
		ll cnum = C.end() - citr;

		ans += anum * cnum;
	}

	cout << ans << "\n";

	return 0;
}


// Alapan
// IIITH

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

// data types
#define ll long long int
#define ld long double

//funtion macros

// stl
#define lp(var,start,end) for (ll var = start; var <=end ; ++var)
#define ilp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))

#define mod 1000000007

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

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

ll power(ll x, ll y, ll m=mod){
	if(y<0){
		x = power(x,m-2);
		y = -y;
	}
	ll ans=1;
	x = x % m;
	while(y){
		if(y&1) ans = (ans*x)%m;
		y=y/2;
		x=(x*x)%m;
	}
	return ans;
}

ll factorial(ll n, ll m=mod){
    ll ans = 1;
	ll i = 1;
    while(i<=n){
        ans = (ans*i)%m;
        i++;
    }
    return ans;
}

///////////////////////////////////////////////////////////
ll n,m,v,p;
bool f(ll arr[], ll mid){
    // cout << mid << "\n";
    ll temp[n];
    for(ll i=0;i<n;i++){
        temp[i] = arr[i];
    }
    ll val = temp[mid] + m;
    ll i=0;
    ll cnt = (v-1)*m;
    ll more=0;
    ll alreadymore = 0;
    for(ll i=0;i<n;i++){
        if(val < temp[i]) alreadymore++;
        if(alreadymore >= p) return 0;
    }
    while(more < p-1 && i<n){
        if(i!= mid) cnt -= m;
        if(cnt <= 0) return true;
        if(temp[i]+m > val) more++;
        i++;
    }
    if(temp[i] > val) return false;
    while(i<n){
        if(i!=mid) cnt = cnt - min((val-temp[i]),m);
        if(cnt <= 0) return true;
        i++;
    }
    return false;
}
int main(){
    cin >> n >> m >> v >> p;
    ll arr[n];
    for(ll i=0;i<n;i++){
        cin >> arr[i];
    }
    sort(arr,arr+n);
    reverse(arr,arr+n);
    // for(ll i=0;i<n;i++) cout << arr[i] << " ";
    // cout << endl;
    ll l = 0;
    ll r = n-1;
    while(l < r){
        ll mid = l + (r-l+1)/2;
        if(f(arr,mid)) l = mid;
        else r = mid-1;
    }
    cout << l+1 << endl;
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, a, b; cin >> n >> a >> b;
    vi x(n, 0);
    ll sum = 0;
    rep(i, n){
        cin >> x[i];
        if(i > 0) sum += (a*(x[i]-x[i-1]) > b) ? b : a*(x[i]-x[i-1]);
    }
    cout << sum << endl;
}


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

int main(void){
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}

#include <iostream>
#include <string>

int main()
{
    int A, B, C;
    std::cin >> A; std::cin >> B; std::cin >> C;
    std::cout << std::to_string(C) + " " + std::to_string(A) + " " + std::to_string(B) << std::endl;
}


#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <regex>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pl4 = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpl4 = vector<pl4>;
using vvpl4 = vector<vpl4>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define sz size()
#define be begin()
#define en end()
#define asn assign
#define emp empty()
#define ft front()
#define bk back()
#define clr clear()
#define ins insert
#define era erase

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).be,(a).en)
#define rSORT(a) sort((a).rbegin(),(a).rend())
#define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en)
#define PREVP(a) prev_permutation((a).be,(a).en)
#define NEXTP(a) next_permutation((a).be,(a).en)
#define BINS(a,b) binary_search((a).be,(a).en,(b))
#define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be)
#define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be)
#define CNT(a,b) count((a).be,(a).en,b)
#define SUM(a) accumulate((a).be,(a).en,0)
#define REV(a) reverse((a).be,(a).en)
#define REGS(a,b) regex_search((a),regex(b))
#define REGM(a,b) regex_match((a),regex(b))
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define say(a) cout <<(a);
#define sal(a) cout <<(a)<<endl;
#define sak cout <<endl;
#define dbg(a) cout <<(#a)<<": "<<(a)<<endl;
#define a2l(a) ((ll)(a-97))
#define A2l(a) ((ll)(a-65))
#define l2a(a) ((char)(a+97))
#define l2A(a) ((char)(a+65))
#define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1))
#define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1))
#define Dig2(a,b) (((a)>>(b))&1)
#define Pow2(a) (1<<(a))

#define int ll

const ll MOD = 1e9+7;
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

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

ll SalV(vll v){
    say("{");
    FOR(i,0,v.sz-1){
        say(v[i]);
        if(i!=v.sz-1) say(",");
    }
    sal("}")
}

ll DigS10(ll n){
    ll m=0;
    FOR(i,0,DigN10(n)-1){
        m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i)));
    }
    return m;
}

ll isP(ll n){
    if(n<=1) return 0;
    FOR(i,2,(ll)sqrt(n)){
        if(n%i==0) return 0;
    }
    return 1;
}

signed main() {

    ll K;
    cin >>K;
    sal(50);
    if(K%50==0){
        FOR(i,0,49){
            say(49+K/50);
            if(i!=49) say(" ");
        }
    }
    if(K%50!=0){
        FOR(i,1,K%50){
            say(99+(K/50)-(K%50));
            say(" ");
        }
        FOR(i,1,50-(K%50)){
            say(49+(K/50)-(K%50));
            if(i!=(50-(K%50))) say(" ");
        }
    }

}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;

int K;

signed main() {
    IOS();
    cin>>K;
    int x=K/50,y=K%50;
    int N=50;
    vint a(N,49+x);
    rep(i,0,50){
        a[i]-=y;
        if(i<y)a[i]+=50;
    }
    cout<<50<<endl;
    rep(i,0,50){
        if(i)cout<<" ";
        cout<<a[i];
    }
    cout<<endl;

    return 0;
}


#include <cstdio>
//#include <iostream>
//#include <string>

using namespace std;

// cl /EHsc xxx.cpp
int main(int argc, char *argv[])
{
	int n;
	scanf("%d", &n);

	int *ary = new int[n];

	int v;
	int t = n;
	while (t)
	{
		scanf("%d", &v);
		ary[--t] = v;
	}

	for (int j = 0; j < n; j++)
	{
		printf((j == n-1) ? "%d\n" : "%d ", ary[j]);
	}

	delete[] ary;

	return 0;
}

#include <iostream>

int main(int argc, char** argv)
{
	int n;
	std::cin >> n;

	int a[100];
	for (int i = 0; i < n; ++i)
	{
		std::cin >> a[i];
	}

	for (int i = n - 1; i > 0; --i)
	{
		std::cout << a[i] << " ";
	}

	std::cout << a[0] << std::endl;
}