#include <bits/stdc++.h>

using namespace std;

int n,k;

int sssp(int s, int g,vector<vector<int> > ship){
  priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
  vector<bool> used(n+1,false);

  q.push(make_pair(0,s));
  while(!q.empty()){
    int cost=q.top().first,now=q.top().second; q.pop();
    used[now]=true;
    if(now==g) return cost;

    for(int i=1;i<=n;++i){
      if(ship[now][i]==1000005) continue;
      int ncost=cost+ship[now][i],nexto=i;
      if(used[nexto]==false) q.push(make_pair(ncost,nexto));
    }
  }
  return -1;
}

int main(){
  while(cin >> n >>k && (n || k)){
    vector<vector<int> > ship(n+1,vector<int>(n+1,1000005));
    while(k--){
      int info; cin >> info;
      if(info==0){
	int a,b; cin >> a >> b;
	cout << sssp(a,b,ship) << endl;
      }else{
	int c,d,e; cin >> c >> d >> e;
	ship[c][d]=ship[d][c]=min(ship[c][d],e);
      }
    }
  }

  return 0;
}

#include <algorithm>
#include <iostream>
#include <limits.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed

using namespace std;

class Point
{
private:
  int m_x;
  int m_y;
public:
  void setX(int x);
  void setY(int y);
  int getX();
  int getY();

  Point(int x, int y) {
    setX(x);
    setY(y);
  }
};

void Point::setX(int x) {
  m_x = x;
}

void Point::setY(int y) {
  m_y = y;
}

int Point::getX() {
  return m_x;
}

int Point::getY() {
  return m_y;
}

int main() {
  int N, x, y, M, l, rx, ry;
  string d;
  while (1) {
    cin >> N;
    vector<Point> gems;
    if (N == 0) break;
    for (int i = 0; i < N; i++) {
      cin >> x >> y;
      gems.push_back(Point(x, y));
    }
    cin >> M;
    rx = 10;
    ry = 10;
    while (M--) {
      cin >> d >> l;
      while (l--) {
        if (d == "N") ry++;
        if (d == "E") rx++;
        if (d == "S") ry--;
        if (d == "W") rx--;
        for (int i = 0; i < gems.size(); i++) {
          if (rx == gems[i].getX() && ry == gems[i].getY()) {
            gems.erase(gems.begin()+i);
            break;
          }
        }
      }
    }
    if (gems.empty()) cout << "Yes" << el;
    else cout << "No" << el;
  }
}


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

#include <algorithm>
#include <iostream>

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

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll A, ll B, ll C, ll D) {
  cout <<   min(A,B) + min(C,D) << endl;
}

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;
  ll C;
  cin >> C;
  ll D;
  cin >> D;
  solve(A, B, C, D);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, k, r = 1;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        r += min(r, k);
    cout << r;
}

#include <stdio.h>
int main(){

	int n,k,bank = 1;

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

	for(int i = 0 ; i < n ; i++){
		if(bank * 2 > bank + k){
			bank += k;
		}
		else{
			bank *= 2;
		}
	}
	printf("%d" , bank);

	return 0;
}


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

int main() {

	string S;
	cin >> S;

    bool a[26];
    for (int i = 0; i < 26 ; ++i) a[i] = false;

    for (int i = 0; i < S.size(); ++i) {
        a[S[i] - 'a'] = true;
    }

    for (int i = 0; i < 26; ++i) {
        if (!a[i]) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }

    cout << "None" << endl;
    return 0;

}

#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

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

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int r; cin >> r;
	if (r < 1200)cout << "ABC" << endl;
	else if (r < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;
	return 0;
}


#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cerr<<elem;}cerr<<endl;}

template<typename Type,typename Type_k>
Type ipow(Type n,Type_k k){//n^k. O(log n).
	if(k==0) return 1;
	Type res=ipow(n*n,k/2);
	if(k&1) res*=n;
	return res;
}

int main(){//解説参考.
	llong n;
	cin>>n;

	string ans="";
	for(int i=0;n!=0;++i){
		llong tmp=ipow(-2LL,i);
		if(n%(-2*tmp)){
			n-=tmp;
			ans+='1';
		}else ans+='0';
	}
	if(ans=="") ans="0";
	else reverse(ALL(ans));

	cout<<ans<<endl;
}

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int x;

	scanf("%d", &x);

	x = x * x * x;

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

	return (0);
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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

	ll N, D;
	cin >> N >> D;
	int A[200001];
	ll C[200001];
	C[0] = 1e18;
	ll motomoto = (N - 1) * D;
	rep1(i, N) {
		cin >> A[i];
		motomoto += A[i];
		C[i] = min(C[i - 1], A[i] - i * D);
	}
	ll saishou = 1e18;
	ll setuyaku = 0;
	for (int i = N - 1; i > 1; i--) {
		saishou = min(saishou, A[i + 1] + (i + 1) * D);
		motomoto += A[i];
		ll kari = min(saishou - i * D, C[i - 1] + i * D);
		if (A[i] > kari) setuyaku += A[i] - kari;
	}
	co(motomoto - setuyaku);

	Would you please return 0;
}

#include<bits/stdc++.h>
#define maxn 505050

using namespace std;
typedef long long ll;
struct edge{
    ll x,y,z;
}e[maxn*4];
ll ans,pre[maxn],fa[maxn],n,a[maxn],b[maxn],c[maxn],d,p,q;
int l[maxn],r[maxn];

int ffind(int x){
    if (pre[x]==x) return x;
    pre[x]=ffind(pre[x]); return pre[x];
}

void union_(int u,int v){
    pre[v]=u;
    b[u]=min(b[u],b[v]);
    c[u]=min(c[u],c[v]);
}

bool cmp(edge x,edge y){
    return x.z<y.z;
}

ll cost(int u,int v){
    return 1ll*abs(u-v)*d+a[u]+a[v];
}
ll f[maxn],g[maxn];

int main(){
    cin >> n >> d; int cnt=0;
    for (int i=1;i<=n;i++) cin >> a[i];
    for (int i=1;i<=n;i++) fa[i]=pre[i]=i,b[i]=a[i]-d*i,c[i]=a[i]+d*i;
    int tot=n;
    while (tot>1){
        int p=1; ll res=b[fa[1]];
        for (int i=2;i<=tot;i++){
            ll tmp=c[fa[i]];
            f[i]=tmp+res,g[i]=p;
            if (b[fa[i]]<res) res=b[fa[i]],p=i;
        }
        int q=n; res=c[fa[tot]];
        for (int i=tot-1;i;i--){
            ll tmp=b[fa[i]];
            if (i==1||tmp+res<f[i]) f[i]=tmp+res,g[i]=q;
            if (c[fa[i]]<res) res=c[fa[i]],q=i;
        }
        for (int i=1;i<=tot;i++){
            int u=ffind(fa[i]),v=ffind(fa[g[i]]);
            if (u!=v) union_(u,v),ans+=f[i];
        }
        tot=0;
        for (int i=1;i<=n;i++){
            fa[++tot]=ffind(i);
            while (i<n&&ffind(i+1)==fa[tot]) i++;
        }
    }
    cout << ans << endl;
}


#include <iostream>
using namespace std;

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

	cin >> x;
	long min = x, max = x, sum = x;
	for (int i=2; i<=n; i=i+1) {
		cin >> x;
		sum = sum + x;
		if (x < min) min = x;
		if (x > max) max = x;
	}

	cout << min << " " << max << " " << sum << endl;

	return 0;
}

#include <bits/stdc++.h>
#include <vector>
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long

signed main() {
   int n,k;
   cin >> n >> k;
   vector<int> l(n);
   rep(i,n) cin>>l[i];
   sort(l.begin(),l.end());
   int cnt = 0;
   int ans = 0;
   rrep(i,n) {
       cnt++;
       ans+=l[i];
       if(cnt==k) break;
   }
   cout << ans << endl;

  return 0;
}


#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    while(1){
        int w, h; cin>>w>>h;
        if(w == 0) return 0;

        int sx, sy, gx, gy; cin>>sx>>sy>>gx>>gy;
        sx--, sy--, gx--, gy--;

        int n; cin>>n;
        vector<vector<int>> board(h, vector<int>(w, 0));
        while(n--){
            int c, d, x, y; cin>>c>>d>>x>>y;
            x--, y--;
            if(d == 0){
                for(int i=y; i<=y+1; i++){
                    for(int j=x; j<=x+3; j++){
                        board[i][j] = c;
                    }
                }
            }
            else{
                for(int i=y; i<=y+3; i++){
                    for(int j=x; j<=x+1; j++){
                        board[i][j] = c;
                    }
                }
            }
        }

        queue<P> que;
        que.push(P(sy, sx));
        int color = board[sy][sx];
        board[sy][sx] = 0;
        if(color == 0){
            cout << "NG" << endl;
            continue;
        }

        while(que.size()){
            int cy, cx;
            tie(cy, cx) = que.front();
            que.pop();

            if(cy == gy && cx == gx){
                cout << "OK" << endl;
                goto END;
            }

            for(int i=0; i<4; i++){
                int ny = cy + dy[i];
                int nx = cx + dx[i];

                if(0 <= ny && ny < h && 0 <= nx && nx < w){
                    if(board[ny][nx] == color){
                        board[ny][nx] = 0;
                        que.push(P(ny, nx));
                    }
                }
            }
        }

        cout << "NG" << endl;
        END:;
    }
}

#include <iostream>
#include<queue>
#include<string.h>
using namespace std;
#define TATE 1
#define YOKO 0

struct ST {
        int x;
        int y;
    };

int main(void){
    int map[101][101];
    int board[101][101];
    int T[]={0,-1,1,0};
    int Y[]={1,0,0,-1};
    int w,h,xs,xg,ys,yg,n,color,muki,x,y;

    ST RE;
    ST GO;
    queue <ST> Q;
    while(1){
        memset(map,0,sizeof(map));
        memset(board,0,sizeof(board));
        cin>>w>>h;
        if(w==0&&h==0)break;
        cin>>xs>>ys>>xg>>yg>>n;
        for(int i=0;i<n;i++){
            cin>>color>>muki>>x>>y;
            if(muki==YOKO){
                for(int j=0;j<4;j++){
                    board[y][x+j]=board[y+1][x+j]=color;
                }
            }
            else{
                for(int j=0;j<4;j++){
                    board[y+j][x]=board[y+j][x+1]=color;
                }
            }
        }
       /* for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                cout<<board[i][j];
            }
            cout<<endl;
        }*/
        RE.x=xs;
        RE.y=ys;
        map[ys][xs]=1;
        Q.push(RE);
        int flag=0;
        while(!Q.empty()){
            RE=Q.front();
            Q.pop();
            if(RE.x==xg&&RE.y==yg&&board[RE.y][RE.x]==board[yg][xg]){
                flag=1;
                //cout<<RE.x<<" "<<RE.y<<endl;
                break;
            }
            else{
                for(int i=0;i<4;i++){
                    GO=RE;
                    if(GO.x+Y[i]>0&&GO.y+T[i]>0&&GO.x+Y[i]<101&&GO.y+T[i]<101&&board[GO.y+T[i]][GO.x+Y[i]]==board[GO.y][GO.x]&&map[GO.y+T[i]][GO.x+Y[i]]!=1){
                        GO.x+=Y[i];
                        GO.y+=T[i];
                        map[GO.y][GO.x]=1;
                        Q.push(GO);
                    }
                }
            }
        }
       /* for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cout<<board[i][j];
            }
            cout<<endl;
        }*/
        if(flag==1){
            cout<<"OK"<<endl;
        }
        else{
            cout<<"NG"<<endl;
        }
    }

}


