Problem: You are given a set S of strings consisting of `0` and `1`, and an integer K.

Find the longest string that is a subsequence of K or more different strings in S. If there are multiple strings that satisfy this condition, find the lexicographically smallest such string.

Here, S is given in the format below:

* The data directly given to you is an integer N, and N+1 strings X_0,X_1,...,X_N. For every i (0\leq i\leq N), the length of X_i is 2^i.
* For every pair of two integers (i,j) (0\leq i\leq N,0\leq j\leq 2^i-1), the j-th character of X_i is `1` if and only if the binary representation of j with i digits (possibly with leading zeros) belongs to S. Here, the first and last characters in X_i are called the 0-th and (2^i-1)-th characters, respectively.
* S does not contain a string with length N+1 or more.



Here, a string A is a subsequence of another string B when there exists a sequence of integers t_1 < ... < t_{|A|} such that, for every i (1\leq i\leq |A|), the i-th character of A and the t_i-th character of B is equal.

Constraints

* 0 \leq N \leq 20
* X_i(0\leq i\leq N) is a string of length 2^i consisting of `0` and `1`.
* 1 \leq K \leq |S|
* K is an integer.

Input

Input is given from Standard Input in the following format:


N K
X_0
:
X_N


Output

Print the lexicographically smallest string among the longest strings that are subsequences of K or more different strings in S.

Examples

Input

3 4
1
01
1011
01001110


Output

10


Input

4 6
1
01
1011
10111010
1101110011111101


Output

100


Input

2 5
0
11
1111


Output

Solution (in CPP):

Solution:
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
typedef long long ll;
using namespace std;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2097153, M = N * 19;
char S[N];
int n,k,Len[N],cnt,dp[N][21],deg[N][21],sta1[M],top;
short sta2[M];
#define bh(s,l) ((s)+(1<<(l)))
inline void getnxt(int len, int s, int l, int &x, int &y, bool v) {
	per(pos,len,1) if (((s>>(pos-1))&1)==v) {
		y=pos-1;
		x=bh(((((s>>len)<<1)+v)<<(pos-1))|(s&((1<<(pos-1))-1)),l-len+pos); 
		return;
	}
	x=0;y=0;
}
int main() { //freopen("1.in","r",stdin);
	read(n);read(k);
	rep(i,0,n){
		scanf("%s",S+1);
		rep(j,1,1<<i) Len[++cnt]=i,dp[cnt][i]=(S[j]=='1');
	}
	rep(now,1,cnt) rep(len,1,Len[now]) {
		int l=Len[now],s=now-(1<<l);
		int x=bh(s>>len,l-len),y=0; ++deg[x][y];
	//	printf("nxt[%d,%d]=%d,%d\n",now,len,x,y);
		getnxt(len,s,l,x,y,0); ++deg[x][y];
	//	printf("nxt[%d,%d]=%d,%d\n",now,len,x,y);
		getnxt(len,s,l,x,y,1); ++deg[x][y];
	//	printf("nxt[%d,%d]=%d,%d\n",now,len,x,y);
	}
	rep(now,1,cnt) rep(len,1,Len[now]) if (!deg[now][len]) sta1[++top]=now,sta2[top]=len;
	while (top) {
		int now=sta1[top],len=sta2[top--]; if (!(now>=1&&len>=1)) continue; //len>=1
		int l=Len[now],s=now-(1<<l),val=dp[now][len];
		int x=bh(s>>len,l-len),y=0; if (!(--deg[x][y])) sta1[++top]=x,sta2[top]=y; dp[x][y]+=val;
		getnxt(len,s,l,x,y,0); if (!(--deg[x][y])) sta1[++top]=x,sta2[top]=y; dp[x][y]+=val;
		getnxt(len,s,l,x,y,1); if (!(--deg[x][y])) sta1[++top]=x,sta2[top]=y; dp[x][y]+=val;
	}
	int ans=1; rep(i,2,cnt) if (dp[i][0]>=k&&(Len[i]>Len[ans])) ans=i;
//	rep(i,1,cnt) printf("%d : %d\n",i,dp[i][0]);
//	printf("ans = %d\n",ans);
	per(i,Len[ans],1) printf("%d",((ans-(1<<Len[ans]))>>(i-1))&1);
	return 0;
}