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 <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=22;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }

int n,k,f[1<<N|1][N],bit[1<<N|1],nx[1<<N|1][2],mi[N];
char t[1<<N];
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(k);
	int S=1<<(n+1);
	for (int s=0; s<=S; s++)
	{
		if (s) bit[s]=bit[s>>1]+1;
		nx[s][0]=nx[s][1]=-1;
		for (int i=0; i< bit[s]; i++)
			nx[s][s>>i&1]=i;
	}
	mi[0]=1;
	for (int i=1; i<=n+1; i++)
		mi[i]=mi[i-1]<<1|1;
	for (int i=0; i<=n; i++)
	{
		int m=1<<i;
		scanf ("%s",t);
		if (i) for (int j=0; j< m; j++) if (t[j]=='1')
			f[m+j][1]=1;
	}

	for (int i=1; i<=n; i++)
		for (int s=1; s<=S; s++) if (f[s][i])
		{
			int len=bit[s]-i,s2=s&mi[len-1],s1=s>>len,g=f[s][i];
			if (!len) continue;
			if (len> bit[s2])
			{
				f[s][i+1]+=g;
				int p=nx[s2][1];
				if (p!=-1)
				{
					int nx=(s1<<1|1)<<p;
					if (p) nx|=s2&mi[p-1];
					f[nx][i+1]+=g;
				}
			}
			else
			{
				f[s][i+1]+=g;
				int p=nx[s2][0];
				if (p!=-1)
				{
					int nx=(s1<<1)<<p;
					if (p) nx|=s2&mi[p-1];
					f[nx][i+1]+=g;
				}
				
			}
			f[s1][i]+=g;
		}
	int ans=0;
	for (int s=1; s<=S; s++)
		if (bit[s]> bit[ans]&&f[s][bit[s]]>=k) ans=s;
	// for (int s=1; s<=S; s++)
	// {
	// 	for (int i=bit[s]-2; i>=0; i--)
	// 		putchar((s>>i&1)+'0');putchar(' ');
	// 	printf("%d %d\n",s,f[s][bit[s]]);
	// }
	for (int i=bit[ans]-2; i>=0; i--)
		putchar((ans>>i&1)+'0');

    return 0;
}