#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  rep(i, m){
    cin >> s[i] >> c[i];
  }
  bool zero=true;
    rep(i, m){
      if(c[i]!=0){
        zero=false;
        break;
      }
    }

  if(zero && n==1){
    cout << "0" << endl;
    return 0;
  }
  repo(i, 999){
    int i2=i;
    bool nflag=true;
    rep(j, n){
      if(i2==0){
        nflag=false;
        break;
      }
      i2/=10;
    }
    if(i2!=0){
      nflag=false;
    }
    if(!nflag){
      continue;
    }
    bool scflag=true;
    rep(j, m){
      int i3=i;
      int sn=n-s[j];
      rep(k, sn){
        i3/=10;
      }
      i3%=10;
      if(i3!=c[j]){
        scflag=false;
        break;
      }
    }
    if(scflag){
      cout << i << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}

/*
 * Author: ylx
 * Lang: c++
 * Prog: agc002F
 */
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x, int y)
{
    if (x < y)
        x = y;
}
void qmin(int &x, int y)
{
    if (x > y)
        x = y;
}
inline ll read()
{
    char s;
    ll k = 0, base = 1;
    while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
        ;
    if (s == EOF)
        exit(0);
    if (s == '-')
        base = -1, s = getchar();
    while (isdigit(s))
        k = k * 10 + (s ^ '0'), s = getchar();
    return k * base;
}
inline void write(ll x)
{
    static char cnt, num[20];
    cnt = 0;
    if (!x)
    {
        putchar('0');
        return;
    }
    for (; x; x /= 10)
        num[++cnt] = x % 10;
    for (; cnt; putchar(num[cnt--] + 48))
        ;
}
const int maxn = 4e6 + 100;
const ll mod = 1e9 + 7;
int jie[maxn], ny[maxn];
int n, m;
ll ksm(ll x, int y)
{
    ll sum = 1;
    while (y)
    {
        if (y & 1)
            sum = sum * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return sum;
}
void init()
{
    n = 4e6;
    jie[0] = 1;
    for (int i = 1; i <= n; i++)
        jie[i] = (ll)jie[i - 1] * i % mod;
    ny[n] = ksm(jie[n], mod - 2);
    for (int i = n; i >= 1; i--)
        ny[i - 1] = (ll)ny[i] * i % mod;
}
ll C(int x, int y)
{
    if (x < y)
        return 0;
    return (ll)jie[x] * ny[x - y] % mod * ny[y] % mod;
}
ll f[2][2030];
int main()
{
#ifdef ylx
    freopen("agc002F.in", "r", stdin);
    freopen("agc002F.out", "w", stdout);
#endif
    init();
    n = read(), m = read();
    if (m == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    f[0][0] = 1;
    for (int i = 1, p; i <= n; i++)
    {
        p = i & 1;
        memset(f[p], 0, sizeof(f[p]));
        for (int j = 0; j <= i; j++)
        {
            if (!j)
            {
                f[p][j] = f[p ^ 1][j];
                continue;
            }
            f[p][j] = f[p ^ 1][j] + f[p][j - 1] * (n - j + 1) % mod * C((n - j + 1) * (m - 1) + n - i - 1, m - 2) % mod;
        }
    }
    write(f[n & 1][n]);
}


#include <bits/stdc++.h>

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

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

ll keta(ll a, ll b)
{
    int cnt_a = 0, cnt_b = 0;
    while (a)
    {
        cnt_a++;
        a /= 10;
    }
    while (b)
    {
        cnt_b++;
        b /= 10;
    }
    ll ans = max(cnt_a, cnt_b);
    return ans;
}

int main()
{

    ll n;
    cin >> n;

    ll ans = 1001001001;
    for (ll a = 1; a * a <= n; a++)
    {
        if (n % a)
        {
            continue;
        }
        ll b = n / a;
        ans = min(ans, keta(a, b));
    }

    cout << ans << '\n';
    return (0);
}

#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
    inl(N, A, B);
    vll X(N);
    rep(i, N) cin >> X[i];

    ll ret = 0;
    rep(i, N - 1)
        ret += min(A * (X[i + 1] - X[i]), B);
    out(ret);
}


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

typedef pair<int, long long> pil;

bool cmp(pil lhs, pil rhs)
{
	return (lhs.first < rhs.first);
}

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

	vector<pil> p(n);

	int cnt = 0;
	for (int i = 0; i < n; i++){
			int a, b, c;
			bool f = true;
			cin >> a >> b >> c;
			for (int j = 0; j <= cnt; j++){
				if (p[j].first == a){
					p[j].second += b * c;
					f = false;
				}
			}
			if (f){
				p[cnt].first += a;
				p[cnt].second += b * c;
				cnt++;
			}
		}
		bool fl = true;
		for (int i = 0; i < cnt; i++){
			if (1000000 <= p[i].second){
				cout << p[i].first << endl;
				fl = false;
			}
		}
		if (fl){
			cout << "NA" << endl;
		}
	}
	return (0);
}

#include <iostream>
using namespace std;

#define N 8

int row[N], col[N], dpos[N * 2 - 1], dneg[N * 2 - 1];

int putQueen(int i) {
  int res = 0;
  if (i == N) return 1;
  if (row[i] != -1) return putQueen(i + 1);

  for (int j = 0; j < N; j++) {
    if (col[j] || dpos[i + j] || dneg[i - j + (N - 1)]) continue;
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + (N - 1)] = 1;
    res = putQueen(i + 1);
    if (res) return 1;
    col[j] = dpos[i + j] = dneg[i - j + (N - 1)] = 0;
    row[i] = -1;
  }
  return 0;
}

int main() {
  int k, r, c;

  for (int i = 0; i < N; i++) {
    row[i] = -1;
    col[i] = 0;
  }
  for (int i = 0; i < N * 2 - 1; i++) dpos[i] = dneg[i] = 0;

  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> r >> c;
    row[r] = c;
    col[c] = 1;
    dpos[r + c] = 1;
    dneg[r - c + (N - 1)] = 1;
  }

  putQueen(0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++)
      if (row[i] == j)
        cout << "Q";
      else
        cout << ".";
    cout << endl;
  }

  return 0;
}


#include<bits/stdc++.h>

using namespace std;

struct node
{
	int num,fa,ls,rs;
	node(int _num,int _fa)
	{
		num=_num;
		fa=_fa;
		ls=rs=-1;
	}
};

typedef vector<node> Tree;

Tree T;

void insert(int t,int n)
{
	if(T[0].num==INT_MAX)
		T[0].num=n;
	else if(T[t].num>n)
		if(T[t].ls==-1)
		{
			T[t].ls=T.size();
			T.push_back(node(n,t));
		}
		else insert(T[t].ls,n);
	else
		if(T[t].rs==-1)
		{
			T[t].rs=T.size();
			T.push_back(node(n,t));
		}
		else insert(T[t].rs,n);
}

void find(int t,int x)
{
	if(T.size()==0||t==-1)
		printf("no\n");
	else if(T[t].num==x)
		printf("yes\n");
	else if(x<T[t].num)
		find(T[t].ls,x);
	else find(T[t].rs,x);
}

void lc(int fa,int son)
{
	T[fa].ls=son;
	if(son!=-1) T[son].fa=fa;
}

void rc(int fa,int son)
{
	T[fa].rs=son;
	if(son!=-1) T[son].fa=fa;
}

void del(int t,int x)
{
	if(t==-1) return ;
	if(T[t].num==x)
	{
		if(T[t].ls==-1)
			if(T[t].rs==-1)
				if(T[T[t].fa].ls==t)
					T[T[t].fa].ls=-1;
				else T[T[t].fa].rs=-1;
			else
				if(T[T[t].fa].ls==t)
				{
					T[T[t].fa].ls=T[t].rs;
					T[T[t].rs].fa=T[t].fa;
				}
				else
				{
					T[T[t].fa].rs=T[t].rs;
					T[T[t].rs].fa=T[t].fa;
				}
		else if(T[t].rs==-1)
				if(T[T[t].fa].ls==t)
				{
					T[T[t].fa].ls=T[t].ls;
					T[T[t].ls].fa=T[t].fa;
				}
				else
				{
					T[T[t].fa].rs=T[t].ls;
					T[T[t].ls].fa=T[t].fa;
				}
			else
			{
				int mir=T[t].rs;
				while(T[mir].ls!=-1) mir=T[mir].ls;
				del(t,T[mir].num);
				T[t].num=T[mir].num;
			}
	}
	else if(x<T[t].num)
		del(T[t].ls,x);
	else del(T[t].rs,x);
}

void Preorder(int t)
{
	if(t==-1) return;
	printf(" %d",T[t].num);
	Preorder(T[t].ls);
	Preorder(T[t].rs);
}

void Inorder(int t)
{
	if(t==-1) return;
	Inorder(T[t].ls);
	printf(" %d",T[t].num);
	Inorder(T[t].rs);
}

void print()
{
	Inorder(T[1].ls);
	printf("\n");
	Preorder(T[1].ls);
	printf("\n");
}

int main()
{
	T.clear();
	T.push_back(node(INT_MAX,1));
	T.push_back(node(-1,-1));
	T[1].ls=0;
	int n;
	scanf("%d",&n);
	while(n--)
	{
		char s[10];
		scanf("%s",s);
		if(s[0]=='i')
		{
			int t;
			scanf("%d",&t);
			insert(T[1].ls,t);
		}
		else if(s[0]=='f')
		{
			int t;
			scanf("%d",&t);
			find(T[1].ls,t);
		}
		else if(s[0]=='d')
		{
			int t;
			scanf("%d",&t);
			del(T[1].ls,t);
		}
		else print();
	}
	return 0;
}


