// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
#define N 55
int C[ N ][ N ];
void build(){
  for( int i = 0 ; i < N ; i ++ )
    C[ i ][ 0 ] = C[ i ][ i ] = 1;
  for( int i = 2 ; i < N ; i ++ )
    for( int j = 1 ; j < i ; j ++ )
      C[ i ][ j ] = add( C[ i - 1 ][ j ], C[ i - 1 ][ j - 1 ] );
}
int n , k , cnt[ 2 ];
void init(){
  n = getint();
  k = getint() / 50;
  for( int i = 0 ; i < n ; i ++ )
    cnt[ getint() / 50 - 1 ] ++;
}
PII dp[ N ][ N ][ 2 ];
queue< tuple< int , int , int > > Q;
inline void go(){
  dp[ cnt[ 0 ] ][ cnt[ 1 ] ][ 0 ] = { 0 , 1 };
  Q.push( MT( cnt[ 0 ] , cnt[ 1 ] , 0 ) );
  while( Q.size() ){
    tiii tp = Q.front(); Q.pop();
    int c0 = get<0>( tp );
    int c1 = get<1>( tp );
    int sd = get<2>( tp );
    if( sd == 0 ){
      for( int i = 0 ; i <= c0 ; i ++ )
        for( int j = 0 ; j <= c1 ; j ++ ){
          if( i + j == 0 ) continue;
          if( i + 2 * j > k ) break;
          int dlt = mul( dp[ c0 ][ c1 ][ sd ].SE , mul( C[ c0 ][ i ] , C[ c1 ][ j ] ) );
          if( dp[ c0 - i ][ c1 - j ][ 1 - sd ].FI == -1 ){
            dp[ c0 - i ][ c1 - j ][ 1 - sd ] = { dp[ c0 ][ c1 ][ sd ].FI + 1 , dlt };
            Q.push( { c0 - i , c1 - j , 1 - sd } );
          }else if( dp[ c0 - i ][ c1 - j ][ 1 - sd ].FI == dp[ c0 ][ c1 ][ sd ].FI + 1 ){
            dp[ c0 - i ][ c1 - j ][ 1 - sd ].SE = add( dp[ c0 - i ][ c1 - j ][ 1 - sd ].SE , dlt );
          }
        }
    }else{
      for( int i = 0 ; i <= cnt[ 0 ] - c0 ; i ++ )
        for( int j = 0 ; j <= cnt[ 1 ] - c1 ; j ++ ){
          if( i + j == 0 ) continue;
          if( i + 2 * j > k ) break;
          int dlt = mul( dp[ c0 ][ c1 ][ sd ].SE , mul( C[ cnt[ 0 ] - c0 ][ i ] , C[ cnt[ 1 ] - c1 ][ j ] ) );
          if( dp[ c0 + i ][ c1 + j ][ 1 - sd ].FI == -1 ){
            dp[ c0 + i ][ c1 + j ][ 1 - sd ] = { dp[ c0 ][ c1 ][ sd ].FI + 1 , dlt };
            Q.push( { c0 + i , c1 + j , 1 - sd } );
          }else if( dp[ c0 + i ][ c1 + j ][ 1 - sd ].FI == dp[ c0 ][ c1 ][ sd ].FI + 1 ){
            dp[ c0 + i ][ c1 + j ][ 1 - sd ].SE = add( dp[ c0 + i ][ c1 + j ][ 1 - sd ].SE , dlt );
          }
        }
    }
  }
}
void solve(){
  for( int i = 0 ; i <= cnt[ 0 ] ; i ++ )
    for( int j = 0 ; j <= cnt[ 1 ] ; j ++ )
      dp[ i ][ j ][ 0 ] = dp[ i ][ j ][ 1 ] = { -1 , 0 };
  go();
  printf( "%d\n%d\n" , dp[ 0 ][ 0 ][ 1 ].FI , dp[ 0 ][ 0 ][ 1 ].SE );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


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

struct node{
	int f;
	int s;
	int t;
};

node M_N(int a, int c, int d)
{
	node x;
	x.f = a;
	x.s = c;
	x.t = d;
	return x;
}

typedef long long ll;

const int MAXN = 60, MOD = 1000 * 1000 * 1000 + 7;
ll dist[MAXN][MAXN][2], t[MAXN][MAXN][2];
int mark[MAXN][MAXN][2];
ll ch[MAXN][MAXN];
int k, n;
int t1, t2;

void bfs(node strt)
{
	mark[strt.f][strt.s][strt.t] = true;
	dist[strt.f][strt.s][strt.t] = 0;
	t[strt.f][strt.s][strt.t] = 1;

	queue <node> q;
	q.push(strt);
	while(!q.empty())
	{
		node v = q.front();
		q.pop();
		mark[v.f][v.s][v.t] = 2;

		for(int i = 0; i <= t1; i++)
			for(int j = 0; j <= t2; j++)
			{
				if(v.t == 0 && (v.f < i || v.s < j))
					continue;
				if(v.t == 1 && (v.f > i || v.s > j))
					continue;

				if(!mark[i][j][1 - v.t])
				{
					int w = abs(i - v.f) * 50 + abs(j - v.s) * 100;
					if(w != 0 && w <= k)
					{
						dist[i][j][1 - v.t] = dist[v.f][v.s][v.t] + 1;

						int add = 1;
						if(v.t == 0)
							add = ch[v.f][abs(i - v.f)] * ch[v.s][abs(j - v.s)];
						else
							add = ch[t1 - v.f][abs(i - v.f)] * ch[t2 - v.s][abs(j - v.s)];

						t[i][j][1 - v.t] = t[v.f][v.s][v.t] * add;
						t[i][j][1 - v.t] %= MOD;

						mark[i][j][1 - v.t] = 1;
						q.push(M_N(i, j, 1 - v.t));
					}
				}
				else if(mark[i][j][1 - v.t] == 1)
				{
					int w = abs(i - v.f) * 50 + abs(j - v.s) * 100;
					if(w != 0 && w <= k && dist[v.f][v.s][v.t] + 1 == dist[i][j][1 - v.t])
					{
						int add = 1;
						if(v.t == 0)
							add = ch[v.f][abs(i - v.f)] * ch[v.s][abs(j - v.s)];
						else
							add = ch[t1 - v.f][abs(i - v.f)] * ch[t2 - v.s][abs(j - v.s)];
						t[i][j][1 - v.t] += t[v.f][v.s][v.t] * add;
						t[i][j][1 - v.t] %= MOD;
					}
				}
			}
	}
}

int main()
{

	cin>> n >> k;

	for(int i = 0; i < n; i++)
	{
		int a;
		cin>> a;
		if(a == 100)
			t2 ++;
		else
			t1 ++;
	}

	for(int i = 0; i <= n; i++)
		for(int j = 0; j <= i; j++)
			if(i == j || j == 0)
				ch[i][j] = 1;
			else
				ch[i][j] = (ch[i - 1][j - 1] + ch[i - 1][j]) % MOD;

	for(int i = 0; i <= n; i++)
		for(int j = 0; j <= n; j++)
			dist[i][j][0] = dist[i][j][1] = INT_MAX;
	bfs(M_N(t1, t2, 0));

	if(dist[0][0][1] == INT_MAX)
		dist[0][0][1] = -1;
	cout<< dist[0][0][1] << endl;
	cout<< t[0][0][1] << endl;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <math.h>
#include <set>
#include <map>
#include <stdio.h>
#include <queue>
#include <iomanip>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
using namespace std;
typedef long long ll;
const ll mod=1e9 + 7;
ll n,k,p1,p2,ncr[55][55];
struct node{
    ll w1,w2,side;
    node(ll x,ll y,ll z){
        w1=x;
        w2=y;
        side=z;
    }
};
queue<node> q;
ll steps[55][55][2],ways[55][55][2];
void bfs(){
    node cur(p1,p2,0);
    node p(1,1,0);
    q.push(cur);
    ll n1,n2;
    while(!q.empty()){
        cur=q.front();
        q.pop();
        for(int i=0;i<=cur.w1;i++){
            for(int j=0;j<=cur.w2;j++){
                if((j!=0 || i!=0) && ((i*50+j*100)<=k)){
                    n1=p1-cur.w1+i;
                    n2=p2-cur.w2+j;
                    if(steps[n1][n2][1-cur.side]==-1){
                        steps[n1][n2][1-cur.side]=1+steps[cur.w1][cur.w2][cur.side];
                        ways[n1][n2][1-cur.side]=(ways[cur.w1][cur.w2][cur.side]*(ncr[cur.w1][i])*(ncr[cur.w2][j]))%mod;
                        p.w1=n1;
                        p.w2=n2;
                        p.side=1-cur.side;
                        q.push(p);
                    }
                    else if(steps[n1][n2][1-cur.side]==1+steps[cur.w1][cur.w2][cur.side]){
                        ways[n1][n2][1-cur.side]=(ways[n1][n2][1-cur.side]+ways[cur.w1][cur.w2][cur.side]*(ncr[cur.w1][i])*(ncr[cur.w2][j]))%mod;
                    }
                }
            }
        }
    }
}
int main()
{
    fio;
    cin>>n>>k;
    ll x;
    p1=0;p2=0;
    for(int i=1;i<=n;i++){
        cin>>x;
        if(x==50)
            p1++;
        else
            p2++;
    }
    for(int i=0;i<=n;i++)
        ncr[i][0]=1;
    ncr[1][1]=1;
    for(int i=2;i<=n;i++){
        for(int j=1;j<=i;j++){
            ncr[i][j]=(ncr[i-1][j]+ncr[i-1][j-1])%mod;
        }
    }
    memset(steps, -1, sizeof(steps));
    memset(ways, 0, sizeof(ways));
    steps[p1][p2][0]=0;
    ways[p1][p2][0]=1;
    bfs();
    cout<<steps[p1][p2][1]<<endl;
    cout<<ways[p1][p2][1];
}


/* Author : RISHAV GOYAL */

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

#define LL long long int
#define UL unsigned long long int

#define imax INT_MAX
#define imin INT_MIN
#define LLmax LLONG_MAX
#define LLmin LLONG_MIN

#define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++)
#define rep(i,n) for(int i= int(1); i<= (int)n; i++)
#define FORd(i,a,b,d) for(int i=(int)a; i<= (int)b; i+=(int)d)

#define pr() printf("Reached here 1...\n");
#define pr1() printf("Reached here 2...\n");

#define CLR(a) memset(a,0,sizeof(a));
#define SET(a) memset(a,-1,sizeof(a));

#define str strlen
#define sz size()
#define pb(x) push_back(x)
#define mp make_pair
#define ii pair<int,int>
#define ll pair<LL,LL>

#define F first
#define S second
#define gcd(a,b) __gcd(a,b)

#define mod int(1e9 + 7)
#define MAX int(1e5 + 10)

#define si(a) scanf("%d",&a);

#define VI vector<int>
#define VL vector<LL>
#define VS vector<string>
#define VC vector<char>

LL powmod(LL a,int b,int n){LL rm=1;while (b){if (b % 2) { rm = (rm * a) % n; }a = (a * a) % n;b /= 2;}return rm;}

LL dp[150][60][60]={0},fac[100],invfac[100];

void end(){
	cout<<-1<<endl<<0<<endl;
	exit(0);
}

LL ncr(int n,int r){
	return ( fac[n] * (invfac[n-r] * invfac[r])%mod)%mod;
}

int main()
{
	fac[0] = invfac[0] = 1;
	for(LL i=1;i<=100;++i) {
		fac[i] = (i * fac[i-1])%mod;
		invfac[i] = powmod(fac[i],mod-2,mod);
	}
	int nt=0,n,k,o=0,t=0,w[100];
	cin >> n >> k;
	rep(i,n) cin >> w[i];
	k /= 50;
	rep(i,n) {
		w[i] /= 50;
		o += (w[i] == 1), t += (w[i]==2);
	}
	dp[1][o][t] = 1; // [][50][100] people on left side before ith trans.

	for(int i=1;;i++){
		if(i>101) end();
		if(i%2){
			for(int o1=0;o1<=o;++o1){
				for(int t1=0;t1<=t;++t1){
					for(int go=0;go<=o1;++go){
						for(int gt=0;gt<=t1;++gt){
							if(gt+go){
								if( go + 2 * gt <= k){
				dp[i+1][o1-go][t1-gt] += (dp[i][o1][t1] * (ncr(o1,go) * ncr(t1,gt))%mod)mod;
								}
							}
						}
					}
				}
			}
		}
		else{
			for(int o1=0;o1<=o;++o1){
				for(int t1=0;t1<=t;++t1){
					int ro1 = o - o1, rt1 = t - t1;
					for(int go=0;go<=ro1;++go){ // o1+go
						for(int gt=0;gt<=rt1;++gt){
							if(gt+go){
								if( go + 2 * gt <= k){
							dp[i+1][o1+go][t1+gt] += ((ncr(ro1,go) * ncr(rt1,gt))%mod  * dp[i][o1][t1])%mod;
								}
							}
						}
					}
				}
			}
		}
		if(dp[i+1][0][0]){
			cout << i << endl;
			cout << dp[i+1][0][0] << endl;
			return 0;
		}

	}
	return 0;
}


// ConsoleApplication1.cpp: ���������� ����� ����� ��� ����������� ����������.
//

#include <stdio.h>
#include <malloc.h>
#include <iostream>

int main()
{
	using namespace std;
	int m, n, k, p, x = 0, i, max, imax;
	int* r;
	cin("%d", &m);
	cin("%d", &k);
	cin("%d", &n);
	if (n >= k)
		cout("0");
	else {
		r = (int*)malloc(m * sizeof(int));
		for (i = 0; i < m; i++)
			cin("%d", &r[i]);
		k = k - n + 1;
		do {
			x++;
			max = 0;
			for (i = 0; i < m; i++)
				if (r[i] > max)
				{
					max = r[i]; imax = i;
				}
			r[imax] = 0;
			if (max >= k)
				break;
			k = k - max + 1;
		} while (1);
		}
	cout("%d", x);
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int main()
{
    ll n, m, k;
    vi v;
    cin >> n >> m >> k;
    for(ll i = 0; i < n; i++)
    {
        ll x;
        cin >> x;
        v.pb(x);
    }
    sort(v.begin(), v.end(), greater<>());
    ll q = v.size();
    ll i = 0;
    ll cnt = 0;
    if(k>=m)
    {
        cout << 0;
        return 0;
    }
    else
    {
        for(ll i = 0; i < q; i++)
        {
            k+=v[i]-1; cnt++;
            if(m-k>0)
            {
                m-=k;
            }
            else
            {
                cout << cnt << return 0;
            }
        }
    }
    cout << -1;

}


using namespace std;
typedef double DO;
const int NN = 100011;
const DO eps = 1e-7;

struct point {
	DO x, y;
	point (DO x=0, DO y=0) : x(x), y(y) {}
	point operator - (point a) {return point(x-a.x, y-a.y);}
	point operator + (point a) {return point(x+a.x, y+a.y);}
	point operator * (DO a) {return point(x*a, y*a);}
	point operator / (DO a) {return point(x/a, y/a);}
	DO    operator ^ (point a) {return x*a.y-y*a.x;}
	DO    operator * (point a) {return x*a.x+y*a.y;}
	point norm() {DO s=nor(); if (s<eps) return *this; return point(x/s, y/s);}
	point conj() {return point(-y, x);}
	DO nor() {return sqrt(*this**this);}
	bool operator < (const point &a) const {
		if (fabs(x-a.x)>eps) return x<a.x;
		return y<a.y-eps;
	}
	void input() {scanf("%lf %lf", &x, &y);}
} p[NN], mid, dir, O;

int n, r;
int nn;
DO d;

inline bool cmp(point &u, point &v, point &w) {
	if((u-v ^ w-v) > -eps) return true;
	mid = (u + w) / 2;
	dir = (w - u).norm().conj();
	d   = (mid - u).nor();
	d = sqrt((INT)r * r - d * d);
	O = mid + dir * d;
	return (v - O).nor() < r+eps;
}

DO ans;

inline void calc(point u, point v) {
	ans += u ^ v;
	mid = (u + v) / 2;
	dir = (v - u).norm().conj();
	d   = (mid - u).nor();
    d = sqrt((INT)r * r - d * d);
	O = mid + dir * d;
	u = u - O; v = v - O;
    DO al = acos(u * v / u.nor() / v.nor());
    ans += al * r * r - d * (v-u).nor();
}

int solve() {
	cin >> n >> r;
	if(n==1) return puts("0");
	for(int i=0; i<n; i++) p[i].input();
	for(int i=1; i<n; i++) if(p[i] < p[0]) swap(p[0], p[i]);
	sort(p+1, p+n, [&](point u, point v) {
        u = u - p[0]; v = v - p[0];
        DO vec = u ^ v;
        if(abs(vec) > eps) return vec > 0;
        return u.nor() < v.nor();
	});

    for(int i=0; i<n; i++) {
		while(nn>1 and cmp(p[nn-2], p[nn-1], p[i])) nn--;
        p[nn++] = p[i];
    }
    p[n = nn] = p[0];
    int st = 0, ed = nn-1;
    while(st + 1 < ed) {
		if(cmp(p[ed-1], p[ed], p[st])) ed--;
		else if(cmp(p[ed], p[st], p[st+1])) st++;
		else break;
    }
    p[ed+1] = p[st];
    for(int i=st; i<=ed; i++) calc(p[i], p[i+1]);
    cout << fixed << setprecision(6) << ans/2 << endl;
}

int main() {
#ifndef	ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
    solve();
	return 0;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

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

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

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

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

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

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

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

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

namespace input {
	template<class T> void re(complex<T>& x);
	template<class T1, class T2> void re(pair<T1,T2>& p);
	template<class T> void re(vector<T>& a);
	template<class T, size_t SZ> void re(array<T,SZ>& a);

	template<class T> void re(T& x) { cin >> x; }
	void re(double& x) { string t; re(t); x = stod(t); }
	void re(ld& x) { string t; re(t); x = stold(t); }
	template<class T, class... Ts> void re(T& t, Ts&... ts) {
		re(t); re(ts...);
	}

	template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
	template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
	template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
	template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }

	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);

	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) {
		pr(t); pr(ts...);
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) {
		pr("{",x.f,", ",x.s,"}");
	}
	template<class T> void pr(const T& x) {
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0;
		pr("}");
	}

	void ps() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void ps(const T& t, const Ts&... ts) {
		pr(t); if (sizeof...(ts)) pr(" "); ps(ts...);
	}

	void pc() { pr("]\n"); } // debug w/ commas
	template<class T, class... Ts> void pc(const T& t, const Ts&... ts) {
		pr(t); if (sizeof...(ts)) pr(", "); pc(ts...);
	}
	#define dbg(x...) pr("[",#x,"] = ["), pc(x);
}

using namespace output;

namespace io {
	void setIn(string s) { freopen(s.c_str(),"r",stdin); }
	void setOut(string s) { freopen(s.c_str(),"w",stdout); }
	void setIO(string s = "") {
		cin.sync_with_stdio(0); cin.tie(0); // fast I/O
		cin.exceptions(cin.failbit); // ex. throws exception when you try to read letter into int
		if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
	}
}

using namespace io;

template<class T> T invGeneral(T a, T b) {
	a %= b; if (a == 0) return b == 1 ? 0 : -1;
	T x = invGeneral(b,a);
	return x == -1 ? -1 : ((1-(ll)b*x)/a+b)%b;
}

template<class T> struct modular {
	T val;
	explicit operator T() const { return val; }
	modular() { val = 0; }
	modular(const ll& v) {
		val = (-MOD <= v && v <= MOD) ? v : v % MOD;
		if (val < 0) val += MOD;
	}

	// friend ostream& operator<<(ostream& os, const modular& a) { return os << a.val; }
	friend void pr(const modular& a) { pr(a.val); }
	friend void re(modular& a) { ll x; re(x); a = modular(x); }

	friend bool operator==(const modular& a, const modular& b) { return a.val == b.val; }
	friend bool operator!=(const modular& a, const modular& b) { return !(a == b); }
	friend bool operator<(const modular& a, const modular& b) { return a.val < b.val; }

	modular operator-() const { return modular(-val); }
	modular& operator+=(const modular& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	modular& operator-=(const modular& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	modular& operator*=(const modular& m) { val = (ll)val*m.val%MOD; return *this; }
	friend modular pow(modular a, ll p) {
		modular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
		return ans;
	}
	friend modular inv(const modular& a) {
		auto i = invGeneral(a.val,MOD); assert(i != -1);
		return i;
	} // equivalent to return exp(b,MOD-2) if MOD is prime
	modular& operator/=(const modular& m) { return (*this) *= inv(m); }

	friend modular operator+(modular a, const modular& b) { return a += b; }
	friend modular operator-(modular a, const modular& b) { return a -= b; }
	friend modular operator*(modular a, const modular& b) { return a *= b; }

	friend modular operator/(modular a, const modular& b) { return a /= b; }
};

typedef modular<int> mi;
typedef pair<mi,mi> pmi;
typedef vector<mi> vmi;
typedef vector<pmi> vpmi;

typedef ld T;

namespace Point {
    typedef pair<T,T> P;
    typedef vector<P> vP;

    P dir(T ang) {
        auto c = exp(ang*complex<T>(0,1));
        return P(c.real(),c.imag());
    }

    T norm(P x) { return x.f*x.f+x.s*x.s; }
    T abs(P x) { return sqrt(norm(x)); }
    T angle(P x) { return atan2(x.s,x.f); }
    P conj(P x) { return P(x.f,-x.s); }

    P operator+(const P& l, const P& r) { return P(l.f+r.f,l.s+r.s); }
    P operator-(const P& l, const P& r) { return P(l.f-r.f,l.s-r.s); }
    P operator*(const P& l, const T& r) { return P(l.f*r,l.s*r); }
    P operator*(const T& l, const P& r) { return r*l; }
    P operator/(const P& l, const T& r) { return P(l.f/r,l.s/r); }
    P operator*(const P& l, const P& r) { return P(l.f*r.f-l.s*r.s,l.s*r.f+l.f*r.s); }
    P operator/(const P& l, const P& r) { return l*conj(r)/norm(r); }

    P& operator+=(P& l, const P& r) { return l = l+r; }
    P& operator-=(P& l, const P& r) { return l = l-r; }
    P& operator*=(P& l, const T& r) { return l = l*r; }
    P& operator/=(P& l, const T& r) { return l = l/r; }
    P& operator*=(P& l, const P& r) { return l = l*r; }
    P& operator/=(P& l, const P& r) { return l = l/r; }

    P unit(P x) { return x/abs(x); }
    T dot(P a, P b) { return (conj(a)*b).f; }
    T cross(P a, P b) { return (conj(a)*b).s; }
    T cross(P p, P a, P b) { return cross(a-p,b-p); }
    T dist(P p, P a, P b) { return std::abs(cross(p,a,b))/abs(a-b); }

    P rotate(P a, T b) { return a*P(cos(b),sin(b)); }
    P reflect(P p, P a, P b) { return a+conj((p-a)/(b-a))*(b-a); }
    P foot(P p, P a, P b) { return (p+reflect(p,a,b))/(T)2; }
    P extension(P a, P b, P c, P d) {
        T x = cross(a,b,c), y = cross(a,b,d);
        return (d*x-c*y)/(x-y);
    }
    // computes the intersection of line segments AB, CD
    // verification: https://open.kattis.com/problems/segmentintersection
    vP segIntersect(P a, P b, P c, P d) {
        if (a > b) swap(a,b);
        if (c > d) swap(c,d);

        auto a1 = cross(a,b,c), a2 = cross(a,b,d);
        if (a1 > a2) swap(a1,a2);
        if (!(a1 <= 0 && a2 >= 0)) return {};

        if (a1 == 0 && a2 == 0) {
            if (cross(a,c,d) != 0) return {};
            auto x1 = max(a,c), x2 = min(b,d);
            if (x1 > x2) return {};
            if (x1 == x2) return {x1};
            return {x1,x2};
        }

        auto z = extension(a,b,c,d);
        if (a <= z && z <= b) return {z};
        return {};
    }

    // sorts points according to atan2
    // verification: ?
    template<class T> int half(pair<T,T> x) { return mp(x.s,x.f) > mp((T)0,(T)0); }
    bool cmp(P a, P b) {
        int A = half(a), B = half(b);
        if (A != B) return A < B;
        return cross(a,b) > 0;
    }

    // computes the center of mass of a polygon with constant mass per unit area
    // verification: kattis polygonarea, VT HSPC 2018 Holiday Stars
    T area(const vP& v) {
        T area = 0;
        F0R(i,sz(v)) {
            int j = (i+1)%sz(v); T a = cross(v[i],v[j]);
            area += a;
        }
        return std::abs(area)/2;
    }
    P centroid(const vP& v) {
        P cen(0,0); T area = 0; // 2*signed area
        F0R(i,sz(v)) {
            int j = (i+1)%sz(v); T a = cross(v[i],v[j]);
            cen += a*(v[i]+v[j]); area += a;
        }
        return cen/area/(T)3;
    }

    // tests whether a point is inside, on, or outside the perimeter of any polygon
    // verification: https://open.kattis.com/problems/pointinpolygon
    string inPoly(const vP& p, P z) {
        int n = sz(p), ans = 0;
        F0R(i,n) {
            P x = p[i], y = p[(i+1)%n];
            if (cross(x,y,z) == 0 && min(x,y) <= z && z <= max(x,y)) return "on";
            if (x.s > y.s) swap(x,y);
            if (x.s <= z.s && y.s > z.s && cross(z,x,y) > 0) ans ^= 1;
        }
        return ans ? "in" : "out";
    }

    pair<P,T> ccCenter(P a, P b, P c) { // circumcenter
        b -= a; c -= a;
        P res = b*c*(conj(c)-conj(b))/(b*conj(c)-conj(b)*c);
        return {a+res,abs(res)};
    }

    pair<P, T> mec(vP ps) { // minimum enclosing circle, ex. USACO Camp 2019 Contest 2 #4
        shuffle(all(ps), mt19937(time(0)));
        P o = ps[0]; T r = 0, EPS = 1 + 1e-8;
        F0R(i,sz(ps)) if (abs(o-ps[i]) > r*EPS) {
            o = ps[i], r = 0;
            F0R(j,i) if (abs(o-ps[j]) > r*EPS) {
                o = (ps[i]+ps[j])/2, r = abs(o-ps[i]);
                F0R(k,j) if (abs(o-ps[k]) > r*EPS)
                    tie(o,r) = ccCenter(ps[i],ps[j],ps[k]);
            }
        }
        return {o,r};
    }
};

using namespace Point;

pair<vi,vi> ulHull(const vP& P) {
    vi p(sz(P)), u, l; iota(all(p), 0);
    sort(all(p), [&P](int a, int b) { return P[a] < P[b]; });
    trav(i,p) {
        #define ADDP(C, cmp) while (sz(C) > 1 && cross(\
            P[C[sz(C)-2]],P[C.back()],P[i]) cmp 0) C.pop_back(); C.pb(i);
        ADDP(u, >=); ADDP(l, <=);
    }
    return {u,l};
}

vi convexHull(const vP& P) {
    vi u,l; tie(u,l) = ulHull(P);
    if (sz(l) <= 1) return l;
    if (P[l[0]] == P[l[1]]) return {0};
    l.insert(end(l),rbegin(u)+1,rend(u)-1); return l;
}

int n,r;
set<pair<T,int>> S;
set<pair<T,int>>::iterator inserted[MX];
set<int> lef;
vP c;

int pre(int x) {
	auto it = lef.lb(x);
	if (it == begin(lef)) it = end(lef);
	return *prev(it);
}

int nex(int x) {
	auto it = lef.ub(x);
	if (it == end(lef)) it = begin(lef);
	return *it;
}

void del(int i) {
	int a = sz(S);
	S.erase(inserted[i]);
	assert(a-1 == sz(S));
	// lef.erase(i);
}

void ins(int i) {
	if (!lef.count(i)) {
		ps("WUT",lef,i);
		exit(0);
	}
	inserted[i] = S.insert({ccCenter(c[pre(i)],c[i],c[nex(i)]).s,i}).f;
}

void init() {
	// setIO("E");
	setIO();
	re(n,r);
	vP b(n); re(b);
	/*F0R(i,n) {
		// -10000 to 10000
		b[i].f = rand()%10000000;
		b[i].f /= 1000;
		b[i].s = sqrt(1e8-pow(b[i].f,2));
		b[i].s = floor(1000*b[i].s)/1000;
	}*/
	vi v = convexHull(b);
	trav(t,v) c.pb(b[t]);
	F0R(i,sz(c)) lef.insert(i);
	if (sz(c) > 2) F0R(i,sz(c)) ins(i);
}

ld arc(P a, P b) {
	ld d = abs(a-b);
	ld ang = asin(d/2/r)*2;
	return r*r*(ang-sin(ang))/2;
}

bool obtuse(P a, P b, P c) {
	a -= b, c -= b;
	return a.f*c.f+a.s*c.s <= 0;
}

int main() {
	init();
	while (sz(S) && S.rbegin()->f > r*(1-(1e-8))) {
		if (sz(lef) != sz(S)) {
			// ps("BADLS",sz(c),sz(lef),sz(S));
			exit(0);
		}
		if (sz(S) == 3) {
			vd tmp; trav(t,lef) tmp.pb(t);
			while (!obtuse(c[tmp[0]],c[tmp[1]],c[tmp[2]]))
				rotate(begin(tmp),begin(tmp)+1,end(tmp));
			lef.erase(tmp[1]); S.clear();
			// ps("HA"); exit(0);
			// ps("HA");
			continue;
			// exit(0);
		}
		// ps("WUT",sz(S)); exit(0);
		int x = S.rbegin()->s;
		del(x); lef.erase(x);
		// if (sz(lef) != sz(S)) ps("PRE");
		if (sz(lef) > 2) {
			del(pre(x)); ins(pre(x));
			del(nex(x)); ins(nex(x));
		}
	}
	if (n == 422) {
		ps("OOPS",sz(c),sz(res),S.rbegin()->f);
	}
	vP res; trav(t,lef) res.pb(c[t]);
	ld ans = 0;
	F0R(i,sz(res)) ans += arc(res[i],res[(i+1)%sz(res)]);
	ans += area(res);
	cout << fixed << setprecision(6) << ans;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?), set tle
	* do smth instead of nothing and stay organized
*/


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << " = "; for (auto xxxx: a) cerr << xxxx << " "; cerr << endl

using namespace std;

typedef long long ll;
typedef double dbl;
const int INF = 1.01e9;

struct pt {
    ll x, y;

    pt() {}

    pt(ll xx, ll yy) : x(xx), y(yy) {}

    pt operator+(pt A) {
        return pt(x + A.x, y + A.y);
    }

    pt operator-(pt A) {
        return pt(x - A.x, y - A.y);
    }

    pt operator*(ll k) {
        return pt(x * k, y * k);
    }

    pt operator/(ll k) {
        assert(x % k == 0 && y % k == 0);
        return pt(x / k, y / k);
    }

    ll operator*(pt A) {
        return x * A.y - y * A.x;
    }

    ll operator%(pt A) {
        return x * A.x + y * A.y;
    }

    bool operator==(pt A) {
        return x == A.x && y == A.y;
    }

    bool operator!=(pt A) {
        return x != A.x && y != A.y;
    }

    pt rotate() {
        return pt(-y, x);
    }

    ll len2() {
        return x * x + y * y;
    }

    dbl len() {
        return sqrt(x * x + y * y);
    }

    void read() {
        scanf("%lld%lld", &x, &y);
    }
};

vector<pt> convexHull(vector<pt> p) {
    sort(all(p), [](pt A, pt B) {
        return A.x < B.x || (A.x == B.x && A.y < B.y);
    });
    vector<pt> st;
    for (int tt = 0; tt < 2; tt++) {
        int cur = st.size();
        for (auto A: p) {
            for (; (int)st.size() >= cur + 2 && (st.back() - st[st.size() - 2]) * (A - st.back()) <= 0; st.pop_back());
            st.pb(A);
        }
        st.pop_back();
        reverse(all(p));
    }
    return st;
}

int main() {
#define TASK "A"
#ifdef HOME
    assert(freopen(TASK
                   ".in", "r", stdin));
#endif
    int F = 1e3;
    int n, r;
    scanf("%d%d", &n, &r);
    r *= F;
    vector<pt> p(n);
    for (int i = 0; i < n; i++) {
        dbl x, y;
        scanf("%lf%lf", &x, &y);
        p[i] = pt(round(x * F), round(y * F));
    }

    auto ch = convexHull(p);
    int m = ch.size();
    vector<int> nxt(m);
    vector<int> prv(m);
    vector<dbl> val(m);
    for (int i = 0; i < m; i++) {
        nxt[i] = (i + 1) % m;
        prv[i] = (i + m - 1) % m;
    }
    db(m);
    set<pair<dbl,int>> event;
    auto getR = [&](int id) {
//        db3(prv[id], id, nxt[id]);
        pt A = ch[prv[id]];
        pt B = ch[id];
        pt C = ch[nxt[id]];
        if (prv[id] == nxt[id]) {
            assert(prv[id] != id);
            return (A - B).len() / 2;
        }
        pt v = (A - B);
        pt u = (C - B);
        dbl tmpAng = atan2(u * v, v % u);
        assert(tmpAng > 0);
        if (tmpAng < acos(-1) / 3) {
            return 0;
        }
        dbl a = (A - B).len();
        dbl b = (B - C).len();
        dbl c = (A - C).len();
        ///db3(a, b, c);
        dbl pp = (a + b + c) / 2;
        return a * b * c / (4 * sqrt(pp * (pp - a) * (pp - b) * (pp - c)));
    };

    vector<int> alive(ch.size(), 1);
    auto kill = [&](int id) {
        assert(alive[id] == 1);
        alive[id] = 0;
        int v = prv[id];
        int u = nxt[id];
        assert(alive[v] == 1);
        assert(alive[u] == 1);
        event.erase({val[v], v});
        event.erase({val[u], u});
        nxt[v] = u;
        prv[u] = v;
        val[v] = getR(v);
        val[u] = getR(u);
        event.insert({val[v], v});
        event.insert({val[u], u});
    };
    if (m <= 1) {
        puts("0.0");
        return 0;
    }
    if (m > 2) {

        for (int i = 0; i < m; i++) {
            val[i] = getR(i);
            event.insert({val[i], i});
        }
        while (true) {
            while (event.empty());
//            assert(!event.empty());
//            for (auto x: event) {
//                db2(x.F, x.S);
//            }
            if (event.rbegin()->F <= r + 1e-9) {
                break;
            }
            auto id = event.rbegin()->S;
//            db(id);
            event.erase(*event.rbegin());
            kill(id);
        }
    }

    int gg = -1;
    for (int i = 0; i < sz(ch); i++) {
        if (alive[i]){
            gg = i;
            break;
        }
    }

    vector<pt> res;
    for (;alive[gg]; gg = nxt[gg]) {
        alive[gg] = 0;
        res.pb(ch[gg]);
    }

//    db(res.size());
//    for (auto A: res) {
//        db2(A.x, A.y);
//    }
    dbl answer = 0;
    for (int i = 0; i < sz(res); i++) {
        answer += res[i] * res[(i + 1) % sz(res)] / 2.0;
    }
//    db(answer / F / F);

    for (int i = 0; i < sz(res); i++) {
        dbl len = (res[i] - res[(i + 1) % sz(res)]).len();
        dbl c = len / 2;
        dbl h = sqrt(max((dbl)0, r * 1.0 * r - c * c));
        dbl ang = asin(min((dbl)1, c / r)) * 2;
        dbl add = ang * r * 1.0 * r / 2 - c * h;
//        db3(len, r, add / F / F);
        answer += add;
    }

    printf("%.17f\n", answer / F / F);

    return 0;
}


//Studied From CjLD
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<iostream>
#define mp make_pair
#define x first
#define y second
#define pdd pair<double,double>
using namespace std;
const double pi=3.1415926535898,eps=1e-6;
int n,up_,dn_,c_,s,t;
double r,ans;
pdd p[100000],up[100001],dn[100001],c[100001],o[100001],b[100001];

pdd operator-(pdd a,pdd b){return mp(a.x-b.x,a.y-b.y);}
double Nj(pdd a,pdd b){return a.x*b.x+a.y*b.y;}
double Xj(pdd a,pdd b){return a.x*b.y-a.y*b.x;}
double dis(pdd a){return sqrt(a.x*a.x+a.y*a.y);}
void convex()
{
	sort(p,p+n);
	up_=0;
	dn_=0;
	c_=0;
	for(int i=0;i<n;++i)
	{
		for(;up_>1&&Xj(p[i]-up[up_-1],up[up_]-up[up_-1])>0;)up_--;
		up[++up_]=p[i];
	}
	for(int i=n-1;i>=0;--i)
	{
		for(;dn_>1&&Xj(p[i]-dn[dn_-1],dn[dn_]-dn[dn_-1])>0;)dn_--;
		dn[++dn_]=p[i];
	}
	for(int i=1;i<=up_;++i)c[++c_]=up[i];
	for(int i=2;i<dn_;++i)c[++c_]=dn[i];
}

pdd calc(pdd a,pdd b)
{
	pdd c=b-a;
	c.x/=2,c.y/=2;
	double tmp=sqrt(r*r-c.x*c.x-c.y*c.y)/dis(c);
	return mp((b.x+a.x)/2-c.y*tmp,(b.y+a.y)/2+c.x*tmp);

}

bool in_circle(pdd a,pdd b,pdd o,pdd p){return Nj(b-a,p-a)>-eps&&dis(p-o)<=r;}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("cf.in","rb",stdin);
	freopen("cf.out","wb",stdout);
	#endif
	cin>>n>>r;
	for(int i=0;i<n;++i)cin>>p[i].x>>p[i].y;
	n=unique(p,p+n)-p;
	convex();
	s=1;t=0;
	for(int i=1;i<=c_;++i)
	{
		for(;t>1&&!in_circle(b[t-1],b[t],o[t],c[i]);)t--;
		b[++t]=c[i];
		if(t>1)o[t]=calc(b[t-1],b[t]);
	}
	for(bool next;next;)
	{
		next=0;
		if(t>s+1&&dis(b[t]-o[s+1])>r)s++,next=1;
		if(t>s+1&&dis(b[s]-o[t])>r)t--,next=1;
	}
	//for(int i=s;i<=t;++i)cout<<b[i].x<<' '<<b[i].y<<endl;
	b[++t]=b[s];
	for(;s<t;++s)
	{
		pdd cen=calc(b[s],b[s+1]);
		double aga=atan2(b[s].y-cen.y,b[s].x-cen.x);
		double agb=atan2(b[s+1].y-cen.y,b[s+1].x-cen.x);
		if(aga>agb)agb+=pi*2;
		//cout<<Xj(b[s]-cen,b[s+1]-cen)<<endl;
		ans+=(agb-aga)*r*r-Xj(b[s]-cen,b[s+1]-cen)+Xj(b[s],b[s+1]);
	}
	cout<<fixed<<setprecision(6)<<ans/2<<endl;
	return 0;
}


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

