#include using namespace std; #define int long using pi=pair; signed main(){ int v, d; cin >> v >> d; vector> G(v, vector(v, false)); if(d==1)G=vector>(v,vector(v,true)); else{ if(v==1)G[0][0] = true; else if (v == 2){ G[0][0] = G[0][1] = G[1][0] = true; } else{ for (int i = 1; i + 1 < v; i += 2){ G[i][0] = G[0][i] = true; G[i + 1][0] = G[0][i + 1] = true; G[i][i + 1] = G[i + 1][i] = true; } if(v%2==0){ G[v - 1][0] = G[0][v - 1] = true; G[v - 1][v - 2] = G[v - 2][v - 1] = true; } } } for(auto g:G){ for(auto i:g) cout << i; cout << endl; } }