#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

int main() {
	string st;
	map<char, int>mp;
	mp['I'] = 0;
	mp['V'] = 1;
	mp['X'] = 2;
	mp['L'] = 3;
	mp['C'] = 4;
	mp['D'] = 5;
	mp['M'] = 6;

	vector<int>values{ 1,5,10,50,100,500,1000 };
	while (cin >> st) {
		vector<int>nums;
		for (auto c : st) {
			nums.push_back(mp[c]);
		}
		int sum = 0;
		for (int i = 0; i < nums.size(); ++i) {
			if (i == nums.size() - 1 || nums[i] >= nums[i + 1])sum += values[nums[i]];
			else sum -= values[nums[i]];
		}
		cout << sum << endl;

	}
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int roma[128];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    roma['I']=1;
    roma['V']=5;
    roma['X']=10;
    roma['L']=50;
    roma['C']=100;
    roma['D']=500;
    roma['M']=1000;
    ios::sync_with_stdio(false);
    cin.tie(0);

    string str;
    while(getline(cin, str)){
        int ans=roma[(unsigned)str[str.length()-1]];
        for(int i=str.length()-2; i>=0; i--){
            int rn=roma[(unsigned)str[i]];
            if(rn>=roma[(unsigned)str[i+1]]) ans+=rn;
            else ans-=rn;
        }
        cout<<ans<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
const ll MOD = 998244353;
void add(ll& x, ll y) {
	x += y;
	if (x >= MOD) x -= MOD;
}
void sub(ll& x, ll y) {
	x -= y;
	if (x < 0) x += MOD;
}
int main() {
	int n;
	scanf("%d", &n);
	vector<ll> ndp(90001), dp(90001);
	vector<ll> ndp2(90001), dp2(90001);
	dp[0] = dp2[0] = 1;
	ll sum = 0;
	for (int i = 0; i < n; ++i) {
		int a;
		scanf("%d", &a);
		sum += a;
		fill(ndp.begin(), ndp.end(), 0);
		fill(ndp2.begin(), ndp2.end(), 0);
		for (int s = 0; s <= i * 300; ++s) {
			add(ndp[s], dp[s]);
			add(ndp[s], dp[s]);
			add(ndp[s + a], dp[s]);
			add(ndp2[s], dp2[s]);
			add(ndp2[s + a], dp2[s]);
		}
//		for (int s = 0; s <= 10; ++s) db2(s, ndp[s]);
		swap(dp, ndp);
		swap(dp2, ndp2);
	}
	ll ans = 1;
	for (int i = 1; i <= n; ++i) ans = ans * 3 % MOD;
	for (int i = (sum + 1) / 2; i <= sum; ++i) {
//		db2(i, dp[i]);
		sub(ans, dp[i] * 3 % MOD);
	}
	if (sum % 2 == 0) {
		add(ans, dp2[sum / 2] * 3 % MOD);
	}
	printf("%lld\n", ans);
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define N 1000000
#define pb push_back
int a[N][2];
signed main()
{
    SPEED;
    int n;
    cin>>n;
    string s[n];
    for(int i=0;i<n;++i)
    {
        cin>>s[i];
        int c1=0,c2=0;
        for(int j=0;j<s[i].length();++j)
        {
            if(s[i][j]==')')
                c1++;
            else
                c2++;
            a[i][0]=max(a[i][0],c1-c2);
        }
        c1=0;c2=0;
        int l=s[i].length();
        for(int j=l-1;j>=0;--j)
        {
            if(s[i][j]=='(')
                c1++;
            else
                c2++;
            a[i][1]=max(a[i][1],c1-c2);
        }
    }
    vector<pair<int,int>> s1,s2;
    for(int i=0;i<n;++i)
    {
        if(a[i][1]-a[i][0]>=0)
            s1.pb({a[i][0],a[i][1]});
        else
            s2.pb({a[i][1],a[i][0]});
    }
    sort(s1.begin(),s1.end());
    sort(s2.rbegin(),s2.rend());
    int j=0,k=0,sum=0,f=0;
    for(int i=0;i<n;++i)
    {
        if(j<s1.size())
        {
            sum-=s1[j].first;
            if(sum<0)
                break;
            sum+=s1[j].second;
            j++;
        }
        else
        {
            sum-=s2[k].second;
            if(sum<0)
                break;
            sum+=s2[k].first;
            k++;
        }
    }
    if(sum!=0)
        cout<<"No";
    else
        cout<<"Yes";
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

const string YES = "Yes";
const string NO = "No";

int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> up, down;
    REP(i, n){
        ll cur = 0, bottom = 0;
        string s;
        cin >> s;
        for(char c : s){
            if(c == '('){
                cur++;
            }else{
                cur--;
            }
            bottom = min(cur, bottom);
        }
        if(cur >= 0){
            up.emplace_back(bottom, cur);
        }else{
            down.emplace_back(bottom - cur, - cur);
        }
    }

    sort(up.rbegin(), up.rend());
    ll cur_up = 0;
    for(auto p : up){
        ll btm = p.first;
        if(cur_up + btm < 0){
            cout << NO << endl;
            return 0;
        }
        cur_up += p.second;
    }

    sort(down.rbegin(), down.rend());
    ll cur_down = 0;
    for(auto p : down){
        ll btm = p.first;
        if(cur_down + btm < 0){
            cout << NO << endl;
            return 0;
        }
        cur_down += p.second;
    }

    if(cur_up != cur_down){
        cout << NO << endl;
    }else{
        cout << YES << endl;
    }
    return 0;
}


#include<cstdio>

long double sqrt(double);

int main(void){
long double d;
double x1,y1,x2,y2,D;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
D=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
sqrt(D);
d=sqrt(D);
printf("% 8.8Lf\n",d);
return 0;
}

long double sqrt(double a){
int i;
long double b=3;
for(i=0;i<256;i++){
b=(b/2)+(a/(2*b));

}
return b;
}

#include<iostream>
#include<cctype>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cctype>
#include<cstring>
#include<utility>
#include<cmath>
const int inf=0x7fffffff;
typedef long long int ll;
using namespace std;
int main()
{
//#ifdef DEBUG
//	freopen("in", "r", stdin);
////	freopen("out", "w", stdout);
//#endif

	double x,y,x2,y2;
	//cout<<sizeof(double);
	scanf("%lf%lf%lf%lf", &x,&y,&x2,&y2);
	printf("%f\n",hypot(x-x2,y-y2));
	//insert code above
	return 0;
}
//aoj1_10_a.cc


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MOD 1000000007
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline int fastpow(int bas, int ex){
	register int res = 1;
	for(; ex; ex >>= 1, bas = bas * (ll)bas % MOD) if(ex & 1) res = res * (ll)bas % MOD;
	return res;
}

inline int kazu(int a, const int &b) {return (a += b) >= MOD ? a - MOD : a;}
inline int hiku(int a, const int &b) {return (a -= b) < 0 ? a + MOD : a;}

int N, A = 0, a[500005], sum0[500005], ans = 0;
int nxt[1 << 20], head[1 << 20], id[500005], top, cnt0[1000005], f[1000005][2];

inline int calc_even(const int &x){
	if(head[x] > N) return 0; id[top = 1] = head[x];
	while(nxt[id[top]] <= N) id[top + 1] = nxt[id[top]], top++;
	register int M = 0;
	for(register int i = 1; i <= top; i++){
		cnt0[++M] = -1;
		if(i < top) cnt0[++M] = sum0[id[i + 1]] - sum0[id[i]];
	}
	f[0][0] = 1, f[0][1] = 0;
	for(register int i = 1; i <= M; i++){
		if(cnt0[i] == -1) f[i][0] = f[i - 1][0], f[i][1] = kazu(f[i - 1][1], f[i - 1][0]);
		else f[i][1] = f[i - 1][1], f[i][0] = kazu(f[i - 1][0], f[i - 1][1] * (ll)cnt0[i] % MOD);
	}
	return f[M][1];
}

inline int calc_odd(const int &x){
	if(head[x] > N) return 0; id[top = 1] = head[x];
	while(nxt[id[top]] <= N) id[top + 1] = nxt[id[top]], top++;
	register int M = 0;
	for(register int i = 1; i < top; i++){
		cnt0[++M] = -1;
		cnt0[++M] = sum0[id[i + 1]] - sum0[id[i]];
	}
	f[0][0] = 1, f[0][1] = 0;
	for(register int i = 1; i <= M; i++){
		if(cnt0[i] == -1) f[i][0] = f[i - 1][0], f[i][1] = kazu(f[i - 1][1], f[i - 1][0]);
		else f[i][1] = f[i - 1][1], f[i][0] = kazu(f[i - 1][0], f[i - 1][1] * (ll)cnt0[i] % MOD);
	}
	return f[M][0];
}

int main(){
	getint(N);
	for(register int i = 1; i <= N; i++) getint(a[i]), A = max(A, a[i] ^= a[i - 1]);
	for(register int i = 1; i <= N; i++) sum0[i] = sum0[i - 1] + (a[i] == 0);
	for(register int i = 0; i <= A; i++) head[i] = N + 1;
	for(register int i = N; i; i--) nxt[i] = head[a[i]], head[a[i]] = i;
	if(a[N]) ans = calc_odd(a[N]);
	else{
		ans = fastpow(2, sum0[N] - 1);
		for(register int i = 1; i <= A; i++) ans = kazu(ans, calc_even(i));
	}
	return printf("%d\n", ans), 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ll
constexpr int cN = ( 1 << 20 ) + 1;
ll pool0[cN];
ll pool1[cN];
ll poolCount[cN];

ll fib( ll a )
{
	ll b = 1; ll c = 1;
	REP( i, a - 2 )
	{
		ll d = c;
		c = ( c + b ) % cMOD;
		b = d;
	}
	return c;
}

template <typename T>
T mod_pow(T x, T n, T mod)
{
	T res = 1;
	while (n > 0)
	{
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

int main()
{
	memset( pool0, 0, sizeof( pool0 ) );
	memset( pool1, 0, sizeof( pool1 ) );
	memset( poolCount, 0, sizeof( poolCount ) );

	ll n;
	cin >> n;
	vector<ll> v(n,0);

	ll sum = 0;
	REP(i,n)
	{
		cin >> v[i];
		sum ^= v[i];
	}

	ll left = 0;
	ll count = 0;
	REP(i,cN) pool0[i] = 1;
	REP(i,n)
	{
		left ^= v[i];
		if( left == 0 ) ++count;
		else
		{
			pool0[left] = ( pool0[left] + pool1[left] * ( count - poolCount[left] ) ) % cMOD;
			poolCount[left] = count;
			pool1[left] = ( pool1[left] + pool0[left] ) % cMOD;
		}
	}

	ll ans = 0;
	if( sum == 0 )
	{
		ans = mod_pow( 2ll, count - 1, cMOD );
		REP(i, cN)
		{
			if( i == 0 ) continue;
			ans = ( ans + pool1[i] ) % cMOD;
		}
	}
	else
	{
		ans = pool0[sum];
	}

	cout << ans << endl;

	return 0;
}


#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);

int main(){
  int k, x;
  cin >> k >> x;

  int l = x - (k-1);
  int r = x + (k-1);

  for(int i = l; i < r ; ++i){
    cout << i << " ";
  }
  cout << r << endl;
  return 0;
}

#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
    #include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
    #include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define pi std::pair<int, int>
#define stdabs std::abs
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll& x, ll& y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
    int k,x;
    cin >> k>>x;
    for(int i=x-k+1;i!=x+k;++i){
	    if(i<-1000000||1000000<i){continue;}
	    if(i==x+k-1){cout<<i<<endl;break;}
	    cout<<i<<' ';
    }

    return 0;
}
ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat(){
#ifdef local
    rep(i, 2){std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

template <typename T> T fact(T num)
{
    if (num == 1) { return 1; }
    return num * fact(num - 1);
}


  #pragma GCC optimize("Ofast")
  #pragma GCC target("avx,avx2,fma")
  #include <bits/stdc++.h>
  using namespace std;
  //---------------------------------//
  void __print(int x) {cerr << x;}
  void __print(long x) {cerr << x;}
  void __print(long long x) {cerr << x;}
  void __print(unsigned x) {cerr << x;}
  void __print(unsigned long x) {cerr << x;}
  void __print(unsigned long long x) {cerr << x;}
  void __print(float x) {cerr << x;}
  void __print(double x) {cerr << x;}
  void __print(long double x) {cerr << x;}
  void __print(char x) {cerr << '\'' << x << '\'';}
  void __print(const char *x) {cerr << '\"' << x << '\"';}
  void __print(const string &x) {cerr << '\"' << x << '\"';}
  void __print(bool x) {cerr << (x ? "true" : "false");}

  template<typename T, typename V>
  void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  template<typename T>
  void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  void _print() {cerr << "]\n";}
  template <typename T, typename... V>
  void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  #ifndef ONLINE_JUDGE
  #define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
  #else
  #define deb(x...)
  #endif
 //------------------------------//

  typedef long long int ll;
  typedef pair<int,int> pi;
  typedef pair<ll,ll> pll;
  typedef vector<int> vi;
  typedef vector<ll> vll;
  typedef vector<pi> vpi;
  typedef vector<pll> vpll;

  #define  ff           first
  #define  ss           second
  #define  pb           push_back
  #define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define  all(x)       (x).begin(), (x).end()
  #define  ps(x,y)      fixed<<setprecision(y)<<x
  #define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

  const ll MOD = 1e9 + 7;
  const ll INF = 1e18;
  const ll maxn = 1e6 + 4;

 // dp[i][2] -> dp[i][
  void solve(){
    int n;
    cin >> n;
    vi v(n);
    for(int i=0;i<n;i++)cin >> v[i];
    vector<vector<ll>> dp(n+1,vector<ll>(2));
     // dp[i][0] max if here operation is applied;

    for(int i=1;i<=n;i++){
       if(i==1){
         dp[i][0] = -v[i-1];
         dp[i][1] = v[i-1];
       }
       else{
        dp[i][0] = max(dp[i-1][0]+v[i-1],dp[i-1][1]-v[i-1]);
        dp[i][1] = max(dp[i-1][0]-(v[i-1]),dp[i-1][1] + v[i-1]);
       }
    }
    cout << dp[n][1];
  }

  int main(){
    IOS
    	solve();
    //cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }

// integer overflow


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

int main() {
  int N, K;
  cin >> N >> K;
  int sum=1;

  for(int i=0; i<N; i++){
    if(sum*2 > sum+K) sum+=K;
    else sum*=2;
  }

  cout << sum << endl;

  return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define d 1000000007
using namespace std;
int main()
{
    int t;
    t=1;
    while(t--)
    {
        int n,k;
        cin >> n;
        cin >> k;
        int result=1;
        while(n>0)
        {
            result=min(result*2,result+k);
            n--;
        }
        cout << result << endl;
    }
	return 0;
}


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

int main() {
    char s[11];
    scanf("%s", s);
    if (strlen(s)%2==1) printf("No\n");
    else {
        for (int i=0;s[i]!='\0';i++) {
            if (i%2==0&&s[i]!='h'||i%2==1&&s[i]!='i') {
                printf("No\n");
                return 0;
            }
        }
        printf("Yes\n");
    }
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = long long ;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n;
    cin >> n;
    vi v(n);
    rep(i,n) cin >> v.at(i);
    // 全部同じはダメ
    vi a(100100,0);
    vi b(100100,0);
    rep(i,n){
        if(i%2){
            // 奇数
            a.at(v.at(i))++;
        }else{
            // 偶数
            b.at(v.at(i))++;
        }
    }
    vector<P> va;
    vector<P> vb;
    rep(i,a.size()){
        va.push_back(make_pair(a.at(i),i));
    }
    rep(i,b.size()){
        vb.push_back(make_pair(b.at(i),i));
    }
    sort(va.begin(), va.end(), greater<>());
    sort(vb.begin(), vb.end(), greater<>());
    ll a1=va.at(0).first;
    ll a2=va.at(1).first;
    ll b1=vb.at(0).first;
    ll b2=vb.at(1).first;
    ll a1i=va.at(0).second;
    ll b1i=vb.at(0).second;
    cerr << "a1:" << a1 << " b1:" << b1 << endl;
    cerr << "a2:" << a2 << " b2:" << b2 << endl;
    ll res = 0;
    if(a1i!=b1i){
        res += (n/2) - a1;
        res += (n/2) - b1;
    }else{
        if(a2 >= b2){
            res += (n/2) - a2;
            res += (n/2) - b1;
        }else{
            res += (n/2) - a1;
            res += (n/2) - b2;
        }
    }
    cout << res << endl;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, v, p; cin >> n >> m >> v >> p;
    vector<int> a(n); rep (i, n) cin >> a[i];
    sort(all(a), greater<int>());
    ll ans = 0, piv = a[p - 1];
    if (v <= p) {
        while (ans < n && a[ans] + m >= piv) ans++;
    } else {
        int ok = -1, ng = n;
        while (ng - ok > 1) {
            int med = (ng + ok) / 2;
            if (a[med] + m < piv) {ng = med; continue;}
            ll rest = 0, vv = v - (n - med);
            rep (j, med) rest += max((j < p - 1 ? m : 0LL), (a[med] + m) - a[j]);
            eprintf("%d, %lld %lld\n", med, rest, m * vv);
            if (rest >= m * vv) ok = med;
            else ng = med;
        }
        ans = ok + 1;
    }
    cout << ans << "\n";
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l.at(i);

  int ans = 0;
  rep(i, n) rep(j, n) rep(k, n) {
    if (i < j && j < k) {
      int x = l.at(i), y = l.at(j), z = l.at(k);
      if (x == y || y == z || z == x) continue;
      if (x + y <= z || y + z <= x || z + x <= y) continue;
      ++ans;
    }
  }

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

#include<bits/stdc++.h>

using namespace std;

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

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

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

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

int n, a[101010];
void solve(){
	cin >> n;
	int cnt = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		cnt += abs(a[i]-a[i-1]);
	}
	cnt += abs(a[n]);

	for(int i = 1; i <= n; i++){
		cout << cnt-(abs(a[i]-a[i-1])+abs(a[i]-a[i+1]))+abs(a[i-1]-a[i+1]) << endl;
	}
}

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

	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S;
    cin >> S;
    S[3] = '8';
    cout << S << endl;
}

#include <cstdio>
using namespace std;
int main() {
    int y, m, d;
    scanf("%d/%d/%d", &y, &m, &d);
    printf("2018/%02d/%02d\n", m, d);
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    if (v[0] > 0) {
        cout << -1 << endl;
        return 0;
    }
    long long int res = 0;
    int last = 0;
    for (int i = 1; i < n; i++) {

        if (v[i] == 0) {
            last = 0;
            continue;
        }
        last++;
        if (last < v[i]) {
            cout << -1 << endl;
            return 0;
        }
        if (v[i] - v[i - 1] >= 2) {
            cout << -1 << endl;
            return 0;
        }
        if (v[i] >= 2 && v[i - 1] == 0) {
            cout << -1 << endl;
            return 0;
        }
        if (v[i] == v[i - 1] + 1) {
            res++;
            continue;
        }
        res += v[i];
    }
    cout << res << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

int main() {
    ll n, ans = 0; cin >> n;
    vector<ll> a(n), b(n, 0);
    rep(i, n) cin >> a[i];
    if(a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    else {
        rep(i, n-1) {
            if(a[i]+1 < a[i+1]) {
                cout << -1 << endl;
                return 0;
            }
        }
        rep(i, n) {
            b[i-a[i]]++;
        }
        ll index = 0;
        rep(i, n) {
            rep(j, b[i]) {
                a[index] = i;
                index++;
            }
        }
        set<ll> s;
        rep(i, n) {
            if(!s.count(a[n-1-i])) {
                s.insert(a[n-1-i]);
                ans += (n-1-i) - a[n-1-i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) {
    if(n == 0) return 1;

    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


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

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

const ll INF = 100100100100100100;
const ll MAX_V = 1000;
const ll MAX_E = 1000;
vector<vector<ll>> cost(MAX_V,vector<ll>(MAX_E,INF));

struct edge{
    // Dijkstraでは隣接リストを用いるのでfromはいらない
    // int from;
    int to;
    int c;

    public:
    edge(ll to, ll c){
        this->to = to;
        this->c = c;
    }
};

// 集合Xからの辺の最小コスト
vector<ll> mincost(MAX_V);

ll prim(const ll &V, const vector<vector<edge>> &ed){
    // V:頂点数

    ll res = 0;
    vector<bool> used(V+5,false);
    priority_queue<P, vector<P>, greater<P>> pq; // first:その頂点を接続するのに必要なコスト ,second:頂点番号
    P ps;
    ps.first = 0;
    ps.second = 0;
    pq.push(ps);
    // pq.push(P(0,0)):

    while(!pq.empty()){
        P p = pq.top();
        pq.pop();
        if(used[p.second]) continue; // もう集合Xに入っていたら無視
        used[p.second] = true;
        res += p.first; // priorityQueueを用いていることで必ず最適な辺を取得することができる．
        for(edge e : ed[p.second]){
            if(!used[e.to]) pq.push({e.c,e.to});
        }
    }

    return res;
}

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

    vector<vector<edge>> ed(V);
    vector<P> X;
    vector<P> Y;
    rep(i,V){
        ll x,y; cin >> x >> y;
        X.push_back(P(x,i));
        Y.push_back(P(y,i));
    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    rep(i,V-1){
        ll z1, z2 ,c, from, to;
        z1 = X[i].first;
        z2 = X[i+1].first;
        c = abs(z1-z2);
        from = X[i].second;
        to = X[i+1].second;
        edge e(from,c);
        edge re(to,c);
        ed[to].push_back(e);
        ed[from].push_back(re);
    }
    rep(i,V-1){
        ll z1, z2 ,c, from, to;
        z1 = Y[i].first;
        z2 = Y[i+1].first;
        c = abs(z1-z2);
        from = Y[i].second;
        to = Y[i+1].second;
        edge e(from,c);
        edge re(to,c);
        ed[to].push_back(e);
        ed[from].push_back(re);
    }

    // rep(i,V){
    //     cout << i << " :" << endl;
    //     rep(j,ed[i].size()){
    //         cout << ed[i][j].to << " " << ed[i][j].c << endl;
    //     }
    // }

    cout << prim(V, ed) << endl;
    return 0;
}

#include<cstdio>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;
int p[100010];
vector<pair<ll,ll>> vt;
vector<pair<ll, ll>> vt1;
vector<pair<ll, pair<ll, ll>>> vt2;
int find(int u)
{
	if (u == p[u])return u;
	return p[u] = find(p[u]);
}
int merge(int u, int v)
{
	u = find(u), v = find(v);
	if (u == v)return 0;
	p[u] = v;
	return 1;
}
int main()
{
	ll n;
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++)
	{
		p[i] = i;
		ll q, w;
		scanf("%lld %lld", &q, &w);
		vt.push_back({ q,i });
		vt1.push_back({ w,i });
	}
	sort(vt.begin(), vt.end());
	sort(vt1.begin(), vt1.end());
	for (int i = 1; i < n; i++)
	{
			vt2.push_back({vt[i].first-vt[i-1].first ,{ vt[i].second,vt[i - 1].second } });
			vt2.push_back({ vt1[i].first - vt1[i - 1].first ,{ vt1[i].second,vt1[i - 1].second } });
	}
	sort(vt2.begin(), vt2.end());
	ll dap = 0;
	for (int i = 0; i < vt2.size(); i++) {
		if (merge(vt2[i].second.first, vt2[i].second.second))
		{
			dap += vt2[i].first;
		}
	}
	printf("%lld", dap);
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int64_t const INF = 1e18;

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<int64_t> A(N);
  int64_t S = 0;
  for(int i = 0; i < 3; ++i) std::cin >> A[i];
  for(int i = 3; i < N; ++i) { std::cin >> A[i]; S += A[i]; }
  int64_t P[4] = { A[0], A[1], A[2], S }, ans = INF;
  int j = 1, l = 3;
  for(int k = 2; k < N-1; ++k) {
    while(j < k-1 && std::abs(P[0]-P[1]) > std::abs(P[0]+A[j]-(P[1]-A[j]))) {
      P[0] += A[j];
      P[1] -= A[j];
      ++j;
    }
    while(l < N-1 && std::abs(P[2]-P[3]) > std::abs(P[2]+A[l]-(P[3]-A[l]))) {
      P[2] += A[l];
      P[3] -= A[l];
      ++l;
    }
    ans = std::min(ans, *std::max_element(P, P+4) - *std::min_element(P, P+4));
    P[1] += A[k];
    P[2] -= A[k];
  }
  fin(ans);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200010;
int a[N], n;
ll sum[N];
ll get(int l, int r){
	return sum[r] - sum[l - 1];
}
inline void chkmin(ll& a, ll b){
	if(a > b) a = b;
}
inline void chkmax(ll& a, ll b){
	if(a < b) a = b;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i <= n; i++)
		sum[i] = sum[i - 1] + a[i];
	ll ans = 1LL << 60;
	for(int i = 3; i <= n - 1; i++){
		ll a[4];
		int low = i, high = n - 1;
		int step = 100;
		int mid1, mid2;
		while(step-- && low <= high){
			mid1 = (low + low + high) / 3;
			mid2 = (low + high + high) / 3;
			ll s1 = get(i, mid1), s2 = get(mid1 + 1, n);
			ll s3 = get(i, mid2), s4 = get(mid2 + 1, n);
			if(abs(s1 - s2) > abs(s3 - s4))
				low = mid1 + 1;
			else
				high = mid2;
		}
		vector<pair<ll, ll> > vp1;
		for(int j = -2; j <= 2; j++){
			int nh = high + j;
			if(nh >= i && nh + 1 <= n)
				vp1.emplace_back(get(i, nh), get(nh + 1, n));
		}

		low = 2, high = i - 1;
		step = 100;
		while(step-- && low <= high){
			mid1 = (low + low + high) / 3;
			mid2 = (low + high + high) / 3;
			ll s1 = get(mid1, i - 1), s2 = get(1, mid1 - 1);
			ll s3 = get(mid2, i - 1), s4 = get(1, mid2 - 1);
			if(abs(s1 - s2) > abs(s3 - s4))
				low = mid1 + 1;
			else
				high = mid2;
		}

		a[2] = get(high, i - 1), a[3] = get(1, high - 1);

		vector<pair<ll, ll> > vp2;
		for(int j = -2; j <= 2; j++){
			int nh = high + j;
			if(nh <= i - 1 && 1 <= nh - 1)
				vp2.emplace_back(get(nh, i - 1), get(1, nh - 1));
		}
		for(auto it : vp1) for(auto jt : vp2){
			ll a[4] = {it.first, it.second, jt.first, jt.second};
			ll xv = 0, nv = 1LL << 60;
			for(int j = 0; j < 4; j++)
				chkmax(xv, a[j]), chkmin(nv, a[j]);
			chkmin(ans, xv - nv);
		}
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#define local
#ifdef local
    #include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
    #include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define pi std::pair<int, int>
#define stdabs std::abs
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll& x, ll& y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
constexpr ll mod = 1000000000 + 7;
int main()
{
    stat();
    int k,x;
    cin >> k>>x;
    for(int i=x-k+1;i!=x+k;++i){
	    if(i<-1000000||1000000<i){continue;}
	    if(i==x+k-1){cout<<i<<endl;break;}
	    cout<<i<<' ';
    }

    return 0;
}
ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat(){
#ifdef local
    rep(i, 2){std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

template <typename T> T fact(T num)
{
    if (num == 1) { return 1; }
    return num * fact(num - 1);
}

#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int K, X; cin >> K >> X;
  for (int i = X - K + 1; i < X + K; ++i) {
    cout << i << " ";
  }
  cout << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
const int mod = 998244353;

ll mpow(ll x, ll n) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  }
  return res;
}

vl fac(3e6, 1);
vl invfac(fac.size(), 1);

ll bin(int n, int k) {
  if (k < 0 || k > n) return 0;
  return fac[n] * invfac[k] % mod * invfac[n - k] % mod;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  for (int i = 2; i < (int)fac.size(); ++i) {
    fac[i] = fac[i - 1] * i % mod;
    invfac[i] = mpow(fac[i], mod - 2);
  }
  int n, m;
  cin >> n >> m;
  ll res = 0;
  for (int k = m % 2; k <= m; k += 2) {
    int a = (m - k) / 2;
    res = (res + (bin(n - 1 + m + a, n - 1) - (n - k) * bin(n - 1 + a - 1, n - 1) - k * bin(n - 1 + a, n - 1)) % mod * bin(n, k)) % mod;
  }
  cout << (res % mod + mod) % mod << endl;
  return 0;
}

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int mod=998244353;
const int MAXN=3000005;
int pre[MAXN],inv[MAXN];
int C(int n,int m)
{
	if(n<m)return 0;
	return 1LL*pre[n]*inv[m]%mod*inv[n-m]%mod;
}
int n,m;
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
void dl(int &x,int y){x-=y;if(x<0)x+=mod;}
int pow_mod(int a,int b)
{
	int ret=1;
	while(b)
	{
		if(b&1)ret=1LL*ret*a%mod;
		a=1LL*a*a%mod;b>>=1;
	}
	return ret;
}
int main()
{
	pre[0]=1;for(int i=1;i<MAXN;i++)pre[i]=1LL*pre[i-1]*i%mod;
	inv[MAXN-1]=pow_mod(pre[MAXN-1],mod-2);
	for(int i=MAXN-2;i>=0;i--)inv[i]=1LL*inv[i+1]*(i+1)%mod;
	n=read();m=read();
	int ans=0;
	for(int i=0;i<=m;i++)
		if(!((3*m-i)&1))
			ad(ans,1LL*C(n,i)*C(((3*m-i)>>1)+n-1,n-1)%mod);
//	dl(ans,1LL*n*C(m-2+n-1,n-1)%mod);
	dl(ans,1LL*n*C(m-1+n-1,n-1)%mod);
	pr2(ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007

void solve()
{
	ll n;
	cin>>n;
	map<ll,ll> mp;
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		mp[x]++;
	}
	// cout<<mp[16];
	for(auto c:mp)
	{
		ans+=(c.second%2);
	}
	cout<<ans;
	return;
}
int main()
{
	fast;
	int q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    set<int> s;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(s.count(a)) s.erase(a);
        else s.insert(a);
    }
    cout << s.size() << endl;
}


#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
#define DEBUG5(var0, var1, var2, var3, var4) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG4(var1,var2,var3,var4); }
#define DEBUG6(var0, var1, var2, var3, var4, var5) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG5(var1,var2,var3,var4,var5);}
typedef long long ll;

#define MAX_V 100100
int V;
vector <pair <int,ll> > edge[MAX_V];
vector <pair <int,ll> > Redge[MAX_V];
vector <int> vs;
bool used[MAX_V];
int cmp[MAX_V];
void reverse_edge(){
  rep2(i,1,V+1){//1-indexedにしてます
    rep(j,sz(edge[i])){
      Redge[edge[i][j].fir].pb(mp(i,edge[i][j].sec));
    }
  }
}

void dfs(int now){
  used[now] = true;
  rep(i,sz(edge[now])){
    if(!used[edge[now][i].fir]){
      dfs(edge[now][i].fir);
    }
  }
  vs.pb(now);
}

void rdfs(int now,int k){
  used[now] = true;
  cmp[now] = k;
  rep(i,sz(Redge[now])){
    if(!used[Redge[now][i].fir]){
      rdfs(Redge[now][i].fir,k);
    }
  }
}
int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  rep2(v,1,V+1){//1-indexed
    if(!used[v]){
      dfs(v);
    }
  }
  memset(used,0,sizeof(used));
  reverse_edge();
  int k = 0;
  for(int i = sz(vs)-1;i >= 0;i--){
    if(!used[vs[i]]){
      k += 1;
      rdfs(vs[i],k);
    }
  }
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> V;
  int E;
  cin >> E;
  rep(i,E){
    int x,y;
    cin >> x >> y;
    x += 1;
    y += 1;
    edge[x].pb(mp(y,1));
  }
  scc();
  int Q;
  cin >> Q;
  rep(i,Q){
    int x,y;
    cin >>  x >> y;
    x += 1;
    y += 1;
    if(cmp[x] == cmp[y]){
      cout << 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }

  return 0;
}

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

#define rep(i,n) for (int i=0;i<(n);++i)
#define rep2(i,a,b) for (int i=(a);i<(b);++i)
#define rrep(i,n) for (int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;--i)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) cout<<(#_v)<<":";for(auto(_x):(_v)){cout<<" "<<(_x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cout << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cout << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

class SCC {
private:
    const int n;
    vector<vector<int>> G;
    vector<vector<int>> rG;
    vector<int> vs;
    vector<bool> used;
    vector<int> cmp;
public:
    SCC(int _n) : n(_n), G(_n), rG(_n), used(_n), cmp(_n) {}
    void addEdge(int from, int to) {
        G[from].emplace_back(to);
        rG[to].emplace_back(from);
    }
    void dfs(int v) {
        used[v] = true;
        for (auto nxt : G[v]) if (!used[nxt]) dfs(nxt);
        vs.emplace_back(v);
    }
    void rdfs(int v, int k) {
        used[v] = true;
        cmp[v] = k;
        for (auto nxt : rG[v]) if (!used[nxt]) rdfs(nxt, k);
        vs.emplace_back(v);
    }
    int scc() {
        used.assign(n, false);
        rep(v, n) if (!used[v]) dfs(v);
        used.assign(n, false);
        int k = 0;
        for (int i = (int)vs.size() - 1; i >= 0; i--) {
            int v = vs[i];
            if (!used[v]) rdfs(v, k++);
        }
        return k;
    }
    bool same(int a, int b) {
        return cmp[a] == cmp[b];
    }
};

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

    int n, m;
    cin >> n >> m;
    SCC scc(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        scc.addEdge(a, b);
    }

    scc.scc();

    int q;
    cin >> q;
    rep(i, q) {
        int a, b;
        cin >> a >> b;
        cout << scc.same(a, b) << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 567890, maxm = 1<<20, mod = 1000000007;
int mul(long long a, long long b){
	return a * b % mod;
}
int q0[maxn];
int a[maxn];
vector<int> where[maxm];
int main(){
	int n; scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", a + i);
	for(int i = 1; i <= n; i++) a[i] ^= a[i - 1];
	int cnt0 = 0;
	vector<int> could;
	for(int i = 1; i <= n; i++){
		if(a[i] == 0) cnt0++;
		q0[i] = cnt0;
		could.push_back(a[i]);
	}
	sort(could.begin(), could.end());
	could.erase(unique(could.begin(), could.end()), could.end());
	for(int i = n; i >= 1; i--) where[a[i]].push_back(i);
	int ans = 0;
	for(int i: could){
		if(i == 0){
			int now = a[n] == 0;
			for(int j = where[i].size(); j > 1; j--){
				ans += now;
				if(ans >= mod) ans -= mod;
				now = now + now;
				if(now >= mod) now -= mod;
			}
			ans += a[n] == 0;
			if(ans >= mod) ans -= mod;
			continue;
		}
		int normal = a[n] == i, adapt = mul(normal, q0[n]);
		if(a[n] == i){
			ans += 1;
			if(ans >= mod) ans -= mod;
		}
		for(int j : where[i]){
			if(j == n) continue;
			int gap = adapt + mod - mul(normal, q0[j]);
			if(gap >= mod) gap -= mod;
			gap += (a[n] == 0);
			if(gap >= mod) gap -= mod;
			ans += gap;
			if(ans >= mod) ans -= mod;
			normal += gap;
			if(normal >= mod) normal -= mod;
			adapt += mul(gap, q0[j]);
			if(adapt >= mod) adapt -= mod;
		}
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <chrono>
#include <random>

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

const int ms = 1 << 20;
const int MOD = 1e9 + 7;

int trans[ms][2];

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int n;
	std::cin >> n;
	std::vector<int> a(n + 1, 0);
	for(int i = 1; i <= n; i++) {
		std::cin >> a[i];
		a[i] ^= a[i-1];
	}
	for(int i = 0; i <= n; i++) {
		//std::cout << a[i] << (i == n ? '\n' : ' ');
	}
	for(int i = 0; i < ms; i++) {
		trans[i][0] = 1;
	}
	int zero = 1;
	int ans = 0;
	int o = a.back() == 0 ? 1 : 0;
	for(int i = 1; i <= n; i++) {
		if(a[i] == 0) {
			if(a.back() == 0 && i != n) {
				o = (o + o) % MOD;
			}
			zero++;
		} else {
			long long val = ((long long) trans[a[i]][1] * zero % MOD + trans[a[i]][0]) % MOD;
			if(a.back() == 0) {
				ans = (ans + val) % MOD;
			} else if(i == n) {
				ans = val;
			}
			trans[a[i]][0] = (trans[a[i]][0] - val * zero % MOD + MOD) % MOD;
			trans[a[i]][1] = (trans[a[i]][1] + val % MOD) % MOD;
		}
	}
	std::cout << (ans + o) % MOD << '\n';
}


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

#define ll long long

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

    ll sum = A * B;
    std::cout << sum << std::endl;
}

// Hail god Yato

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

#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    ll a, b;
    cin>>a>>b;
    cout<<a*b;
}
int main(){
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0;
}


#include <iostream>
#include <string>
int main(){
  char s[10];
  for (int i = 0; i < 10; i++){
    std::cin >> s[i];
    if (i == 3){
      s[i] = '8';
    }
  }

  for (int i = 0; i < 10; i++){
    std::cout << s[i];
  }
  std::cout << std::endl;
  return 0;
}

#include <stdio.h>
int main (){
	char year[4],month[2],day[2];
	scanf ("%[^/]/ %[^/]/ %s",year,month,day);
	printf ("2018/01/%s",day);
}


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

const int maxn = (int) 2e5 + 20;

#define LL long long

LL n, x;
LL B[maxn], L[maxn], R[maxn];
LL sum[maxn];
LL tsum[maxn];
int rk[maxn];

bool vis[maxn];

int gao(LL score)
{
    LL tot = 0;
    LL les = score % x;
    for(int i = 0; i < n; i++)
    {
        rk[i] = i;
        vis[i] = 0;
        tot -= B[i] * L[i];

        sum[i] = (x - B[i]) * R[i] + B[i] * L[i];

        if(les >= B[i]) tsum[i] = (les - B[i]) * R[i] + B[i] * L[i];
        else tsum[i] = les * L[i];
    }

    sort(rk, rk + n, [](int x, int y){
         if(sum[x] == sum[y]) return tsum[x] < tsum[y];
         return sum[x] > sum[y];
         });

    int k = score / x;
    LL pre = 0;
    for(int i = 0; i < k; i++) pre += sum[rk[i]];

    if(k == n) return tot + pre >= 0;

    LL k1 = sum[rk[k]];

    LL mx = 0;
    for(int i = 0; i < n; i++)
    {
        if(i < k) mx = max(mx, pre - sum[rk[i]] + k1 + tsum[rk[i]]);
        else mx = max(mx, pre + tsum[rk[i]]);
    }

    return tot + mx >= 0;
}

void work()
{
    cin >>n >>x;

    for(int i = 0; i < n; i++)
        cin >>B[i] >>L[i] >>R[i];

    LL l = 0, r = n * x, mid, ans = -1;

    while(l <= r)
    {
        mid = (l + r) / 2;

        if(gao(mid))
        {
            r = mid - 1;
            ans = mid;
        }
        else
        {
            l = mid + 1;
        }
    }

    cout <<ans <<endl;

}

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
#endif // yukihana0416
    work();
    return 0;
}

#include<bits/stdc++.h>

const int N = 100010;

typedef long long ll;

ll x[N], p[N];

int main(){
    int n, s;
    scanf("%d%d", &n, &s);
    for (int i = 0; i < n; ++ i){
        scanf("%lld%lld", &x[i], &p[i]);
    }
    int sit = std::lower_bound(x, x + n, s) - x;
    int left = 0, right = n - 1;
    ll ans = 0;
    int previouschoice = -1;
    while (true){
        if (left == sit){
            ans += x[right] - s;
            break;
        }
        if (right == sit - 1){
            ans += s - x[left];
            break;
        }
        if ((p[left] >= p[right]) != previouschoice){
            ans += x[right] - x[left];
            previouschoice = p[left] >= p[right];
        }
        if (p[left] >= p[right]){
            p[left] += p[right];
            -- right;
        }
        else{
            p[right] += p[left];
            ++ left;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
int a[5]={0};
long double dp[305][305][305];

long double solve(int n1,int n2,int n3)
{
    if( (n1<0) || (n2<0) || (n3<0))
        return 0;
    if(n1==0 && n2==0 && n3==0)
        return 0;
    if(dp[n1][n2][n3]!=0)
        return dp[n1][n2][n3];
    long double &ans=dp[n1][n2][n3];
    int cnt=0;
    int x=n-n1-n2-n3;
    long double nn=n1+n2+n3;
    long double nn1=(long double)n1/nn;
    long double nn2=(long double)n2/nn;
    long double nn3=(long double)n3/nn;
    long double c=solve(n1-1,n2,n3);
    if(c>0)
    {
        long double xx= (long double)(((long double)n1+(long double)x*nn1)/((long double)n1));
        //cout<<xx<<" "<<c<<"\n";
        xx+=c;
        xx*=nn1;
        ans+=xx;
    }
     c=solve(n1+1,n2-1,n3);
    if(c>0)
    {
        long double xx= (long double)(((long double)n2+(long double)x*nn2)/((long double)n2));
        //cout<<xx<<" ";
        xx+=c;
        xx*=nn2;
        ans+=xx;
        //cnt++;
    }
    c=solve(n1,n2+1,n3-1);
    if(c>0)
    {
        long double xx= (long double)(((long double)n3+(long double)x*nn3)/((long double)n3));
        //cout<<xx<<" ";
        xx+=c;
        xx*=nn3;
        ans+=xx;
        //cnt++;
    }
    //ans=ans/cnt;
    //cout<<n1<<" "<<n2<<" "<<n3<<" "<<ans<<" "<<cnt<<"\n";
    return ans;

}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,0,sizeof(dp));
    cin>>n;
    dp[1][0][0]=n;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        a[x]++;
    }
    //cout<<a[1]<<" "<<a[2]<<" "<<a[3]<<"\n";
    std::cout << std::setprecision(15) << solve(a[1],a[2],a[3]) << '\n';
}

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define vi vector<int>
#define Sort(v) sort(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

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

    int maxn = -1000000 , minn=1000000;
    long long sum=0;
    rep(i,n){
        int a; cin >> a;

        sum += a;
        maxn = max(maxn,a);
        minn = min(minn,a);
    }

    cout << minn << " " << maxn << " " <<sum << endl;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 1000000
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
char s[MN+5],t[MN+5];
int last[MN+5][26],a[MN+5],n,ans=0;
int main()
{
	n=read();
	scanf("%s%s",s+1,t+1);
	for(int i=1;i<=n;++i)
	{
		memcpy(last[i],last[i-1],sizeof(last[0]));
		last[i][s[i]-'a']=i;
	}
	for(int i=n,j=n,r=0,k=0;i;--i)
	{
		if(j>i) j=i;
		if(s[j]!=t[i])
		{
			if(!last[j][t[i]-'a']) return 0*puts("-1");
			j=last[j][t[i]-'a'];
			++r;++k;ans=max(ans,k);
			++a[j+r];
		}
		k-=a[i+r];a[i+r]=0;
	}
	cout<<ans;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
char s[1000100];
char t[1000100];
queue<int>q;
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	scanf("%s",t+1);
	int ans=0;
	for(int i=1;i<=n;++i)
		if(s[i]!=t[i]){ans=1;break;}
	if(!ans)
	{
		puts("0");
		return 0;
	}
	for(int up=n,dn=n;dn;--dn)
	{
		while(t[dn-1]==t[dn])dn--;
		up=min(up,dn);
		while(s[up]!=t[dn]&&up)up--;
		if(!up)
		{
			puts("-1");
			return 0;
		}
		while(!q.empty())
		{
			if(q.front()-q.size()+1>dn)q.pop();
			else break;
		}
		if(up!=dn)q.push(up);
		ans=max(ans,(int)q.size()+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned int
#define test int t;cin>>t; while(t--)
#define en '\n'
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)x.size()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007

void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
// You should only debug a pair of simple data types. For example,
// the debug won't work if one of pair's elements is collection type
// (std::vector, std::map, std::set...).
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// bool check_prime(int n)  return whether a number is prime or not O(sqrt(N));
// int BE(int x,int n,int m)  return x^n%m; O(logN);
// void sieve()  from number 1-1000001 saare prime store kar lega  in bool is_prime[1000001] array
// vector<int> z_array(string s)  return vector which is Z-array of string s;
// vector<int> lps(string s)      return vector which is lps array of string s;
// int power(int x,int n) return x^n; O(logN);
// using_ordered_set (template for using ordered set , replace first 2 lines of this page with this code..);
const int gf = 1e6 + 9;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int a[n], b[n];
	zip(i, 0, n)
	{
		cin >> a[i];
	}
	zip(i, 0, n)cin >> b[i];

	sort(b, b + n, greater<int>());
	int l = 0, r = n - 1;
	zip(i, 0, n)
	{
		if (a[i] == b[i])
		{
			if (a[l] != b[i] && a[i] != b[l])
			{
				swap(b[l], b[i]);
				l++;
			}
			else if (a[r] != b[i] && b[r] != a[i])
			{
				swap(b[r], b[i]);
				r--;
			}
			else
			{
				cout << "No" << en;
				return 0;
			}
		}
	}
	zip(i, 0, n)
	{
		if (a[i] == b[i])
		{
			cout << "No" << en;
			return 0;
		}
	}
	cout << "Yes" << en;
	zip(i, 0, n)cout << b[i] << " ";

	return 0;
}

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    int N;
    cin>>N;
    int *vCount=new int[N],*b=new int[N],*c=new int[N+1];
    for(int i=0;i<N;++i){
        vCount[i]=0;
    }

    bool yesFlg=true;
    int oldA=-1,ci=0;
    for(int i=0;i<N;++i){
        int a1;
        cin>>a1;
        ++vCount[a1-1];
        if(vCount[a1-1]>N){
            yesFlg=false;
            break;
        }
        if(oldA!=a1){
            for(;ci<a1;++ci){
                c[ci]=i;
            }
            oldA=a1;
        }
    }
    for(;ci<=N;++ci){
        c[ci]=N;
    }

    int oldB=-1,di=0;

    int x=0;
    for(int i=0;i<N&&yesFlg;++i){
        int b1;
        cin>>b1;
        b[i]=b1;
        ++vCount[b1-1];
        if(vCount[b1-1]>N){
            yesFlg=false;
            break;
        }
        if(oldB!=b1){
            for(;di<b1;++di){
                int d=i;
                int x1=c[di+1]-d;
                if(x<x1){
                    x=x1;
                }
            }
            oldB=b1;
        }
    }
    for(;di<N;++di){
        int d=N;
        int x1=c[di+1]-d;
        if(x<x1){
            x=x1;
        }
    }

    if(yesFlg){
        cout<<"Yes"<<endl;
        for(int i=0;i<N;++i){
            int idx=(i-x)%N;
            if(idx<0){
                idx+=N;
            }
            int b1=b[idx];
            if(i==0){
                cout<<b1;
            }else{
                cout<<" "<<b1;
            }
        }
        cout<<endl;
    }else{
        cout<<"No"<<endl;
    }

    delete[] b;
    delete[] c;
    delete[] vCount;
    return 0;
}


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

int main(){
    int n;
    ll x;
    cin>>n>>x;
    vector<ll>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    int ans=0;
    int i=0;
    while(x>0 && i<n){
        x-=a[i];
        if(x>=0)ans++;
        i++;
    }
    if(x>0)ans--;
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF = 1LL << 60;

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

    vector<ll> a(N);
    REP(i, N) cin >> a[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(N + 10, -INF));
    dp[0][0] = 0;
    for(ll i = 1; i <= N; ++i) {
        for(ll sum_cnt = 0; sum_cnt < i; ++sum_cnt) {
            dp[i][sum_cnt] = dp[i - 1][sum_cnt];
            if(i >= 1) {
                chmin(dp[i][sum_cnt], dp[i - 1][sum_cnt - 1] + a[i - 1]);
            }
        }

        dp[i][i] = dp[i - 1][i - 1] + a[i - 1];
    }

    ll ans_i = 0;
    while(ans_i < N && dp[N][ans_i + 1] <= x) {
        ++ans_i;
    }
    if(dp[N][ans_i] < x && ans_i == N) {
        --ans_i;
    }
    cout << ans_i << endl;

    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n;
ll X, b[maxn], l[maxn], r[maxn], base;
vector<pair<ll, int> >sums;
bool can(ll c)
{
	ll full = c / X, rem = c - full * X;
	ll sum = 0;
	for(int i = 0; i < full; i++)
		sum += sums[i].x;
	ll mx = 0;
	for(int i = 0; i < n; i++)
	{
		int j = sums[i].y;
		ll add;
		if(rem >= b[j])
			add = b[j] * l[j] + r[j] * (rem - b[j]);
		else
			add = l[j] * rem;
		if(i < full)
			mx = max(mx, sum - sums[i].x + add + (full == n ? 0 : sums[full].x));
		else
			mx = max(mx, sum + add);
	}
	return mx >= base;
}
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n >> X;
	for(int i = 0; i < n; i++)
	{
		cin >> b[i] >> l[i] >> r[i];
		base += l[i] * b[i];
		sums.pb({(X - b[i]) * r[i] + b[i] * l[i], i});
	}
	sort(all(sums), greater<pair<ll, int> >());
	ll lo = 0, hi = X * n;
	while(lo < hi)
	{
		ll mid = (lo + hi) / 2;
		if(can(mid))
			hi = mid;
		else
			lo = mid + 1;
	}
	cout << lo << "\n";
	return 0;
}

#include <bits/stdc++.h>
#define Maxn 100007
using namespace std;
int n,x;
int b[Maxn],l[Maxn],r[Maxn];
bool flag[Maxn];
priority_queue<pair<long long,int> >pq;
long long solve(int id,long long tmp)
{
    if (tmp<=0LL) return 0LL;
    if (tmp<=1LL*l[id]*b[id])
    {
        return (tmp+l[id]-1)/l[id];
    } else
    {
        tmp-=1LL*l[id]*b[id];
        return (tmp+r[id]-1)/r[id]+b[id];
    }
}
int main()
{
    scanf("%d%d",&n,&x);
    while (!pq.empty()) pq.pop();
    long long tmp=0LL;
    for (int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&b[i],&l[i],&r[i]);
        tmp+=1LL*l[i]*b[i];
        pq.push(make_pair(1LL*r[i]*(x-b[i])+1LL*l[i]*b[i],i));
    }
    long long ans=1LL*x*n;
    int cnt=0;
    while ((!pq.empty())&&tmp>=0)
    {
        tmp-=pq.top().first;
        int id=pq.top().second;
        flag[id]=true;
        pq.pop();
        ++cnt;
    }
    ans=min(ans,1LL*cnt*x);
    --cnt;
    long long t=x;
    for (int i=1;i<=n;i++)
        if (flag[i])
        {
            tmp+=1LL*r[i]*(x-b[i])+1LL*l[i]*b[i];
            t=min(t,solve(i,tmp));
            tmp-=1LL*r[i]*(x-b[i])+1LL*l[i]*b[i];
        }
    ans=min(ans,1LL*cnt*x+t);
    while (!pq.empty()) pq.pop();
    tmp=0LL;
    for (int i=1;i<=n;i++)
    {
        tmp+=1LL*l[i]*b[i];
        pq.push(make_pair(1LL*r[i]*(x-b[i])+1LL*l[i]*b[i],i));
    }
    memset(flag,false,sizeof(flag));
    cnt=0;
    while ((!pq.empty())&&tmp>pq.top().first)
    {
        tmp-=pq.top().first;
        int id=pq.top().second;
        flag[id]=true;
        pq.pop();
        ++cnt;
    }
    ans=min(ans,1LL*cnt*x+x);
    t=x;
    for (int i=1;i<=n;i++)
        if (!flag[i]) t=min(t,solve(i,tmp));
    ans=min(ans,1LL*cnt*x+t);
    printf("%lld\n",ans);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
const int Max=1e6+7;
ll a[Max]; int n,k;

int main(){
    ios::sync_with_stdio(0);
    scanf("%d%d",&n,&k);
    for(int i=1; i<=n; i++) scanf("%lld",&a[i]);
    ll ans=0;
    //cout<<"OK"<<endl;
    if(a[1]>=0) ans=a[k];
    else if(a[n]<=0) ans=-a[n-k+1];
    else{
        int index=0;
        for(int i=1; i<=n; i++){
            if(a[i]>=0) {
                index=i; break;
            }
        }

        ans=0x3f3f3f3f;
        for(int i=index; i<index+k && i<=n; i++){
            ll tot=abs(a[i]);

            if(i-index+1<k){
               tot+=abs(a[i]);
               if(i-k+1>=1){
                    tot+=abs(a[i-k+1]);
                    //cout<<tot<<endl;
                    ans=min(tot,ans);
               }
            }else{
                //cout<<tot<<endl;
                ans=min(tot,ans);
            }
        }
        index--;
        for(int i=index; i>=1 && i>=index-k+1; i--){
            ll tot=abs(a[i]);
            if(index-i+1<k){
                tot+=abs(a[i]);
                if(k+i-1<=n){
                    tot+=abs(a[k+i-1]);
                    ans=min(ans,tot);
                }
            }
            else{
                ans=min(ans,tot);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
inline int read(){
    char c=getchar(); int res=0;
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)){ res=(c&15)+(res<<1)+(res<<3); c=getchar(); }
    return res;
}
int n,*a,*b;
int main(){
    n=read();
    a=new int[n]; b=new int[n+1];
    pair<int,int>*bound=new pair<int,int>[n+1];
    for(int i=0;i<=n;i++) bound[i]=make_pair(-1,-1);
    for(int i=0,cur=0;i<n;i++){
        a[i]=read();
        if(cur!=a[i]){
            bound[cur].second=i-1;
            bound[a[i]].first=i;
            cur=a[i];
        }
    }
    bound[a[n-1]].second=n-1;
    for(int i=0;i<n;i++) b[i]=read();
    int*off=new int[n+3]; off[0]=0; off++;
    for(int i=0;i<=n+1;i++) off[i]=0;
    for(int i=0,l,r;i<n;i++){
        l=bound[b[i]].first;
        r=bound[b[i]].second;
        if(l!=-1&&r!=-1){
            if(i<l){
                off[l-i]--;
                off[r-i+1]++;
            }else if(i>r){
                off[n+l-i]--;
                off[n+r-i+1]++;
            }else{
                off[0]--;
                off[r-i+1]++;
                off[n+l-i]--;
            }
        }
    }
    for(int i=0;i<n;i++) off[i]+=off[i-1];
    int res=-1;
    for(int i=0;i<n;i++){
        if(off[i]==0){
            res=i;
            break;
        }
    }
    if(res==-1){
        printf("No");
    }else{
        printf("Yes\n");
        for(int i=n;i<n<<1;i++){
            printf("%d ",b[(i-res)%n]);
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 5;
int a[NMAX], sol, n, m, s;

int main() {
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        a[x]++;
        a[y + 1]--;
    }
    for(int i = 1; i <= n; i++) {
        s += a[i];
        if(s == m) {
            sol++;
        }
    }
    cout << sol;
    return 0;
}

#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int n,m;
int main()
{
	int x,y,l=0,r=maxn;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&x,&y);
		l=max(x,l),r=min(y,r);
	}
	if(l>r)printf("0");
	else printf("%d\n",r-l+1);
	return 0;
}


/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

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

int main(){
ll n,m,d;
cin>>n>>m>>d;
if(d==0){
    cout<<(ld)(m-1)/n<<endl;
}
else{
    cout(10)<<(ld)2*(n-d)*(m-1)/(n*n)<<endl;
}
return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
int main() {
	double n, m, d;
	cin >> n >> m >> d;
	printf("%f\n", (n - d) / n / n * (d == 0 ? 1 : 2) * (m - 1));
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, K, ans = 1e18;

int Solve(ll num, ll turn){
  if (turn == N){
    ans = min(ans, num);
    return 0;
  }

  Solve(num * 2, turn + 1);
  Solve(num + K, turn + 1);
  return 0;
}

int main(){
  cin >> N >> K;
  Solve(1, 0);
  cout << ans << endl;

  return 0;
}


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

using namespace std;

template<typename T>
class SegTree {
public:
    explicit SegTree(int n, T def) : N(calcN_(n)), def(def), mVal(2*calcN_(n)-1, def) {}
    void update(int idx, T value){
        int i = N + idx - 1;
        update_(mVal[i], value);
        while(i > 0){
            i = (i-1)/2;
            mVal[i] = operate(mVal[2*i+1], mVal[2*i+2]);
        }
    }
    T get(int l, int r){
        return getImpl_(l, r, 0, 0, N);
    }
private:
    int calcN_(int n){
        int res = 1;
        while(res < n) res *= 2;
        return res;
    }
    T getImpl_(int l, int r, int idx, int rangeL, int rangeR){
        if(r <= rangeL || rangeR <= l) return def;
        if(l <= rangeL && rangeR <= r) return mVal[idx];
        int rangeM = (rangeL+rangeR)/2;
        T a = getImpl_(l, r, 2*idx+1, rangeL, rangeM);
        T b = getImpl_(l, r, 2*idx+2, rangeM, rangeR);
        return operate(a, b);
    }
    T update_(T& data, T val) { data = val; }
    T operate(T a, T b) { return min(a, b); }
    const int N;
    const T def;
    vector<T> mVal;
};

class UnionFind {
public:
    explicit UnionFind(int N) : root(N, -1), size(N, 1) {}
    int getRoot(int u){ return root[u] == -1 ? u : root[u] = getRoot(root[u]); }
    int getSize(int u){ return size[getRoot(u)]; }
    int same(int a, int b){
        return getRoot(a) == getRoot(b);
    }
    int merge(int a, int b){
        int u = getRoot(a);
        int v = getRoot(b);
        if(u != v){
            root[u] = v;
            size[v] += size[u];
        }
    }
private:
    vector<int> root;
    vector<int> size;
};

int main(){
    int N; long long D;
    while(cin >> N >> D){
        vector<long long> A(N);
        for(auto& t : A) cin >> t;
        vector<pair<long long, int>> key;
        for(int i=0;i<N;i++) key.emplace_back(A[i], i);
        sort(key.begin(), key.end());
        SegTree<pair<long long, int>> left(N, make_pair(1LL << 60, -1));
        SegTree<pair<long long, int>> right(N, make_pair(1LL << 60, -1));
        vector<pair<long long, pair<int, int>>> edge;
        for(auto& p : key){
            int idx = p.second;
            int idxL = left.get(0, idx).second;
            int idxR = right.get(idx+1, N).second;
            if(idxL != -1){
                edge.emplace_back((idx-idxL)*D + p.first + A[idxL], make_pair(idxL, idx));
            }
            if(idxR != -1){
                edge.emplace_back((idxR-idx)*D + p.first + A[idxR], make_pair(idxR, idx));
            }
            left.update(idx, make_pair((N-idx)*D + A[idx], idx));
            right.update(idx, make_pair(idx*D + A[idx], idx));
        }
        long long res = 0;
        UnionFind uf(N);
        sort(edge.begin(), edge.end());
        for(auto & e : edge){
            int u = uf.getRoot(e.second.first);
            int v = uf.getRoot(e.second.second);
            if(u != v){
                uf.merge(u, v);
                res += e.first;
            }
        }
        cout << res << endl;
    }
}

#pragma GCC optimize(2)
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

#define eprintf(...) fprintf(stderr, __VA_ARGS__)

const int maxn = 2e5 + 5;
int n, d, a[maxn];
ll dp[maxn];

int main() {
	scanf("%d %d", &n, &d);
	for (int i = 0; i < n; ++ i)
		scanf("%d", &a[i]);
	for (int i = 0; i < n; ++ i) dp[i] = a[i];
	for (int i = 0; i + 1 < n; ++ i)
		dp[i + 1] = min(dp[i + 1], dp[i] + d);
	for (int i = n - 1; i; -- i)
		dp[i - 1] = min(dp[i - 1], dp[i] + d);
	ll ans = 0;
	for (int i = 0; i < n; ++ i) ans += a[i];
	for (int i = 1; i < n - 1; ++ i) ans += dp[i];
	printf("%lld\n", ans + 1LL * d * (n - 1));
	return 0;
}


#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

using namespace std;

long long PRIME = 1000000007;

struct info{
    long long b;
    long long l;
    long long u;
    long long d_max;
};

bool comp(const info& l, const info& r){
    return l.d_max > r.d_max;
}

vector<info> info_vec;
vector<long long> sum_vec;
long long X;
long long N;

long long checkX(long long S){
    long long num = S / X;
    long long rest = S % X;

    if(rest == 0){
        return sum_vec[num];
    }

    long long ret = -1;

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

        if(i < num){
            val = sum_vec[num + 1];
            val -= info_vec[i].d_max;
        }
        else{
            val = sum_vec[num];
        }

        if(rest < info_vec[i].b){
            val += info_vec[i].l * rest;
        }
        else{
            val += info_vec[i].l * info_vec[i].b + info_vec[i].u * (rest - info_vec[i].b);
        }

        ret = max(ret, val);
    }

    return ret;
}

int main(int argc, char* argv[]){
    cin >> N >> X;

    info_vec.resize(N);
    sum_vec.resize(N + 1);

    long long b;
    long long l;
    long long u;

    long long cost_zero = 0;

    for(int i = 0; i < N; ++i){
        cin >> b >> l >> u;

        info_vec[i].b = b;
        info_vec[i].u = u;
        info_vec[i].l = l;
        info_vec[i].d_max = (X - b) * u + b * l;

        cost_zero -= l * b;
    }

    if(cost_zero == 0){
        cout << 0;
        return 0;
    }

    std::sort(info_vec.begin(), info_vec.end(), comp);

    sum_vec[0] = cost_zero;
    for(int i = 1; i <= N; ++i){
        sum_vec[i] = sum_vec[i-1] +info_vec[i-1].d_max;
    }

    long long min_X = 0;
    long long max_X = X * N;
    long long mid_X;
    long long cost;

    while(max_X - min_X > 1){
        mid_X = (min_X + max_X) / 2;

        cost = checkX(mid_X);

        if(cost < 0){
            min_X = mid_X;
        }
        else{
            max_X = mid_X;
        }
    }

    cout << max_X;

}