int main() {

	int x;
	cin>>x;
	int ctr = 1;
    string a[x] ;
	for (int i = 0; i < x; i++)
		( getline (cin,a[i]) )
	for (int j =0; j < x; j++)
		(
			int t = j - 1;
			if (t > 1)
				(
			        while (t >= 0)
			            (
			                if (a[j]!= a[t])
				                continue;
				            else if (a[j] == a[t])
					            ctr++;
				            t--;
			            )
		        )
		)
	cout<<ctr<<endl;

	return 0;
}


#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int max=0;
    for (int i=0;i<n;i++){
        cin>>a[i];
        if (a[i]> max){
            max = a[i];
        }
    }

    for (int i=0;i<n;i++){
        a[a[i]%k] += k;
    }
    max = a[0]
    for (int i=1;i<n;i++){
        if (a[i]>max){
            max = a[i];
        }
    }
    cout<<max;
}


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

int main()
{
      int n,a[101];

      memset(a,0,10);
      scanf("%d",&n);

      for(i=0;i<10;i++)
      cout<<a[i];

}


#include <bits/stdc++.h>

using namespace std;

int main()
{long long n;
cin >> n;
long long a[n-1];
cin >> a[0];
for (int i=1;i<n;i++)
{
    cin >> a[i];

long long p[100000];
long long d=0;

for (int i=0;i<n-1;i++)
{long long j=i+1, k=1;
    while (a[i]==a[j])
    {
        k++;
        j++;
    }
    p[d]=k+1;
    d++;
}
sort(p,p+d);
if (p[0]==0)
{
    cout << 1;
}else
cout << p[0];
    return 0;
}


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

int main()
{
    int n,n1,sum1,sum2;
    string num;
    stringstream ss;
    cin>>n;

    if(n<2 || n>50 || n%2!=0)
    return 0;

    cin>>num;

    for(int i=0;i<n;i++)
    {
            if(num[i] != '7' && num[i] != '4')
            {
            cout<<"NO"<<endl;
            system("pause");
            return 0;
            }
    }

    for(int i=0;i<n/2;i++)
    {
        ss<<num[i];
        ss>> n1;
        ss.clear();
        sum1+=n1;
    }

    for(int i=n/2; i<n ;i++)
    {

        ss<<num[i];
        ss>> n1;
        ss.clear();
        sum2+=n1;
    }

    if(sum1 == sum2)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;

     system("pause");
    return 0;

}


#include<iostream>
using namespace std;
int s1, s2, n ;
int main()
{
    string num;
    cin >> n;
    cin >> num;
    for (int i = 0; i < n / 2; ++i)
    {
        s1 += num[i] - '0';
        if ((num[i] != '4' )&& (num[i] != '7'))
         {
            cout << "NO" << endl;
            return 0;
        }
    }

    for (int i = n / 2; i < n; ++i)
    {
        s2 += num[i] - '0';

        if (num[i] != '4' && num[i] != '7')
         {
            cout << "NO" << endl;
            return 0;
        }
    }

    if (s1 == s2) cout << "YES";
    else  cout << "NO";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n,sum1=0,sum2=0,flag=0;
 cin>>n;
 int z[n];
 cin>>z;
 for(int i=0;i<n;i++)
 {
   if(z[i]==4|| z[i] ==7)
   {

   }
  else
  {
  flag=1;
  break;
  }
 }
 if(flag==0)
 {
 for(int i=0;i<n/2;i++)
 {
   sum1+=(z[i]-0);
 }
 for(int i=n/2;i<n;i++)
 {
   sum2+=(z[i]-0);
 }
 if(sum1==sum2)
 cout<<"YES";
 else
 cout<<"NO";
 }
 else
 cout<<"NO";
 return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int r, l, a;
	scanf_s("%d %d %d", &r, &l, &a);
	int d;
	d = intabs(r - l);
	int num;
	if (d >= a)
	{
		num = r+l-d+2*a;
	}
	else
	{
		if ((r + l + a) % 2 == 0)
		{
			num = r + l + a;
		}
		else
		{
			num = r + l + a - 1;
		}
	}
	printf("%d", num);
	return 0;
}


# include <bits/stdc++.h>
using namespace std;
int l,r,a,ans,a1;
int main()
{
    cin>>l>>r>>a;
    if (a==0) cout<<(min(l,r))*2;
    else
    {
    if (l>=r)
    {
        a=a-(l-r);
        ans+=a-(l-r);
    }
    else
    {
    a=a-(r-l);
    ans+=a-(r-l);
    }
    a1=a/=2;
    cout<<(min(l,r))*2+ans+a1*2;

}


#include<bits/stdc++.h>
using namespace std;
int l, r,a, s, ans, l1, r1;
int main(){

    cin>>l>>r>>a;
  l1=l; r1=r;
    l=min(l,r);
    r=max(l1,r1);
    s=r-a;
    if(s>=a) cout<<mib((l+a),r)*2;
    else {
        l=r;
        a-=s;
        cout<<(l+a/2)*2;
    }
    return 0;
}


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bowling 22", "bowling 22\bowling 22.vcxproj", "{AE710919-A6F9-4168-8635-C6C5FBBC0240}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AE710919-A6F9-4168-8635-C6C5FBBC0240}.Debug|Win32.ActiveCfg = Debug|Win32
		{AE710919-A6F9-4168-8635-C6C5FBBC0240}.Debug|Win32.Build.0 = Debug|Win32
		{AE710919-A6F9-4168-8635-C6C5FBBC0240}.Release|Win32.ActiveCfg = Release|Win32
		{AE710919-A6F9-4168-8635-C6C5FBBC0240}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


#include <bits/stdc++.h>
#define maxn 1010
#define mo 1000000007
#define ll long long
using namespace std;
ll dp[maxn][maxn][2][2],n,k;
ll c[maxn][maxn],ans[maxn],fac[maxn];
//dp[i][j][k][l]代表前i个位置有j个good position,i,i+1是否被使用
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;++i)
	{
		c[i][0]=c[i][i]=1LL;
		for (int j=1;j<=i-1;++j)
		{c[i][j]=(c[i][j]+c[i-1][j]+c[i-1][j-1])%mo;}
	 }
	 fac[0] = fac[1] = 1LL;
	 for (int i = 2; i <= 1001; ++i) fac[i] = (fac[i - 1] * i * 1LL) % mo;
	 dp[0][0][1][0]=1;
	 for (int i=1;i<=n;++i)
	 {
	 	for (int j=0;j<=i-1;++j)
	 	for (int now=0;now<2;++now)
	 	for (int ne=0;ne<2;++ne)
	 	{
	 		dp[i][j][ne][0]=(dp[i][j][ne][0]+dp[i-1][j][now][ne])%mo;//如果取了别的数
	 		if (!now) dp[i][j+1][ne][0]=(dp[i][j+1][ne][0]+dp[i-1][j][now][ne])%mo;
	 		if (i<n) dp[i][j+1][ne][1]=(dp[i][j+1][ne][1]+dp[i-1][j][now][ne])%mo;
	 		//除了i=n,其他都会存在一种情况是一个去了的i-1对状态有影响。
			 //只考虑下一位会不会有使用的问题，那么dp方程就显得比较简单了。但是，这一步是存在重复的。
		 }
	 }
	 for (int i=0;i<=n;++i)
	 {
	 	for (int now=0;now<2;++now)
	 	for (int ne=0;ne<2;++ne)
	 	ans[i]=(ans[i]+dp[n][i][now][ne])%mo;
	 	ans[i] = ans[i] * fac[n - i] % mo;
	 //	for(int j=2;j<=n-i;++j) ans[i]=ans[i]*j%mo;

//	 for (int i=1;i<=n;++i) printf("%lld ",ans[i]);
	 int flag=-1;

	 for (int i=k+1;i<=n;++i)
	 {
	 	ans[k]=(ans[k]+flag*c[i][k]*ans[i]+mo)%mo;
	 	//对于每一个ans[i],我们要容斥处理。
	 	flag*=-1;
	 }
	 printf("%lld\n",ans[k]);
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define R register
using namespace std;
namespace chu_xuan{
    void swap(int &a,int &b){R int tmp=a;a=b,b=tmp;}
    void read(int &a) {a=0;int b=1,c=getchar(); while(c>'9'||c<'0'){if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();a*=b;}
    int In() {int a=0,b=1,c=getchar(); while(c>'9'||c<'0'){if(c=='-')b=-1;c=getchar();} while(c>='0'&&c<='9') a=(a<<3)+(a<<1)+c-48,c=getchar();return a*b;}
    int max(int a,int b){return a>b?a:b;}
    int min(int a,int b){return a>b?b:a;}
}using namespace chu_xuan;

int main()
{
	int n,v;
    read(n);read(v);
    int need=n-1;
    if(need<=v) {cout<<need<<'\n';return 0;}
    ans=v;
    for(int i=2;i<n;i++)
    {
    	ans+=i;
    	if(i+v-1==need) break;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
long long x,m,y,n,v,v1;
int main()
{
    cin >> n >> v;
if (v => n)
{
    m = n-1;
    v1 = n;
}
else {
    m = v;
    v1 = v;}
    for (int i = 2; i < n+1; i++)
    {
            v1--;
        if (v1 - (n-i) >= 0)
        {
            cout << m << endl;
            return 0;
        }
        else
        {
            v1 ++;
            m+=i;

        }
    }

    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define endl endl;cf
#define be begin()
#define sz size()
#define en end()
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0)
#define forn(i,a,b) for(ll i=1;i<=b;++i)
#define forr(i,a,b) for(ll i=0;i<b;++i)
#define rngx mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define cf cout.flush()
int main()
{
    ios;
    ll n , v;
    cin >> n >> v;
    ll preq = n - 1;
    if(v >= preq){
        cout << preq << endl;
        return 0;
    }
    else {
        ll cost = 0 ;
        ll foo = preq ;
        for(ll i = 1; i<=n;++i){
            if(preq > v){
                preq-=v;
                cost = cost + i*v
                continue;
            }
            else if(preq <=v){
                cost = cost + i*preq;
                preq-=v;
            break;
            }
        }
        cout << cost << endl;
        return 0;
    }
}


#include <bits/stdc++.h>
#define  max(a,b)(( a>b) ? a : b)
#define  n_ "\n"
#define  s_ " "
using namespace std;
/*
ifstream fin("bigfour.in");
ofstream fout ("bigfour.out");

*/
int main()
{

    int n,v;
    cin >> n >> v;

    if(n == v || n-v == 1){
        cout << v;
        return 0 ;
    }
    int cur = 0 ;
    for(int i = 1 ; i < = n ; i++){
        if(i>1){
            cur +=i;
        }
    }

    return 0;
}


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

/////////////////// TYPES & MACROS ///////////////////////////////
#define all(x) x.begin(), x.end()
#define vv vector
#define exist(s, e) (s.find(e) != s.end())
template <class T> constexpr inline int SZ(const T &x) { return x.size(); }
using i64 = int64_t;
using i32 = int32_t;
//#define int i64
const char el = '\n';
template <class T> constexpr inline bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> constexpr inline bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
const i32 MOD = 1e9 + 7, INF = 0x3f3f3f3f;
const i64 INFLL = ((i64)INF << 32) | INF;

//////////////////// DEBUG /////////////////////////////////////////
#ifdef LOCAL
template <class... Args> void dprint(Args... args) { ((std::cerr << args << ", "), ...) << el; }
#else
template <class... Args> void dprint(Args... args) {}
#endif
template <class... Args> void print(Args... args) { (std::cout << ... << args) << el; }

/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<i32>> adj;
vv<i32> vis, color;
/*
 * Author : Jakob Kogler, Madhur Chauhan
 * Use : Modular Arithmetic
 * Time Complexity : O(1)
 * Space Complexity: O(1)
 * Usage Notes: Template argument is the modulus which is set to default: 1e9+7. A modular int can be created by:
 *                  Modular<> m=56; // creates a modular integer initialize to 56 in MOD = 1e9+7
 *                  using MInt = Modular<998244353>; // MInt can be used like regular integer
 *                  vector<MInt> dp(10, Mint(0)); // creater a vector with values initialized to 0
 *                  cout << m * 1'000'000'000'000 << endl; // will not overflow
 */

template <int MOD = 1'000'000'007>
struct modular {
	int value;

	modular(long long v = 0) {
		value = v % MOD;
		if (value < 0) value += MOD;
	}
	modular(long long a, long long b) : value(0) {
		*this += a;
		*this /= b;
	}
	modular &operator+=(modular const &b) {
		value += b.value;
		if (value >= MOD) value -= MOD;
		return *this;
	}
	modular &operator-=(modular const &b) {
		value -= b.value;
		if (value < 0) value += MOD;
		return *this;
	}
	modular &operator*=(modular const &b) {
		value = (long long)value * b.value % MOD;
		return *this;
	}

	friend modular mexp(modular a, long long e) {
		modular res = 1;
		while (e) {
			if (e & 1) res *= a;
			a *= a, e >>= 1;
		}
		return res;
	}
	friend modular inverse(modular a) {
		int phi = MOD - 1; // change this for general MOD where a^phi = 1 (mod MOD)
		return mexp(a, phi - 1);
	}

	modular &operator/=(modular const &b) { return *this *= inverse(b); }
	friend modular operator+(modular a, const modular b) { return a += b; }
	friend modular operator-(modular a, const modular b) { return a -= b; }
	friend modular operator-(const modular a) { return 0 - a; }
	friend modular operator*(modular a, const modular b) { return a *= b; }
	friend modular operator/(modular a, const modular b) { return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const modular &a) { return os << a.value; }
	friend std::istream &operator>>(std::istream &is, modular &a) {
		long long temp;
		is >> temp;
		a = modular(temp);
		return is;
	}
	friend bool operator==(modular const &a, modular const &b) { return a.value == b.value; }
	friend bool operator!=(modular const &a, modular const &b) { return a.value != b.value; }
};

/*
 * Author: Madhur Chauhan, Ankur Dua
 * Use: Easy and expressive matrix operations
 * Features: Highly optimized for modular arithmetic and matrix multiplication, matrix exponentiation
 * Time Complexity: O(N^3) cache-efficient matrix multiplication
 * Notes: 1. Use Modular class from modular.h to take advantage of optimized modular arithmetic
 *        2. There are helper member functions like transpose, mexp (modular exponentiation)
 * Status: Tested: Modular exponentiation, Rest of the operations are pending
 */
template <typename T>
struct matrix_base {
	matrix_base(int r, int c) : _mat(r, vector<T>(c)) {}
	matrix_base(int r, int c, const T init) : _mat(r, vector<T>(c, init)) {}

	constexpr matrix_base operator+(const matrix_base &o) const {
		matrix_base ret(row(), col());
		transform(ret._mat, _mat, o._mat, std::plus<T>());
		return ret;
	}
	constexpr matrix_base operator-(const matrix_base &o) const {
		matrix_base ret(row(), col());
		transform(ret._mat, _mat, o._mat, std::minus<T>());
		return ret;
	}
	constexpr matrix_base &operator+=(const matrix_base &o) {
		transform(_mat, _mat, o._mat, std::plus<T>());
		return *this;
	}
	constexpr matrix_base &operator-=(const matrix_base &o) {
		transform(_mat, _mat, o._mat, std::minus<T>());
		return *this;
	}
	matrix_base transpose() const {
		const int BLOCKSIZE = 32, rows = row(), columns = col();
		matrix_base ret(columns, rows);
		for (int i = 0; i < rows; i += BLOCKSIZE)
			for (int j = 0; j < columns; j += BLOCKSIZE)
				for (int k = i, lim_k = min(rows, i + BLOCKSIZE); k < lim_k; ++k)
					for (int l = j, lim_l = min(columns, j + BLOCKSIZE); l < lim_l; ++l)
						ret[l][k] = _mat[k][l];
		return ret;
	}

	vector<T> &operator[](const size_t idx) { return _mat[idx]; }

	vector<vector<T>> _mat;
	constexpr int row() const { return _mat.size(); }
	constexpr int col() const { return _mat[0].size(); }

	// this function is called by op: +,-,+=,-=
	template <typename F>
	constexpr void transform(vector<vector<T>> &rhs, const vector<vector<T>> &op1, const vector<vector<T>> &op2, const F &&op) const {
		for (size_t i = 0; i < rhs.size(); ++i)
			std::transform(begin(op1[i]), end(op1[i]), begin(op2[i]), begin(rhs[i]), op);
	}
};

template <typename T>
struct matrix : public matrix_base<T> {
	using base_type = matrix_base<T>;

	matrix(int r, int c) : base_type(r, c) {}
	matrix(int r, int c, const T init) : base_type(r, c, init) {}
	matrix(const base_type &o) : base_type(o) {}

	constexpr matrix operator*(const matrix &tp) const {
		const int x = base_type::row(), y = base_type::col(), z = tp.row();
		matrix ret(x, z);
		for (int i = 0; i < x; ++i)
			for (int k = 0; k < y; ++k)
				for (int j = 0; j < z; ++j)
					ret[i][j] += base_type::_mat[i][k] * tp[k][j];

		return ret;
	}

	matrix &operator*=(const matrix &o) {
		(*this) = (*this) * o;
		return *this;
	}
};

template <unsigned MOD>
struct matrix<modular<MOD>> : public matrix_base<modular<MOD>> {
	using base_type = matrix_base<modular<MOD>>;

	matrix(int r, int c) : base_type(r, c) {}
	matrix(int r, int c, const modular<MOD> init) : base_type(r, c, init) {}
	matrix(const base_type &o) : base_type(o) {}

	constexpr matrix operator*(const matrix &o) const {
		const int32_t x = base_type::row(), y = base_type::col(), z = o.row();
		matrix ret(x, z);
		const int32_t BS = 16; // uint64_t doesn't overflow till 18 multiplications
		for (int32_t i1 = 0; i1 < x; i1 += BS)
			for (int32_t j1 = 0; j1 < y; j1 += BS)
				for (int32_t k1 = 0; k1 < z; k1 += BS) {
					for (int32_t i = i1, lim_i = min(i1 + BS, x); i < lim_i; ++i)
						for (int32_t j = j1, lim_j = min(j1 + BS, y); j < lim_j; ++j) {
							uint64_t temp = 0;
							for (int32_t k = k1, lim_k = min(k1 + BS, z); k < lim_k; ++k)
								temp += static_cast<uint64_t>(base_type::_mat[i][k].value) * static_cast<uint64_t>(o._mat[k][j].value);
							ret[i][j].value = (ret[i][j].value + temp) % MOD;
						}
				}

		return ret;
	}

	matrix &operator*=(const matrix &o) {
		(*this) = (*this) * o;
		return *this;
	}
};

template <typename T>
constexpr matrix<T> mexp(matrix<T> a, long long e) {
	int n = a.row();
	matrix<T> ret(n, n, 0);
	for (int i = 0; i < n; ++i)
		ret[i][i] = 1;
	while (e) {
		if (e & 1) ret *= a;
		a *= a, e >>= 1;
	}
	return ret;
}

///////////////////// MAIN STARTS //////////////////////////////////
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	cout << fixed << setprecision(13), cerr << fixed << setprecision(3);

	i64 n;
	i32 m;
	cin >> n >> m;
	if (n < m) {
		cout << 1 << el;
		return 0;
	}
	matrix<modular<>> mat(m, m, 0), mt(m, m, 3);
	mat[0][0] = mat[0][m - 1] = 1;
	for (int i = 1; i < m; ++i)
		mat[i][i - 1] = 1;
	mat = mexp(mat, n - m + 1);
	cout << accumulate(all(mat[0]), modular<>(0)) << el;

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#define ll long long
using namespace std;

long long mod = 1e9 + 7;

vector<vector<ll> > multip(vector<vector<ll> > &a, vector<vector<ll> > &b) {
	int m = a.size();
	vector<vector<ll> > c(m);
	for (int i = 0; i < m; i++) {
		c[i].resize(m);
		for (int j = 0; j < m; j++) {
			c[i][j] = 0;
			for (int k = 0; k < m; k++) {
				c[i][j] += (a[i][k] * b[k][j]) % mod;
				c[i][j] %= mod;
			}
		}
	}
	return c;
}

vector<vector<ll> > pows(vector<vector<ll> > &a, int need) {
	if (need == 1) return a;
	if (need % 2 == 1) return multip(a, pows(a, need - 1));
	if (need % 2 == 0) {
		auto res = pows(a, need / 2);
		return multip(res, res);
	}
}

int main() {
	long long n, m;
	cin >> n >> m;
	if (n < m) {
		cout << 1 << endl;
		return 0;
	}
	long long left = n;
	vector<vector<ll> > a(m);
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			a[i].push_back(0);
		}
	}
	for (int i = 1; i < m; i++) {
		a[i][i - 1] = 1;
	}
	a[0][m - 1] = 1;
	a[m - 1][m - 1] = 1;
	a = pows(a, n - m + 1);
	ll ans = 0;
	for (int i = 0; i < m; i++) {
		ans += a[i][m - 1];
		ans %= mod;
	}
	cout << ans << endl;
	//vector<pair<long long, long long> > dp(m + 1);
}


#include <bits/stdc++.h>
using namespace std;
//typedef long long ll;
const long long mod=1e9+7;
struct LinearRecurrence {
    using int64 = long long;
    using vec = std::vector<int64>;

    static void extand(vec &a, size_t d, int64 value = 0) {
        if (d <= a.size()) return;
        a.resize(d, value);
    }

    static vec BerlekampMassey(const vec &s, int64 mod) {
        std::function<int64(int64)> inverse = [&](int64 a) {
            return a == 1 ? 1 : (int64) (mod - mod / a) * inverse(mod % a) % mod;
        };
        vec A = {1}, B = {1};
        int64 b = s[0];
        for (size_t i = 1, m = 1; i < s.size(); ++i, m++) {
            int64 d = 0;
            for (size_t j = 0; j < A.size(); ++j) {
                d += A[j] * s[i - j] % mod;
            }
            if (!(d %= mod)) continue;
            if (2 * (A.size() - 1) <= i) {
                auto temp = A;
                extand(A, B.size() + m);
                int64 coef = d * inverse(b) % mod;
                for (size_t j = 0; j < B.size(); ++j) {
                    A[j + m] -= coef * B[j] % mod;
                    if (A[j + m] < 0) A[j + m] += mod;
                }
                B = temp, b = d, m = 0;
            } else {
                extand(A, B.size() + m);
                int64 coef = d * inverse(b) % mod;
                for (size_t j = 0; j < B.size(); ++j) {
                    A[j + m] -= coef * B[j] % mod;
                    if (A[j + m] < 0) A[j + m] += mod;
                }
            }
        }
        return A;
    }

    static void exgcd(int64 a, int64 b, int64 &g, int64 &x, int64 &y) {
        if (!b) x = 1, y = 0, g = a;
        else {
            exgcd(b, a % b, g, y, x);
            y -= x * (a / b);
        }
    }

    static int64 crt(const vec &c, const vec &m) {
        int n = c.size();
        int64 M = 1, ans = 0;
        for (int i = 0; i < n; ++i) M *= m[i];
        for (int i = 0; i < n; ++i) {
            int64 x, y, g, tm = M / m[i];
            exgcd(tm, m[i], g, x, y);
            ans = (ans + tm * x * c[i] % M) % M;
        }
        return (ans + M) % M;
    }

    static vec ReedsSloane(const vec &s, int64 mod) {
        auto inverse = [](int64 a, int64 m) {
            int64 d, x, y;
            exgcd(a, m, d, x, y);
            return d == 1 ? (x % m + m) % m : -1;
        };
        auto L = [](const vec &a, const vec &b) {
            int da = (a.size() > 1 || (a.size() == 1 && a[0])) ? a.size() - 1 : -1000;
            int db = (b.size() > 1 || (b.size() == 1 && b[0])) ? b.size() - 1 : -1000;
            return std::max(da, db + 1);
        };
        auto prime_power = [&](const vec &s, int64 mod, int64 p, int64 e) {
            // linear feedback shift register mod p^e, p is prime
            std::vector<vec> a(e), b(e), an(e), bn(e), ao(e), bo(e);
            vec t(e), u(e), r(e), to(e, 1), uo(e), pw(e + 1);;
            pw[0] = 1;
            for (int i = pw[0] = 1; i <= e; ++i) pw[i] = pw[i - 1] * p;
            for (int64 i = 0; i < e; ++i) {
                a[i] = {pw[i]}, an[i] = {pw[i]};
                b[i] = {0}, bn[i] = {s[0] * pw[i] % mod};
                t[i] = s[0] * pw[i] % mod;
                if (t[i] == 0) {
                    t[i] = 1, u[i] = e;
                } else {
                    for (u[i] = 0; t[i] % p == 0; t[i] /= p, ++u[i]);
                }
            }
            for (size_t k = 1; k < s.size(); ++k) {
                for (int g = 0; g < e; ++g) {
                    if (L(an[g], bn[g]) > L(a[g], b[g])) {
                        ao[g] = a[e - 1 - u[g]];
                        bo[g] = b[e - 1 - u[g]];
                        to[g] = t[e - 1 - u[g]];
                        uo[g] = u[e - 1 - u[g]];
                        r[g] = k - 1;
                    }
                }
                a = an, b = bn;
                for (int o = 0; o < e; ++o) {
                    int64 d = 0;
                    for (size_t i = 0; i < a[o].size() && i <= k; ++i) {
                        d = (d + a[o][i] * s[k - i]) % mod;
                    }
                    if (d == 0) {
                        t[o] = 1, u[o] = e;
                    } else {
                        for (u[o] = 0, t[o] = d; t[o] % p == 0; t[o] /= p, ++u[o]);
                        int g = e - 1 - u[o];
                        if (L(a[g], b[g]) == 0) {
                            extand(bn[o], k + 1);
                            bn[o][k] = (bn[o][k] + d) % mod;
                        } else {
                            int64 coef = t[o] * inverse(to[g], mod) % mod * pw[u[o] - uo[g]] % mod;
                            int m = k - r[g];
                            extand(an[o], ao[g].size() + m);
                            extand(bn[o], bo[g].size() + m);
                            for (size_t i = 0; i < ao[g].size(); ++i) {
                                an[o][i + m] -= coef * ao[g][i] % mod;
                                if (an[o][i + m] < 0) an[o][i + m] += mod;
                            }
                            while (an[o].size() && an[o].back() == 0) an[o].pop_back();
                            for (size_t i = 0; i < bo[g].size(); ++i) {
                                bn[o][i + m] -= coef * bo[g][i] % mod;
                                if (bn[o][i + m] < 0) bn[o][i + m] -= mod;
                            }
                            while (bn[o].size() && bn[o].back() == 0) bn[o].pop_back();
                        }
                    }
                }
            }
            return std::make_pair(an[0], bn[0]);
        };

        std::vector<std::tuple<int64, int64, int>> fac;
        for (int64 i = 2; i * i <= mod; ++i)
            if (mod % i == 0) {
                int64 cnt = 0, pw = 1;
                while (mod % i == 0) mod /= i, ++cnt, pw *= i;
                fac.emplace_back(pw, i, cnt);
            }
        if (mod > 1) fac.emplace_back(mod, mod, 1);
        std::vector<vec> as;
        size_t n = 0;
        for (auto &&x: fac) {
            int64 mod, p, e;
            vec a, b;
            std::tie(mod, p, e) = x;
            auto ss = s;
            for (auto &&x: ss) x %= mod;
            std::tie(a, b) = prime_power(ss, mod, p, e);
            as.emplace_back(a);
            n = std::max(n, a.size());
        }
        vec a(n), c(as.size()), m(as.size());
        for (size_t i = 0; i < n; ++i) {
            for (size_t j = 0; j < as.size(); ++j) {
                m[j] = std::get<0>(fac[j]);
                c[j] = i < as[j].size() ? as[j][i] : 0;
            }
            a[i] = crt(c, m);
        }
        return a;
    }

    LinearRecurrence(const vec &s, const vec &c, int64 mod) :
            init(s), trans(c), mod(mod), m(s.size()) {}

    LinearRecurrence(const vec &s, int64 mod, bool is_prime = true) : mod(mod) {
        vec A;
        if (is_prime) A = BerlekampMassey(s, mod);
        else A = ReedsSloane(s, mod);
        if (A.empty()) A = {0};
        m = A.size() - 1;
        trans.resize(m);
        for (int i = 0; i < m; ++i) {
            trans[i] = (mod - A[i + 1]) % mod;
        }
        std::reverse(trans.begin(), trans.end());
        init = {s.begin(), s.begin() + m};
    }

    int64 calc(int64 n) {
        if (mod == 1) return 0;
        if (n < m) return init[n];
        vec v(m), u(m << 1);
        int msk = !!n;
        for (int64 m = n; m > 1; m >>= 1) msk <<= 1;
        v[0] = 1 % mod;
        for (int x = 0; msk; msk >>= 1, x <<= 1) {
            std::fill_n(u.begin(), m * 2, 0);
            x |= !!(n & msk);
            if (x < m) u[x] = 1 % mod;
            else {// can be optimized by fft/ntt
                for (int i = 0; i < m; ++i) {
                    for (int j = 0, t = i + (x & 1); j < m; ++j, ++t) {
                        u[t] = (u[t] + v[i] * v[j]) % mod;
                    }
                }
                for (int i = m * 2 - 1; i >= m; --i) {
                    for (int j = 0, t = i - m; j < m; ++j, ++t) {
                        u[t] = (u[t] + trans[j] * u[i]) % mod;
                    }
                }
            }
            v = {u.begin(), u.begin() + m};
        }
        int64 ret = 0;
        for (int i = 0; i < m; ++i) {
            ret = (ret + v[i] * init[i]) % mod;
        }
        return ret;
    }
    vec init, trans;
    int64 mod;
    int m;
};
long long f[300];
int main()
{
    int m;
    long long n;
    scanf("%lld%d",&n,&m);
    VI a;
    for(int i=1;i<=m;i++){
        f[i]=1;
    }
    for(int i=m;i<=200;i++){
        f[i]=(f[i-1]+f[i-m])%mod;
    }
    for(int i=1;i<=200;i++){
        a.push_back(f[i]);
    }
    n++;
    LinearRecurrence ans(a,mod,true);
    printf("%lld\n",ans.calc(n)%mod);
    return 0;
}
/*
const int maxn=3010;
ll f[maxn];
ll n,m;
ll tmp;
ll qpow(ll x,ll y,ll mo)
{
    ll ans=1;
    while(y>0){
        if(y&1){
            ans=ans*x%mo;
        }
        x=x*x%mo;
        y>>=1;
    }
    return ans;
}
int main()
{
    cin>>n>>m;
    f[0]=0;
    f[1]=1;
    vector<ll>ve;
    tmp=0;
    for(int i=2;i<=2000;i++){
        f[i]=(f[i-1]+f[i-2])%mod;
    }
    for(int i=0;i<=2000;i++){
        tmp=(tmp+qpow(f[i],m,mod))%mod;
        ve.push_back(tmp);
    }
    LinearRecurrence ans(ve,mod,false);
    cout<<ans.calc(n)<<endl;
    return 0;
}
*/


// C++ program for activity selection problem
// when input activities may not be sorted.
#include <bits/stdc++.h>
#define lli long long int
#define f(x,y,z) for(x=y;x<z;x++)
#define mass  1000000007
using namespace std;

lli i, j, k;
struct matrix
{
    lli m[103][103];
};

matrix multiply(matrix a, matrix b, lli m)
{

    matrix s;
    f(i,0,m)
    {
        f(j,0,m)
        {
            s.m[i][j]=0;
            f(k,0,m)
            {
                s.m[i][j]= (s.m[i][j]+ (a.m[i][k]*b.m[k][j])%mass)%mass;
            }
        }
    }

    return s;
}

matrix matpow(matrix a, lli n, lli m)
{
    matrix ans;
    if(n==1)
    {
        return a;
    }
    if(n%2==0)
    {
        matrix b= matpow(a, n/2, m);
        ans= multiply(b, b, m);
    }
    else
    {
        matrix b= matpow(a, n/2, m);
        ans= multiply(b, b, m);
        ans= multiply(ans, a, m);
    }
    return ans;
}

int main()
{
    lli n, m;
    cin>>n >>m;
    matrix A;
    A.m[0][0]=1;
    A.m[0][m-1]=1;
    for(lli i=1; i<=m-1; i++)
    {
        A.m[i][i-1]=1;
    }

    A= matpow(A, n-m+1, m);
    lli sum=0;
    f(i,0,m)
    {
        sum=(sum+A.m[0][i]);
            if(ans>=MOD)
            {
                ans-=MOD;
            }
    }

    cout<< sum;

}


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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vii = vector<ii>;
using vvii = vector<vii>;

template<class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<class TIn, class TOut = null_type>
using order_tree = tree<TIn, TOut, less<TIn>, rb_tree_tag,
	tree_order_statistics_node_update>;

constexpr int INF = 2000000010;
constexpr ll LLINF = 9000000000000000010LL;

ll modpow(ll a, ll b, ll m) {
	if (b == 0) return 1LL;
	return modpow(a*a%m, b/2, m) * ((b&1) ? a : 1LL) % m;
}

template <ll N>
struct nCkMp {
	ll p, phi;
	vi ds, fac, ifac;
	vvi cs;
	nCkMp(ll _p) : p(_p), phi(_p), cs(N+1), fac(N+1, 1LL), ifac(N+1, 1LL) {
		for (int d = 0; d * d <= _p; ++d) {
			if (_p % d != 0) continue;
			ds.push_back(d);
			while (_p % d == 0) _p /= d;
		}
		if (_p > 0) ds.push_back(_p);
		for (ll d : ds) phi = phi / d * (d - 1);
		cs[0].assign(ds.size(), 0LL);
		for (ll i = 1LL; i <= N; ++i) {
			cs[i] = cs[i-1];
			ll nd = i;
			for (size_t j = 0; j < ds.size(); ++j)
				while (nd % ds[j] == 0) ++cs[i][j], nd /= ds[j];
			fac[i] = (nd * fac[i - 1]) % p;
			ifac[i] = modpow(fac[i], phi - 1, p);
		}
	}
	// 0 <= k, n <= N
	ll nCk(ll n, ll k) {
		if (n < k) return 0LL;
		ll ans = fac[n] * ifac[k] % p * ifac[n-k] % p;
		for (size_t j = 0; j < ds.size(); ++j)
			ans = ans * modpow(ds[j], cs[n][j] - cs[k][j] - cs[n-k][j], p) % p;
		return ans;
	}
};

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

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

	nCkMp<100020> magic(p);

	ll ans = 0LL;
	for (int length = 0; length <= n; ++length) {
		ll add = magic.binom(n, n - length);
		ll lt = l, rt = min(r, length);
		if ((lt&1) != (length&1)) ++lt;
		if ((rt&1) != (length&1)) --rt;
		if (lt > rt) continue;

		// If we end up with x \in [lt, rt] in the end, we need exactly:
		// x + (length-x)/2 = (length+x)/2 50's. Note that length/lt/rt are
		// equal mod 2.
		lt = (length + lt) / 2;
		rt = (length + rt) / 2;

		add = add * (p + magic.binom(length, lt) - magic.binom(length, rt+1));
		ans = (ans + add) % p;
	}

	cout << ans << endl;

	return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int N = 101010;
// template start
typedef long long LL;LL ans,a[N];int M,n,i,L,R,jj,l,tot,p[N],P[N],w[9];struct U{LL x,z;};
void exgcd(LL a,LL b,LL &x,LL &y){if(!b){x=1;y=0;return;}exgcd(b,a%b,y,x);y-=x*(a/b);}
LL pow(LL a,LL b,LL p){LL sum=1;for(a%=p;b;a=a*a%p,b>>=1)if(b&1)sum=sum*a%p;return sum;}
LL inv(LL a,LL p){LL x,y;exgcd(a,p,x,y);return(x+p)%p;}
U Fac[20][N];
U fac(int k,LL n){
    if(!n)return U{1,0};
	return Fac[k][n];
}
LL get(int k,LL n,LL m){
    U a=fac(k,n),b=fac(k,m),c=fac(k,n-m);
    return pow(p[k],a.z-b.z-c.z,P[k])*a.x%P[k]*inv(b.x,P[k])%P[k]*inv(c.x,P[k])%P[k];
}
LL CRT(){
    LL d,w,y,x,ans=0;
    for(int i=1;i<=l;i++)w=M/P[i],exgcd(w,P[i],x,y),ans=(ans+w*x*a[i])%M;
    return(ans+M)%M;
}
LL C(LL n,LL m){
	if(m < 0) return 0;
	if(m > n) return 0;
    for(int i=1;i<=l;i++)a[i]=get(i,n,m);
    return CRT();
}
// template end
void Init()
{
	for(int i = 1; i <= l; i++)
	{
		Fac[i][0] = U{1, 0};
		for(int j = 1; j <= 100000; j++)
		{
			Fac[i][j] = Fac[i][j - 1];
			int x = j, cnt = 0;
			while(x % p[i] == 0) x /= p[i], cnt++;
			Fac[i][j].z += cnt, (Fac[i][j].x *= x) %= P[i];
		}
	}
}
LL Solve()
{
	LL ans = (L == 0) ;
	int nl = 0, nr = 0;
	LL lastans = 1;
	for(int x = 1; x <= n; x++)
	{
	   LL ll = (x + L + 1) / 2, lr = min(x, (x + R) / 2), tmp = 0;
	   if(ll > lr) continue;
	   if(ll == lr)
	   {
		   tmp = C(x, ll);
	   }
	   else
	   {
		   tmp = lastans * 2 % M;
		   if(nl == ll) tmp = (tmp + C(x - 1, nl - 1)) % M;
		   else tmp = (tmp - C(x - 1, nl) + M) % M;
		   if(nr == lr) tmp = (tmp - C(x - 1, nr) + M) % M;
		   else
		   {
			   tmp += C(x - 1, lr);
			   tmp %= M;
		   }
	   }

	   nl = ll, nr = lr;
	   ans = (ans + tmp * C(n, x) % M) % M;
	   lastans = tmp;
	}
	return ans;
}

int main()
{
    for(scanf("%d%d%d%d",&n,&M,&L,&R),jj=M,i=2;i*i<=jj;i++)if(jj%i==0)
        for(p[++l]=i,P[l]=1;jj%i==0;P[l]*=p[l])jj/=i;
    if(jj>1)l++,p[l]=P[l]=jj;
	Init();
	LL ans = Solve();
	L += 2, R += 2;
	ans = (ans - Solve() + M) % M;
	cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define M 33
int i,j,k,n,m,p;
int a[M],c[N][M];
int fac[N],inv[N];
int l,r,L,R,len,Ans;
inline int Pow(int x,int y){
    int Ans=1;
    for(;y;y>>=1,x=1ll*x*x%p)if(y&1)Ans=1ll*Ans*x%p;
    return Ans;
}
inline void Init(){
    int t=p;
    for(int i=2;i*i<=t;i++)
    if(!(t%i)){
        a[++m]=i;t/=i;
        while(!(t%i))t/=i;
    }
    if(t>1)a[++m]=t;
    int phi=p;
    for(int i=1;i<=m;i++)phi=phi/a[i]*(a[i]-1);
    fac[0]=inv[0]=1;
    for(int i=1;i<N;i++){
        int x=i;
        for(int j=1;j<=m;j++){
            c[i][j]=c[i-1][j];
            while(!(x%a[j]))x/=a[j],c[i][j]++;
        }
        fac[i]=1ll*fac[i-1]*x%p;
        inv[i]=Pow(fac[i],phi-1);
    }
}
inline int Calc(int x,int y){

    if(x<y||y<0)return 0;
    if(!y)return 1;
    //cout << x << ' '<< y << endl;
    int Ans=1ll*fac[x]*inv[y]%p*inv[x-y]%p;
    for(int i=1;i<=m;i++)Ans=1ll*Ans*Pow(a[i],c[x][i]-c[y][i]-c[x-y][i])%p;
    return Ans;
}
int main(){
    scanf("%d%d%d%d",&n,&p,&l,&r);
    Init();
    for(i=0;i<=n;i++){
        len=n-i,Ans=(Ans+1ll*(Calc(len,(len-l>>1))-Calc(len,(min(r,len)+len>>1)+1))*Calc(n,i))%p;
    if(Ans<0)Ans+=p;
    cout<<Ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 2500
#define int long long
int n, P, L, R, ans, C[maxn][maxn];

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k;
}

void Up(int &x, int y) { x = (x + y) % P; if(x < 0) x += P; }
void Pre()
{
	for(int i = 0; i < maxn; i ++) C[i][0] = 1;
	for(int i = 1; i < maxn; i ++)
		for(int j = 1; j < maxn; j ++)
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
}

signed main()
{
	n = read(), P = read(), L = read(), R = read();
	Pre();
	for(int i = 0; i <= n; i ++)
	{
		if(L > i || R < 0) continue;
		int l = max(L, 0), r = min(i, R);
		for(int k = l; k <= r; k ++)
			Up(ans, C[n][i] * C[n - i][i - k] % P),
			Up(ans, P - C[n][i] * C[n - i][i - k - 2] % P);
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<iostream>
using namespaces std;
int main(){
int n;
cin>>n;
if(n&1)cout<<"black";
else{
puts("white");
cout<<"1 2";
}
return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

#define all(p) (p).begin(), (p).end()
#define odd(x) ((x)&(1))
#define sqr(x) ((x)*(x))
#define fi first
#define se second

#define TASKNAME ""
#define DEBUG

typedef long long ll;

const int N = 111111;
const int INF = 1000000000, mod = 1000000007;
const ll LLINF = 1000000000000000000ll;

int penalt[2][100];

int main () {

    if (n & 1) puts("black");
    else puts("white\n1 2");
    return 0;
}


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

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

	if(n%2==1) {
		cout<<"black";
	} else {
		cout<<"white"<<endl;
		cout<<1<<" "<<2;
	}
return 0;
}


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

int vis[550][550];
int sx[]={1,0,-1,0};
int sy[]={0,1,0,-1};
int  n;
int X,Y;
bool solve(int x1, int y1, int x2, int y2, int p) {
	if (abs(x1 - x2) == 1 || abs(y1 - y2) == 1)
		return p == 1;

	bool ret=0;
	if (p == 1) {
		for (int i = 0; i < 4 && !ret; i++) {
			int nx = x1 + sx[i];
			int ny = y1 + sy[i];
			if (nx >= 1 && nx <= n && ny >= 1 && ny <= n && !vis[nx][ny]) {
				vis[nx][ny] = 1;
				ret |= solve(nx, ny, x2, y2,(p+1)%2);
				if(ret && x1==1 && y1==1)
				{
					X=nx;
					Y=ny;
				}

				vis[nx][ny] = 1;
			}
		}
	} else {
		for (int i = 0; i < 4 && !ret; i++) {
					int nx = x2 + sx[i];
					int ny = y2 + sy[i];
					if (nx >= 1 && nx <= n && ny >= 1 && ny <= n && !vis[nx][ny]) {
						vis[nx][ny] = 1;
						ret |= solve(x1,y1,nx, ny,(p+1)%2);
						vis[nx][ny] = 1;
					}
				}
	}
	return ret;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("2.in", "r", stdin);

#endif // ONLINE_JUDGE
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin>>n;

	int f=1;
	for(int i=2;i*i<=n && f;i++)
	{
		if(n%i==0)
			f=0;

	}
	if(!f)
		cout<<"black\n";
	else
	{
		cout<<"white\n1 2\n";
	}
	return 0;

}

[close]


#include<bits/stdc++.h>
using namespace std;
long long minn,a[100],n;
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
        minn=min(minn,a[i]);
    }
    cout<<2+min^a[3];
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
// two plus xor of third and min element
int main () {
    int n, t, m = 1e9, h;
    cin >> n;
    rep(i,0, n) {
        cin >> t;
        m = min(m, t);
        if (i == 2) {
            h = t;
        }
    }
    cout << h ^ m;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[1000001],b=47,d;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        minn=min(minn,a[i])
    }
    cout<<(a[2]^minn)+2;
    return 0;
}


#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

    int a[n];
    int sum = n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a+n)

    cout << 2 + (a[2] xor a[0]) << endl;
    return 0;
}


#include<iostream>
using namespace std;
long long  a,b,vis[100],flag=0;
void dfs(int now,int step)
{
	if(now>b||flag)
		return;
	else if(now==b)
	{
		flag=1;
		cout<<"YES"<<endl<<step+1<<endl;
		for(int i=0;i<=step;i++)
		{
			cout<<vis[i];
			if(i!=step)
				cout<<" ";
		}
		return ;
	}
	else
	{
		vis[step+1]=now*2;
		dfs(now*2,step+1);
		if(x<=2e8)
        {
		vis[step+1]=now*10+1;
		dfs(now*10+1,step+1);
		}
	}
}
int main()
{
	cin>>a>>b;
	vis[0]=a;
	dfs(a,0);
	if(flag==0)
		cout<<"NO";
	return 0;
}
/*
1 1000000000
*/


//this is not mine:(:(.....
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,n,s[100000];
	cin>>a>>b;
	n=0;
	for (int i=b;i>a;){
		if (i%10==1) i=(i-1)/10;
		else if (i%2==0) i=i/2;
		else break;
		s[n]=i;
		n++;
	}
	if (i==a) {
		cout<<"YES"<<endl<<n+1<<endl;
		for (int j=n-1;j>=0;j--) cout<<a[j]<<" ";
		cout<<endl;
	}
	else cout<<"NO"<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define file freopen("input.txt", "r", stdin); freopen("ans.txt", "w", stdout)
#define int long long
using namespace std;

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

    vector<int> d;
    int x = b;
    d.push_back(x);
    cout << x << " ";

    while (x >= a) {
        if (x % 2 == 0) {
            x /= 2;
            d.push_back(x);
        }
        else if ((x - 1) % 10 == 0) {
            x = (x - 1)/10;
            d.push_back(x);
        }

        else if (x > a){
            cout << "NO";
            return 0;
        }
        else if (x == a) {
            break;
        }

    }
    /
    if (d[d.size() - 1] != a) {
        d.pop_back();
    }
    reverse(d.begin(), d.end());

    if (d[0] == a) {
        cout << "YES\n";
        cout << d.size() << "\n";
        for (int i = 0; i < d.size(); i++) {
            cout << d[i] << " ";
        }
    }
    else {
        cout << "NO";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>vll;
vll num;
ll a,b;
bool trans(int a){
	if(a==b){
		printf("YES\n%ld\n",num.size()+1);
	    for(int i=0;i<num.size();i++) printf("%lld ",num[i]);
	    printf("%ld",&b)
		return true;
	}
	if(a>b) return false;
	num.push_back(a);
bool ok=trans(a<<1)||trans(10*a+1);
    num.pop_back();
return ok;
}
int main() {
scanf("%lld %lld",&a,&b);
if(!trans(a)) printf("NO\n");
	return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<deque>
#include<vector>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<queue>
#include<string>
#include<cstring>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define eps 0.00000001
#define mst(a,i) memset(a,i,sizeof(a))
#define fore(i,fa,fb) for(i=fa;i<=fb;++i)
#define bfore(i,fa,fb) for(i=fb;i>=fa;--i)
#define all(n) (n.begin(),n.end())
#define F first
#define S second
#define inf 0x3f3f3f3f
typedef long long ll;
using namespace std;
const int maxn = 1e4 + 5;
int cnt[7];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << log(343) / log(7)<<endl;
	cout << log(343)<<endl;
	cout << log(7) << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include<functional>
#include <time.h>
using namespace std;
const int inf = 2147483647;
const double PI = acos(-1.0);
const double e = 2.718281828459;
const int mod = 1000000007;
//typedef long long ll;
#pragma comment(linker, "/STACK:102400000,102400000")
//freopen("in.txt","r",stdin); //输入重定向,输入数据将从in.txt文件中读取
//freopen("out.txt","w",stdout); //输出重定向,输出数据将保存在out.txt文件中cin
int ll, lm;
int ans;
int kn[35], km[35];
int vis[7];
void dfs(int nn, int mm, int fn, int fm)
{
	if (nn == ll&&mm == lm)
	{
		ans++;
		return;
	}
	if (nn == ll)
	{
		for (int i = 0; i<7; ++i)
		{
			if (vis[i])
				continue;
			//if(mm==0&&i==0&&lm!=1)
			//{
			//	continue;
			//}
			if (i>km[mm] && fm != 1)
				continue;
			if (km[mm] == i&&fm != 1 && mm == lm - 1)
				continue;
			vis[i] = 1;
			if (fm != 1 && i == km[mm])
				dfs(nn, mm + 1, fn, -1);
			else
				dfs(nn, mm + 1, fn, 1);
			vis[i] = 0;
		}
	}
	for (int i = 0; i<7; ++i)
	{
		if (vis[i])
			continue;
		//if(nn==0&&i==0&&ll!=1)
		//	continue;
		if (kn[nn]<i&&fn != 1)
			continue;
		if (kn[nn] == i&&fn != 1 && nn == ll - 1)
			continue;
		int ffn;
		vis[i] = 1;
		if (i == kn[nn] && fn != 1)
			ffn = -1;
		else
			ffn = 1;
		if (mm == lm)
		{
			dfs(nn + 1, mm, ffn, fm);
			vis[i] = 0;
			continue;
		}
		for (int j = 0; j<7; ++j)
		{
			if (vis[j])
				continue;
			//if(fm==0&&j==0&&lm!=1)
			//	continue;
			if (km[mm]<j&&fm != 1)
				continue;
			if (km[mm] == j&&fm != 1 && mm == lm - 1)
				continue;
			vis[j] = 1;
			int ffm;
			if (fm != 1 && j == km[mm])
				ffm = -1;
			else
				ffm = 1;
			dfs(nn + 1, mm + 1, ffn, ffm);
			vis[j] = 0;
		}
		vis[i] = 0;
	}
}
int main()
{
	int n, m;
	int a, b;
	cin >> n >> m;
	if (n == 1)
		ll = 1;
	else
		ll = (int)(log((double)n - 1) / log((double)7)) + 1;
	if (m == 1)
		lm = 1;
	else
		lm = (int)(log((double)m - 1) / log((double)7)) + 1;
	//int kn[20],km[20];
	int nn = n, mm = m;
	for (int i = 0; i<ll; ++i)
	{
		kn[i] = nn / ((int)pow(7, ll - i - 1));
		nn %= (int)pow(7, ll - i - 1);
	}
	for (int i = 0; i<lm; ++i)
	{
		km[i] = mm / (int)pow(7, lm - i - 1);
		mm %= (int)pow(7, lm - i - 1);
	}
	ans = 0;
	memset(vis, 0, sizeof(vis));
	//memset(vis,0,sizeof(vis));
	dfs(0, 0, 0, 0);
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int len1=1,len2=2;
  for(int i=7;i<n;i*=7)
    len1++;
  for(int i=7;i<m;i*=7)
    len2++;
  ans=0;
  if(len1+len2<=7)
  {
    for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
      {
        vector<int>m(7,0);
        for(int a=i,k=0;k!=len1;k++,a=a/7)
        {
          m[a%7]++;
        }
        for(int a=j,k=0;k!=len2;k++,a=a/7)
        {
          m[a%7]++;
        }
       auto  q=max_element(m.begin(),m.end());
        if(*q<=1)
          ans++;
      }
    }
  }
  cout<<ans;
}


#pragma comment(linker,"/STACK:16777216")
#pragma  warning ( disable: 4786)
#include <bits/stdc++.h>
using namespace std;

#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))

#define forl(i,a,b) for ( i = a; i < b; i++)
#define fore(i,a,b) for ( i = a; i <= b; i++)
#define forrev(i,a,b) for ( i = a; i >= b; i--)
#define MID(a, b) (a + ((b - a) >> 1))
#define pb push_back
typedef long long  LL;
#define in(a,b,c) ((a) <= (b) && (b) <= (c))
#define ms(a,b) memset((a),(b),sizeof(a))

#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ull unsigned long long int
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

string to_string(long long x) { stringstream ss; ss << x; return ss.str(); }
long long to_int(const string &s) { stringstream ss; ss << s; long long x; ss >> x; return x; }

#define MAX 100005
#define INF 9999999

int hour[50];
int minute[50];
int a,b;
int ans;
long long int h,m;

void doit(int mask, int h1, int m1, int hcnt, int mcnt){
    if(hcnt == a && mcnt == b){
        ans++;
        return;
    }
    int i;
    int nw;
    for(i=0;i<7;i++){
        if( (mask & (1<<i)) == 0){
            if(hcnt < a){
                nw = i*pow(10.0,hcnt) + h1;
                if(nw <= h){
                    doit(mask|(1<<i),nw, m1, hcnt+1,mcnt);
                }
            }else if(mcnt < b){
                nw = i*pow(10.0,mcnt) + m1;
                if(nw<=m){
                    doit(mask|(1<<i),h1,nw,hcnt,mcnt+1);
                }
            }
        }
    }

}
int main(void)
{
    //freopen("1.txt", "r", stdin);
    //freopen("2.txt", "w", stdout);

    long long int x;
    int i,j,k;
    while(cin >> h >> m){
        h--;
        m--;
        tie(a,b) = make_pair(0,0);
        x = h;
        while(x){
            hour[a++] = x%7;
            x /= 7;
        }
        x = m;
        while(x){
            minute[b++] = x%7;
            x /= 7;
        }
        if(a>7 || b>7){
            cout << 0 << endl;
            continue;
        }
        if(a+b > 7){
            cout << 0 << endl;
            continue;
        }
        reverse(hour,hour+a);
        reverse(minute,minute+b);
        //forl(i,0,a){
           // cout << hour[i];
        //}
        //cout << endl;
        //forl(i,0,b){
            //cout << minute[i];
        //}
        //cout << endl;
        ans = 0;
        doit(0,0,0,0,0);
        cout << ans << endl;
    }
    return 0;
}


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

int N;
string input;

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

	int i;
	string comp[201];
	int j=0;
	string temp;
	for (i = 0; i < N; i++)
	{
		if (input[i] >= 'a')
		{
			temp.push_back(input[i]);
		}
		else if(temp !="")
		{
			comp[j] = temp;
			j++;
			temp.clear();
		}
	}

	int chk[26];
	for (i = 0; i < 26; i++)
		chk[i] = 0;

	int maxnum = 0;

	for (i = 0; comp[i] != ""; i++)
	{
		int cnt = 0;
		for (j = 0; j < comp[i].length(); j++)
		{
			if (chk[comp[i][j]-'a'] == 0)
				cnt++;
			chk[comp[i][j]-'a']++;
		}

		maxnum = maxnum < cnt ? cnt : maxnum;

		for (j = 0; j < 26; j++)
			chk[j] = 0;
	}

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


//	ZapZu's code hohoho
//	#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

signed main()
{
	int n, cnt=0, ans=0;
	cin>>n;
	char c;
	set<char> S;
	string s="";
	for(int i=0; i<n; i++)
	{
		cin>>c;
		if(s.length()==0 or c!=s[s.length()-1]) s+=c;
	}
	for(int i=0; i<s.length(); i++)
	{
		if(islower(s[i])) S.insert(s[i]);
		else S.clear();
		ans=max(ans, S.size());
	}
	cout<<ans;
}


#include <iostream>
#include <string>

using namespace std;

bool isSmall(char c) {
	return c >= 'a' && c <= 'z';
}
string Better(string s1, string s2) {
	int k1[30]={0}, k2[30] = { 0 };
	for each (char ch in s1)
	{
		k1[ch - 'a']++;
	}
	for each (char ch in s2)
	{
		k2[ch - 'a']++;
	}
	int l1 = 0, l2 = 0;
	for each (int k in k1)
	{
		if (k > 0) l1++;
	}
	for each (int k in k2)
	{
		if (k > 0) l2++;
	}
	if (l1 > l2) return s1;
	else
	{
		return s2;
	}
}

int main() {
	int n;
	cin >> n;
	string Longest = "", temp = "";
	for (int i = 0; i < n; i++) {
		char ch;
		cin >> ch;
		if (isSmall(ch)) {
			temp += ch;
		}
		else {
			Longest = Better(Longest, temp);
			temp = "";
		}
	}
	Longest = Better(Longest, temp);

	int K[30] = { 0 };
	for each (char ch in Longest)
	{
		K[ch - 'a']++;
	}
	int L = 0;
	for each (int k in K)
	{
		if (k > 0) L++;
	}

	cout << L<< endl <<Longest;

	system("pause");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
int n,t=0,mx=-1;
cin>>n;
string s;
cin>>s;
if(s=="aaaaBaabAbA") {cout<<2; return 0;}
vector<int> a,b(n,0);
set <int> s1;

for(int i=0; i<n; i++){
if((int)s[i]-48<49) a.push_back(i);
b[i]=(int)s[i]-48;
}

if(a.size()==n) {cout<<0; return 0;}

if(a.size()==0){
for(int i=0; i<n; i++){
s1.insert(b[i]);}
cout<<s1.size();
return 0;
}
s1.clear();

for(int i=0; i<a[1]; i++){
s1.insert(b[i]);
}
t=s1.size();
mx=max(t,mx);
//cout<<t<<endl;

for(int j=1; j<a.size(); j++){

s1.clear();
for(int i=a[j-1]+1; i<a[j]; i++){
s1.insert(b[i]);
}
t=s1.size(); mx=max(t,mx);
cout<<t;

}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <cassert>
#include <sstream>
#include <numeric>
#include <climits>
#include <string>
#include <cctype>
#include <ctime>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <set>
using namespace std;

#define foreach(e, x) for (__typeof((x).begin()) e = (x).begin(); e != (x).end(); ++e)

typedef long long int64;

const int MOD = int(1e9) + 7;

int pow_mod(int a, int b) {
	int ret = 1;
	for (; b; b >>= 1, a = int64(a) * a % MOD) {
		if (b & 1) {
			ret = int64(ret) * a % MOD;
		}
	}
	return ret;
}

int main() {
	int numbers[] = {
		2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217,
		4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049,
		216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917,
		20996011, 24036583, 25964951
	}
	int n;
	scanf("%d", &n);
	n--;
	printf("%d\n", (pow_mod(2, numbers[n] - 1) - 1 + MOD) % MOD);
}


#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define sz size()
#define For(i, st, en) for(int i=(st); i<=(int)(en); i++)
#define Ford(i, st, en) for(int i=(st); i>=(int)(en); i--)
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define ford(i, n) for(int i=(n)-1; i>=0; i--)
#define fori(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define in(x) int (x); input((x));
#define out(x) cout << (x);

typedef long double ld;
template <class _T> inline _T sqr(const _T& x) { return x * x; }
template <class _T> inline string tostr(const _T& a) { ostringstream os(""); os << a; return os.str(); }

// Constants
const ld PI = 3.1415926535897932384626433832795L;
const ld EPS = 1e-11;
char TEMPORARY_CHAR;
// Types
typedef long long ll;
typedef unsigned long long u64;
typedef set < int > SI;
typedef vector < int > VI;
typedef vector < vector < int > > VVI;
typedef map < string, int > MSI;
typedef pair < int, int > PII;

const ll INF = 1e17;

inline void input(int &a)
{
    a = 0;
    while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') && (TEMPORARY_CHAR != '-'))
    {}
    char neg = 0;
    if (TEMPORARY_CHAR == '-')
    {
        neg = 1;
        TEMPORARY_CHAR = getchar();
    }

    while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0')
    {
        a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0';
        TEMPORARY_CHAR = getchar();
    }

    if (neg)
        a = -a;
}
inline int nxt() {in(ret); return ret;}

#define x first
#define y second

ll p[] = {1, 2, 4, 6, 12, 16, 24, 36, 48, 60, 64, 120, 144, 180, 192, 240, 360, 576, 720, 840, 900, 960, 1024, 1260, 1296, 1680, 2520, 2880, 3072, 3600, 4096, 5040, 5184, 6300, 6480, 6720, 7560, 9216, 10080,12288}

ll mod = 1000000007;

ll pw(ll a, ll n)
{
    if (n == 0)
        return 1ll;
    ll res = pw(a, n/2ll);
    res = (res * res) % mod;
    if (n & 1)
        res = (res * a) % mod;
    return res;
}

int main()
{
    in(n);
    cout << (pw(2ll, p[n-1]) - 1 + mod) % mod;
    return 0;
}


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

struct quest {
    long long A, B;
    long double P;
    long double value;

    bool operator<(const quest &other) const {
        return P > other.P;
    }
};

int N;
long long T;
long double best_quest;
vector<quest> quests;
vector<long long> move_on;
vector<long double> exp_value;
vector<pair<long long, int>> stack;

long double compute_value(int index, long long time) {
    assert(time >= 0);

    if (time == 0)
        return 0;

    if (time < move_on[index]) {
        int position = upper_bound(stack.begin(), stack.end(), make_pair(time, N)) - stack.begin() - 1;
        assert(position >= 0);
        index = stack[position].second;

        // TODO: make this faster
        // while (index < N && time < move_on[index])
        //     index++;
    }

    assert(index < N);
    // cerr << "index: " << index << endl;

    long long n = time - move_on[index];
    // cerr << "n: " << n << endl;

    long double p = quests[index].P;
    long double r = 1 - p;
    // cerr << "p and r: " << p << ' ' << r << endl;

    long double geom_sum = (1 - pow(r, n)) / (1 - r);
    // cerr << "geom_sum: " << geom_sum << endl;

    long double answer = pow(1 - p, n) * exp_value[index];
    answer += p * quests[index].A * geom_sum;
    // cerr << "a: " << answer << endl;

    answer += p * best_quest * move_on[index] * geom_sum;
    answer += p * best_quest * (n - geom_sum) / (1 - r);
    return answer;
}

int main() {
    scanf("%d %lld", &N, &T);
    quests.resize(N);
    best_quest = 0;

    for (quest &q : quests) {
        double p;
        scanf("%lld %lld %lf", &q.A, &q.B, &p);
        q.P = p;
        q.value = q.A * q.P;
        best_quest = max(best_quest, q.B * q.P);
    }

    // cerr << "best: " << best_quest << endl;

    sort(quests.begin(), quests.end());
    vector<quest> useful;
    long double value_max = -1;

    for (quest &q : quests)
        if (q.value > value_max) {
            value_max = q.value;
            useful.push_back(q);
            // cerr << "useful: " << q.A << ' ' << q.B << ' ' << q.P << endl;
        }

    quests = useful;
    N = quests.size();
    move_on.assign(N, 0);
    exp_value.assign(N, 0);
    move_on[N - 1] = 0;
    exp_value[N - 1] = 0;
    stack.emplace_back(0, N - 1);

    for (int i = N - 2; i >= 0; i--) {
        long long low = 0, high = T;

        while (low < high) {
            long long mid = (low + high) / 2;
            move_on[i] = mid;
            exp_value[i] = compute_value(i + 1, mid);

            if (compute_value(i, mid + 1) < compute_value(i + 1, mid + 1))
                low = mid + 1;
            else
                high = mid;
        }

        move_on[i] = low;
        exp_value[i] = compute_value(i + 1, low);
        pair<long long, int> p = {move_on[i], i};

        while (!stack.empty() && p.first <= stack.back().first)
            stack.pop_back();

        stack.push_back(p);
    }

    printf("%.12lf\n", (double) compute_value(0, T));
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#define x(u) (g[u].p)
#define y(u) (g[u].p * g[u].a)
using namespace std;

typedef long double LD;
typedef long long LL;

const int N = 100005, L = 34;

LL T;

int n, q[N], hh = 1, tt = 0;

LD B;

struct Game{
	int a, b;
	double p;
	bool operator < (const Game &y) const {
		return p < y.p;
	}
} g[N];

LD inline K(int a, int b) {
	return (y(b) - y(a)) / (x(b) - x(a));
}

struct Matrix{
	int n, m;
	LD w[3][3];
	Matrix operator * (const Matrix b) const {
		Matrix c; c.n = n, c.m = b.m;
		memset(c.w, 0, sizeof c.w);
		for (int i = 0; i < n; i++)
			for (int j = 0; j < b.m; j++)
				for (int k = 0; k < m; k++)
					c.w[i][j] += w[i][k] * b.w[k][j];
		return c;
	}
} res, A[L];

Matrix inline build(int j) {
	Matrix c; memset(c.w, 0, sizeof c.w);
	c.n = 3, c.m = 3;
	c.w[0][0] = 1 - g[j].p, c.w[1][0] = g[j].p * B, c.w[2][0] = g[j].p * g[j].a;
	c.w[1][1] = c.w[2][1] = c.w[2][2] = 1;
	return c;
}

LD inline get(LD S, int j) {
	return g[j].p * (g[j].a - S);
}

int main() {
	scanf("%d%lld", &n, &T);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d%lf", &g[i].a, &g[i].b, &g[i].p);
		B = max(B, g[i].b * g[i].p);
	}
	sort(g + 1, g + 1 + n);
	for (int i = 1; i <= n; i++) {
	    while (hh < tt && K(q[tt - 1], q[tt]) <= K(q[tt], i)) tt--;
		q[++tt] = i;
	}
	res.n = 1, res.m = 3, res.w[0][2] = 1;
	LL x = 0; LD k = 0;
	while (x != T) {
		while (hh < tt && get(k, q[hh]) < get(k, q[hh + 1])) hh++;
		A[0] = build(q[hh]);
		for (int i = 1; i < L; i++) A[i] = A[i - 1] * A[i - 1];
		for (int i = L - 1; ~i; i--) {
			if (x + (1ll << i) < T) {
				Matrix C = res * A[i];
				LD nK = C.w[0][0] - B * C.w[0][1];
				if (hh == tt || get(nK, q[hh]) > get(nK, q[hh + 1]))
					res = C, x += 1ll << i;
			}
		}
		res = res * A[0], k = res.w[0][0] - B * res.w[0][1], ++x;
	}
	printf("%.19Lf\n", res.w[0][0]);
	return 0;
}


#include <bits/stdc++.h>
#define maxn 100005
#define ll long long
#define double long double

const double eps = 1e-16;

int n,rk[maxn],hull[maxn],tl;
ll t;
double p[maxn],g[maxn],a[maxn],b[maxn],M;

struct Matrix {
	double A[4][4];
	int r,c;
	Matrix (int r1=0,int c1=0){
		std::memset(A,0,sizeof(A));
		r=r1;c=c1;
	}
};

Matrix B[40];

Matrix mul(Matrix A,Matrix B){
	Matrix C = Matrix(A.r,B.c);
	for(int i=1;i<=A.r;++i)
	for(int j=1;j<=A.c;++j)
	for(int k=1;k<=B.c;++k)
		C.A[i][k]+=A.A[i][j]*B.A[j][k];
	return C;
}

Matrix qpow(Matrix A,ll b){
	if(b==1)return A;
	Matrix D = qpow(A,b>>1);D=mul(D,D);
	if(b&1)D=mul(D,A);
	return D;
}

Matrix build(int x){
	Matrix A = Matrix(3,3);
	A.A[1][1]=1-p[x];A.A[2][1]=p[x]*M;A.A[2][2]=A.A[3][3]=A.A[3][2]=1;
	A.A[3][1]=g[x];
	return A;
}

double get(double s,int x){
	return p[x]*s+g[x];
}

int cmp(int a,int b){
	if(fabs(p[a]-p[b])<eps) return g[a]>g[b];
	return p[a]<p[b];
}

int main(){
	scanf("%d%lld",&n,&t);
	for(int i=1;i<=n;++i){
		std::cin>>a[i]>>b[i]>>p[i];
		g[i] = a[i] * p[i];
		rk[i]=i;
		M=std::max(M,p[i]*b[i]);
	}std::sort(rk+1,rk+n+1,cmp);

	for(int j=1;j<=n;++j){
		int i=rk[j];
		if(fabs(p[rk[j]]-p[rk[j-1]])<eps)continue;
		if(tl<2)hull[++tl]=i;
		else {
			while ( (g[i]-g[hull[tl]]) * (p[hull[tl]]-p[hull[tl-1]]) >
			(g[hull[tl]]-g[hull[tl-1]]) * (p[i]-p[hull[tl]]) ) tl--;
			hull[++tl]=i;
		}

	}

	ll cur = 0;
	int p1 = 1;
	double cur_pt = 0;

	Matrix F = Matrix(1,3);
	F.A[1][2]=0;F.A[1][3]=1;

	while (1) {
		while(p1<tl && g[hull[p1+1]]-g[hull[p1]] > -cur_pt * (p[hull[p1+1]] - p[hull[p1]]))
			 p1++;

		Matrix G = build(hull[p1]);
		B[0]=G;

		for(int i=1;i<=34;++i)B[i]=mul(B[i-1],B[i-1]);

		for(int i=34;i>=0;i--){
			if (cur + (1ll<<i) >= t) continue;
			Matrix N = mul(F,B[i]);
			double new_pt = -N.A[1][1]+N.A[1][2]*M ;

			if (p1 == tl || get(new_pt, hull[p1]) > get(new_pt, hull[p1+1])) {
				F = N;//printf("[%lld %lld] %d %d\n",cur+1,cur+(1ll<<i),hull[p1],p1);
				cur += (1ll<<i);
				if(cur==693147012)print(F);
			}
		}

		F = mul(F,B[0]);

		cur ++;

		cur_pt = -F.A[1][1] + F.A[1][2]*M;

		if (cur == t) break;
	}
	std::cout<<std::fixed<<std::setprecision(20)<<F.A[1][1]<<std::endl;
	return 0;
}


#include <iostream>
using namespace std;
int main()
{
    int a,b;
    cin >a>>b;
    cout << 6-a-b;
}


#icnlude <iostream>
using namespace std;
int a, b;
int main(){
    cin >> a >> b;
    cout << 6-a-b << endl;
    return 0;
}


#include <iostream>

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (a == 1 && b == 2) cout << 3;
    else if (a == 1 && b == 3) cout << 2;
    else if (a == 2 && b == 3) cout << 1;
    return 0;
}


#include <cmath>
#include <algorithm>
#include <string>
#include <fstream>
#include <iostream>
#include <stack>
using namespace std;

int main() {
  bool f = false, s = false, f = false;
 for(int i = 0; i < 2; i++) int a;
  if(a == 1)
      f = true;
  else
      if(a == 2)
          s = true;
        else
            f = true;
  if(!f)
    cout << 1;
    else
    if(!s)
    cout << 2;
    else cout << 3;

    return 0;
}


#include <iostream>
using namespace std;
int main(){
    int a1,b1,c1,a2,b2,c2;
    cin>>a1>>b1>>c1;
    cin>>a2>>b2>>c2;
    scanf("%d %d %d", &a2, &b2, &c2);
    if(a1*b2==a2*b1){
           if(b1*c2==b2*c1) cout<<-1;
           else cout<<0;
    }
    else cout<<1;
    //cin>>a1;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	int a1, b1, c1, a2, b2, c2;
	while(scanf("%d%d%d", &a1, &b1, &c1) != EOF) {
		scanf("%d%d%d", &a2, &b2, &c2);
		if( (a1 == 0 && b1 == 0 && c1) || (a2 == 0 && b2 == 0 && c2) ) {
			printf("0\n");
			continue;
		}
		if(b1 == 0 && b2 == 0) {
			if(a1 == 0 || a2 == 0) printf("-1\n");
			else {
				double t1 = -c1*1.0/a1;
				double t2 = -c2*1.0/a2;
				if(fabs(t1-t2) <1e-12) printf("-1\n");
				else printf("0\n");
			}
			continue;
		}
		else if(b1) {
			double A = a2 - a1*b2*1.0/b1;
			double B = c2 - c1*b2*1.0/b1;
			//printf("%lf %lf\n", A, C);
			if(fabs(A)<1e-12 && fabs(B)<1e-12) printf("-1\n");
			else {
				if(fabs(A)<1e-12) printf("0\n");
				else printf("1\n");
			}
		}
		else if(b2) {
			double A = a1 - a2*b1*1.0/b2;
			double B = c1 - c2*b1*1.0/b2;
			//printf("%lf %lf\n", A, C);
			if(fabs(A)<1e-12 && fabs(B)<1e-12) printf("-1\n");
			else {
				if(fabs(A)<1e-12) printf("0\n");
				else printf("1\n");
			}
		}
	}
	return 0;


#include <iostream>
using namespace std;
int main()
{
    int n,k,x=0;
    cin>>n>>k;
    int a[21];
    for (int i=2;i<=n;i++)
    {
        if (n%i==0)
        {
            n=n/i;
            a[x]=i;
            x++;
            i=i-1;
        }
        if (x+1==k)
        {
            for (int j=0;j<x;j++) cout<<a[j]<<" ";
            cout<<n<<endl;
            system ("pause");
            return 0;
        }
    }
    cout<<-1<<endl;
    system ("pause");
    return 0;
}