Problem:
 Score : 300 points    Problem Statement We have a square grid with H rows and W columns.
Snuke wants to write 0 or 1 in each of the squares.
Here, all of the following conditions have to be satisfied:   For every row, the smaller of the following is A : the number of 0 s contained in the row, and the number of 1 s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)  For every column, the smaller of the following is B : the number of 0 s contained in the column, and the number of 1 s contained in the column.   Determine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.      Constraints  1 \leq H,W \leq 1000  0 \leq A  2 \times A \leq W  0 \leq B  2 \times B \leq H  All values in input are integers.         Input Input is given from Standard Input in the following format:  H  W  A  B       Output If the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1 .  If the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:  s_{11}s_{12}\cdots s_{1W}  s_{21}s_{22}\cdots s_{2W}  \vdots  s_{H1}s_{H2}\cdots s_{HW}   Here s_{ij} is the digit written in the square at the i -th row from the top and the j -th column from the left in the grid.  If multiple solutions exist, printing any of them will be accepted.        Sample Input 1 3 3 1 1      Sample Output 1 100
010
001  Every row contains two 0 s and one 1 , so the first condition is satisfied.
Also, every column contains two 0 s and one 1 , so the second condition is satisfied.       Sample Input 2 1 5 2 0      Sample Output 2 01010

Solution (Python):
H, W, A, B = map(int, input().split())
grid = [[0]*W for i in range(H)]

for i in range(H - B):
    grid[i][W - A:] = [1] * A

for i in range(H - B, H):
    grid[i][:W - A] = [1] * (W - A)
for i in range(H):
    print("".join(map(str, grid[i])))

Solution (Python):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

h, w, a, b = MAP()
l = 0
for i in range(h-b):
    for j in range(a):
        print(0, end= "")
    for j in range(w-a-1):
        print(1, end="")
    print(1)
for i in range(b):
    for j in range(a):
        print(1, end="")
    for j in range(w-a-1):
        print(0, end="")
    print(0)

Solution (Python):
h,w,a,b = map(int, input().split())
s = '0' * a + '1' * (w-a)
t = '1' * a + '0' * (w-a)
for i in range(b):
  print(s)
for i in range(h-b):
  print(t)

Solution (Python):
H,W,A,B=map(int,input().split())
Ans=[["0"]*W for _ in range(H)]
if B>0:
    for i in range(A, W):
        for j in range(B):
            Ans[j][i]="1"
if A>0:
    for i in range(A):
        for j in range(B,H):
            Ans[j][i]="1"
for a in Ans:
    moji="".join(a)
    print(moji)

Solution (Python):
h,w,a,b=[int(i) for i in input().split()]
for i in range(b):
    print("1"*a+"0"*(w-a))
for i in range(h-b):
    print("0"*a+"1"*(w-a))

Solution (Python):
H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print("0"*A + "1"*(W-A))
    else:
        print("1"*A + "0"*(W-A))

Solution (Python):
H , W , A , B = map(int , input().split())
mat = [[1] * W for _ in range(H)]
for row in range(H):
    for col in range(W):
        if col < A and row < B or col >= A and row >= B:
            mat[row][col] = 0
for row in mat:
    print(*row,sep = "")
print()

Solution (Python):

h,w,a,b=map(int,input().split())
data=["" for i in range(h)]
for i in range(b):
    data[i]+="0"*(w-a)+"1"*a
for i in range(b,h):
    data[i]+="1"*(w-a)+"0"*a
for i in range(h):
    print(data[i])

Solution (Python):
H,W,A,B=map(int,input().split())
for _ in range(B):
  for _ in range(A):
    print(0,end='')
  for _ in range(W-A):
    print(1,end='')
  print()
for _ in range(H-B):
  for _ in range(A): 
    print(1,end='')
  for _ in range(W-A):
    print(0,end='')
  print()

Solution (Python):
import sys
input = sys.stdin.readline

h,w,a,b=map(int,input().split())
l=[]
for i in range(b):
    l.append([0]*a+[1]*(w-a))
for _ in range(h-b):
    l.append([1]*a+[0]*(w-a))
for k in range(h):
    s=""
    for v in range(w):
        s+=str(l[k][v])
    print(s)

Solution (Python):
H,W,A,B=map(int,input().split())
for i in range(H):
    print('1'*A+'0'*(W-A) if i < B else '0'*A+'1'*(W-A))

Solution (Python):
import sys

if __name__ == '__main__':
    h, w, a, b = map(int, input().split())
    for i in range(h):
        for j in range(w):
            sys.stdout.write('%d' % (int(i < b) ^ int(j < a)))
        print()

Solution (Python):
H, W, A, B = map(int, input().split())
maze = [['0'] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if (i < B and j >= A) or (i >= B and j < A):
            maze[i][j] = '1'

for i in range(H):
    for j in range(W):
        print(maze[i][j], end="")
    print()

Solution (Python):
h,w,a,b=map(int,input().split())
x=0
y=1
for i in range(b):
    for j in range(a):
        print(x,end='')
    for j in range(w-a):
        print(y,end='')
    print()
for i in range(h-b):
    for j in range(a):
        print(y,end='')
    for j in range(w-a):
        print(x,end='')
    print()

Solution (Python):
H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print("1"*A + "0"*(W-A))
    else:
        print("0"*A + "1"*(W-A))

Solution (Python):
h, w, a, b = map(int, input().split(" "))
for i in range(h):
  str = ""
  for j in range(w):
    if i < b:
      if j < a:
        str += "1"
      else:
        str += "0"
    else:
      if j < a:
        str += "0"
      else:
        str += "1"
  print(str)

Solution (Python):
H, W, A, B = map(int, input().split())

for h in range(H):
    S = ''
    for w in range(W):
        if (h < B and w < A) or (h >= B and w >= A):
            S += '1'
        else:
            S += '0'
    print(S)

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(b):
    print(('1' * a) + ('0' * (w - a)))
for i in range(h - b):
    print(('0' * a) + ('1' * (w - a)))

Solution (Python):
h,w,a,b=map(int,input().split())
x="1"*a+"0"*(w-a);y="0"*a+"1"*(w-a)
print("\n".join([x]*b+[y]*(h-b)))

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("1"*a+"0"*(w-a))
    else:
        print("0"*a+"1"*(w-a))

Solution (Python):
h,w,a,b = map(int,input().split())
s = [[0 for i in range(w)] for j in range(h)]
list0 = [[0]*w]*h


def check(s):
    for i in range(h):
        if min(s[i].count(0),s[i].count(1)) != a:
            return False
    for i in range(w):
        tmp = list([s[j][i] for j in range(h)])
        if min(tmp.count(0),tmp.count(1)) != b:
            return False
    return True


for i in range(b):
    for j in range(a,w):
        s[i][j] = 1
for i in range(b,h):
    for j in range(a):
        s[i][j] = 1
if check(s):
    for i in range(h):
        for j in range(w):
            print(s[i][j],end="")
        print()
else:
    print("No")

Solution (Python):
h,w,a,b = map(int,input().split())
ans1 = [[0 for _ in range(a)] + [1 for _ in range(w-a)] for i in range(b)]
ans2 = [[1 for _ in range(a)] + [0 for _ in range(w-a)] for i in range(h-b)]

ans = ans1 + ans2
for i in ans:
    for x in i:
        print(x,end="")
    print()

Solution (Python):
a,b,c,d=map(int,input().split())



for i in range(d):
    r_str = ""
    for j in range(c):
        r_str += "1"
    for j in range(c,b):
        r_str += "0"
    print(r_str)
for i in range(d,a):
    r_str = ""
    for j in range(c):
        r_str += "0"
    for j in range(c,b):
        r_str += "1"
    print(r_str)

Solution (Python):
h,w,a,b=map(int,input().split())

for i in range(b):
    for j in range(a):
        print(1,end='')
    for j in range(w-a):
        print(0,end='')
    print('',sep='\n')
for i in range(h-b):
    for j in range(a):
        print(0,end='')
    for j in range(w-a):
        print(1,end='')
    print('',sep='\n')

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7



H,W,A,B = map(int,input().split())

for i in range(B):
    print('1'*A + '0'*(W-A))
for i in range(H-B):
    print('0'*A + '1'*(W-A))

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("1"*a+"0"*(w-a))
    else:
        print("0"*a+"1"*(w-a))

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
    if i<b:
        print("1"*a+"0"*(w-a))
    else:
        print("0"*a+"1"*(w-a))

Solution (Python):
H,W,A,B=map(int,input().split())
for _ in range(B):print("0"*A+"1"*(W-A))
for _ in range(H-B):print("1"*A+"0"*(W-A))

Solution (Python):
H, W, A, B = map(int, input().split())

for _ in range(B):
    print("0" * A + "1" * (W - A))
for _ in range(H - B):
    print("1" * A + "0" * (W - A))

Solution (Python):
H, W, A, B = map(int, input().split())

for i in range(B):
    print('1'*A + '0'*(W-A))
for i in range(H-B):
    print('0'*A + '1'*(W-A))

Solution (Python):

h, w, a, b = map(int, input().split())

if a > (w//2) or b > (h//2):
    print('No')
else:
    for _ in range(h-b):
        print('1'*(w-a) + '0'*a)
    for _ in range(b):
        print('0'*(w-a) + '1'*a)

Solution (Python):

h, w, a, b = map(int, input().split())

if a > (w//2) or b > (h//2):
    print('No')
else:
    for _ in range(h-b):
        print('0'*(w-a) + '1'*a)
    for _ in range(b):
        print('1'*(w-a) + '0'*a)

Solution (Python):
h,w,a,b=map(int,input().split());w-=a;print(*['1'*a+'0'*w]*b+['0'*a+'1'*w]*(h-b))

Solution (Python):
h,w,a,b=map(int,input().split());w-=a;print(*['1'*a+'0'*w]*b+['0'*a+'1'*w]*(h-b))

Solution (Python):
import sys
 
h, w, a, b = map(int, input().split(' '))
 
if a > (w / 2) or b > (h / 2):
  print('No')
  sys.exit()

for i in range(h):
  line = ''
  for j in range(w):
    if (i<b) ^ (j<a):
      line += '1'
    else:
      line += '0'
  print(line)

Solution (Python):
h,w,a,b = map(int, input().strip().split(' '))

for i in range(h):
  print('1'*a+'0'*(w-a) if i < b else '0'*a+'1'*(w-a))

Solution (Python):
H, W, A, B = [int(x) for x in input().split()]
M = [[0] * W for _ in range(H)]
for h in range(H):
  if h < B:
    print('1' * A + '0' * (W - A))
  else:
    print('0' * A + '1' * (W - A))

Solution (Python):
H, W, A, B = [int(x) for x in input().split()]
M = [[0] * W for _ in range(H)]
M2 = [[0] * H for _ in range(W)]

f = 0
for h in range(H):
  if h < B:
    print('1' * A + '0' * (W - A))
  else:
    print('0' * A + '1' * (W - A))

Solution (Python):

def main():
    H, W, A, B = map(int, input().split())
    x = "0" * A + "1" * (W - A)
    y = "1" * A + "0" * (W - A)
    ans = [x] * B + [y] * (H - B)
    print("\n".join(ans))


if __name__ == "__main__":
    main()

Solution (Python):
def f_a():
    h, w, a, b = map(int, input().split())
    for i in range(h):
        if i<b:
            print("".join(["1"]*a + ["0"]*(w-a)))
        else:
            print("".join(["0"]*a + ["1"]*(w-a)))

if __name__ == "__main__":
    f_a()

Solution (Python):

def main():
    H, W, A, B = map(int, input().split())
    ans = []
    for i in range(H):
        if i < B:
            x = "0" * A + "1" * (W - A)
        else:
            x = "1" * A + "0" * (W - A)
        ans.append(x)
    print("\n".join(ans))


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    H, W, A, B = tuple(map(int, input().split()))
    for i in range(H):
        if i < B:
            x = "0" * A + "1" * (W - A)
        else:
            x = "1" * A + "0" * (W - A)
        print(x)


if __name__ == "__main__":
    main()

Solution (Python):
input_line=[]
input_line= input().rstrip().split(' ')

matA = [[1 for i in range(int(input_line[1]))] for j in range(int(input_line[0]))]

for i in range(int(input_line[3])):
    for j in range(int(input_line[2])):
         matA[i][j]=0

for i in range(int(input_line[3]),int(input_line[0])):
    for j in range(int(input_line[2]),int(input_line[1])):
        matA[i][j]=0

for i in range(int(input_line[0])):
    for j in range(int(input_line[1])):
        print(matA[i][j],end="")
    print()

Solution (Python):

def main():
    H, W, A, B = tuple(map(int, input().split()))
    for i in range(H):
        if i < B:
            x = [0] * A + [1] * (W - A)
        else:
            x = [1] * A + [0] * (W - A)
        print(*x, sep="")


if __name__ == "__main__":
    main()

Solution (Python):
h, w, a, b = map(int, input().split())
if b > h / 2:
  if a > w / 2:
    print('No')
    
for i in range(h):
  if i < b:
    print('0'*a + '1'*(w-a))
  else:
    print('1'*a + '0'*(w-a))

Solution (Python):
from heapq import *

def main():
    h, w, a, b = map(int, input().split())
    r = []
    c = []
    t = [[0] * w for _ in range(h)]
    br = False
    for x in range(h + 1):
        for y in range(w + 1):
            if a * (h - x) + (w - a) * x == b * (w - y) + (h - b) * y:
                br = True
                break
        if br: break
    else:
        print("No")
        exit()
    for i in range(x):
        heappush(r, [-w + a, i])
    for i in range(x, h):
        heappush(r, [-a, i])
    for j in range(y):
        heappush(c, [-h + b, j])
    for j in range(y, w):
        heappush(c, [-b, j])
    while r:
        e0, i = heappop(r)
        tmp = []
        for _ in range(-e0):
            e1, j = heappop(c)
            t[i][j] = 1
            if -e1 > 1: tmp.append([e1 + 1, j])
        for l in tmp:
            heappush(c, l)
    for x in t:
        print(*x, sep="")

main()

Solution (Python):
H, W, A, B = map(int, input().split())

M = [[0 for w in range(W)] for h in range(H)]

for h in range(B):
    for w in range(A):
        M[h][w] = 1

for h in range(B, H):
    for w in range(A, W):
        M[h][w] = 1

for h in range(H):
    print(''.join(list(map(str, M[h]))))

Solution (Python):
def main():
    H,W,A,B = map(int, input().split())
    
    for i in range(H):
        if i < B:
            print("1"*A + "0"*(W-A))
        else:
            print("0"*A + "1"*(W-A))


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    H,W,A,B = map(int, input().split())
    
    ans = [[0]*W for i in range(H)]

    for i in range(B):
        for j in range(A):
            ans[i][j] = 1
    
    for i in range(H-B):
        for j in range(W-A):
            ans[B+i][A+j] = 1

    for i in ans:
        print("".join(map(str, i)))


if __name__ == "__main__":
    main()

Solution (Python):
def a_01matrix():
    H, W, A, B = [int(i) for i in input().split()]
    ans = [[int(not(row < B))] * A + [int(row < B)] * (W - A) for row in range(H)]
    return '\n'.join(''.join(map(str, row)) for row in ans)
    """
    左上 BxA マスと右下 (H-B)x(W-A) マスを0とし、残りを1とする。
    すると、W-A>=A なので、上からB行は0の数がA個、残りの行は1の数がA個となる。
    列についても同様のことが言え、結局、上のやり方で必ず条件を満たせる。
    """

print(a_01matrix())

Solution (Python):
h,w,a,b=map(int,input().split())
ans=['']*h
for i in range(h):
    for j in range(w):
        if (i<b and j<a) or (i>=b and j>=a):
            ans[i]+='0'
        else:
            ans[i]+='1'
for i in range(h):
    print(ans[i])

Solution (Python):
h,w,a,b  = map(int,input().split())
lst_a  = [[1]*a + [0] * (w-a) for i in range(b)]
lst_b  = [[0]*a + [1] * (w-a)] * (h-b)
for i in lst_a:
 print(*i,sep="")
for i in lst_b:
 print(*i,sep="")

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(h):
  if i < b:
    print("0"*a + "1"*(w-a))
  else:
    print("1"*a + "0"*(w-a))

Solution (Python):
h,w,a,b = map(int,input().split())
for i in range(h):
    for j in range(w):
        if (i<b and j<a) or (i>=b and j>=a):
            print(0,end='')
        else:
            print(1,end='')
    print('')

Solution (Python):
H,W,A,B = map(int,input().split())
for i in range(H) :
    s,t = str(int((i < (H-B)))), str(int((i >= H-B)))
    print(s*(W-A)+t*(A))

Solution (Python):
h, w, a, b = map(int, input().split())
for _ in range(b):
    print('0'*a+'1'*(w-a))
for _ in range(h-b):
    print('1'*a+'0'*(w-a))

Solution (Python):
H,W,A,B = [int(x) for x in input().split()]
for i in range(H):
    s = ''
    for j in range(W):
        if(j<A and i<B):
            s += '0'
        elif(j<A and i>=B):
            s += '1'
        elif(j>=A and i<B):
            s += '1'
        else:
            s += '0'
    print(s)

Solution (Python):
H, W, A, B = map(int, input().split())
x = '1' * (W-A)
y = '0' * (W-A)
x = x.rjust(W, "0")
y = y.rjust(W, "1")

for i in range(B):
  print(x)
for i in range(H-B):
  print(y)

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):print("0"*a+"1"*(w-a) if i<b else "1"*a+"0"*(w-a))

Solution (Python):
h,w,a,b=map(int,input().split())

rowOver="0"*a+"1"*(w-a)
rowUnder="1"*a+"0"*(w-a)

for i in range(h):
  print(rowOver if i<b else rowUnder)

Solution (Python):
H, W, A, B = map(int, input().split())
for i in range(B):
	for i in range(A):
		print(0,end='')
	for i in range(W-A):
		print(1,end='')
	print()
for i in range(H-B):
	for i in range(A):
		print(1,end='')
	for i in range(W-A):
		print(0,end='')
	print()

Solution (Python):
h, w, a, b = map(int, input().split())

for i in range(b):
  for i in range(a):
    print(0,end="")
  for i in range(w-a):
    print(1,end="")
  print()
for i in range(h-b):
  for i in range(a):
    print(1,end="")
  for i in range(w-a):
    print(0,end="")
  print()

Solution (Python):
import numpy as np
h, w, a, b = map(int, input().split())
m = np.zeros((h,w),np.int8)
m[:b,a:] = 1
m[b:,:a] = 1
print('\n'.join(''.join(row) for row in m.astype(str)))

Solution (Python):
H,W,A,B = map(int,input().split())
for i in range(B):
  print("0"*A+"1"*(W-A))
for j in range(H-B):
  print("1"*A+"0"*(W-A))

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    H, W, A, B = map(int, input().split())
    for i in range(B):
        print('0'*A + '1'*(W-A))
    for i in range(H-B):
        print('1'*A + '0'*(W-A))

if __name__ == '__main__':
    main()

Solution (Python):
h, w, a, b = map(int, input().split())
ans = []
x = ['0'*a + '1'*(w-a)]
y = ['1'*a + '0'*(w-a)]
for i in range(b):
  ans.append(x)
for j in range(h-b):
  ans.append(y)
  
for line in ans:
    print(''.join(line))

Solution (Python):
import numpy as np
H,W,A,B = map(int, input().split())

mat = np.zeros((H,W))

for y in range(B):
    for x in range(A,W):
        mat[y][x]=1

for y in range(B,H):
    for x in range(A):
        mat[y][x]=1

for row in mat:
    row=list(map(int, row))
    print("".join(list(map(str, row))))

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
    d=""
    for j in range(w):
        if ((i<b)^(j<a)): d+="1"
        else: d+="0"
    print(d)

Solution (Python):
h,w,a,b=map(int,input().split())

lista=[]

for i in range(h):
    lista.append([0]*w)

if (a>w/2)|(b>h/2):
    print("No")

else:
    if h==1:
        for i in range(w-a):
            lista[0][a+i]=1
    elif w==1:
        for i in range(h-b):
            lista[b+i][0]=1

    elif (a==0)&(b==0):
        lista=lista

    else:  
        for i in range(w-a):
            lista[0][a+i]=1
        
           
        if a==0:    
            for i in range(w):
                for j in range(b):
                    lista[j][i]=1 
        elif b==0:    
            for i in range(h):
                for j in range(w-a):
                    lista[i][j+a]=1                         
        else:    
            for i in range(a):
                for j in range(h-b):
                    lista[b+j][i]=1 
            for i in range(b):
                for j in range(w-a):
                    lista[i][a+j]=1


 

    for i in range(h):
        row = ""
        for j in range(w):
            row += str(lista[i][j])
        print(row)

Solution (Python):
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

H,W,A,B = map(int,readline().split())

import numpy as np
grid = np.zeros((H,W),np.int8)
grid[:,:A]^=1
grid[:B]^=1

print('\n'.join(''.join(row) for row in grid.astype(str)))

Solution (Python):
H,W,A,B=map(int,input().split());print(('1'*A+'0'*(W-A)+' ')*B+('0'*A+'1'*(W-A)+' ')*(H-B))

Solution (Python):
def f():
    H, W, A, B = map(int, input().split())
    
    for _ in range(B):
        X = ['0'] * A + ['1'] * (W-A)
        print(''.join(X))
    
    for _ in range(H-B):
        X = ['1'] * A + ['0'] * (W-A)
        print(''.join(X))

    

    
f()

Solution (Python):
h, w, a, b = map(int, input().split())

ans = []

for i in range(h):
    ans.append([])
    for j in range(w):
        if i < b and j < a:
            ans[i].append(0)
        elif i >= b and j >= a:
            ans[i].append(0)
        else:
            ans[i].append(1)

for i in range(h):
    for j in range(w):
        print(ans[i][j], end='')
    print()

Solution (Python):
H, W, A, B = map(int, input().split())
ans = [['0']*W for _ in range(H)]

for y in range(H):
    for x in range(W):
        if x < A and y < B:
            ans[y][x] = '1'
        elif x >= A and y >= B:
            ans[y][x] = '1'

for line in ans:
    print(''.join(line))

Solution (Python):
H,W,A,B=map(int,input().split());print(*(['1'*A+'0'*(W-A)]*B+['0'*A+'1'*(W-A)]*(H-B)))

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(b):
    for j in range(a):
        print(0, end='')
    for j in range(w - a):
        print(1, end='')
    print()
for i in range(h - b):
    for j in range(a):
        print(1, end='')
    for j in range(w - a):
        print(0, end='')
    print()

Solution (Python):

from fractions import gcd

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    h,w,a,b = mi()

    ans = []
    k = 0
    k2 = 1
    for i in range(h):
        tmp = [k for j in range(a)]
        tmp += [k2 for j in range(w-a)]
        ans.append(tmp)
        if i == b-1:
            k = 1
            k2 = 0

    for i in range(h):
        p = ''.join(list(map(str,ans[i])))
        print(p)



main()

Solution (Python):
H,W,A,B=map(int,input().split());print(*(['1'*A+'0'*(W-A)]*B+['0'*A+'1'*(W-A)]*(H-B)),sep='\n')

Solution (Python):
h,w,a,b=map(int,input().split())

if (h/2 < b)|(w/2 < a):
        print("No")    
else:
    for hi in range(h):
        if hi<b:
            row = ""
            for wi in range(w):
                if wi <a:
                    row += "1"
                else:
                    row += "0"
        else:
            row = ""
            for wi in range(w):
                if wi <a:
                    row += "0"
                else:
                    row += "1"
            
        print(row)

Solution (Python):
(H,W,A,B)=(map(int,input().split()));[print(*[int((i<B)^(j<A)) for j in range(W)],sep="") for i in range(H)]

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

H,W,A,B = map(int,input().split(' '))

ANS = [None]*H
for i in range(H):
    ANS[i] = ['0']*W
for i in range(H):
    for j in range(W):
        if j<A and i>=B:
            ANS[i][j] = '1'
        elif j>=A and i<B:
            ANS[i][j] = '1'
for i in range(H):
    print(''.join(ANS[i]))

Solution (Python):
h, w, a, b = map(int, input().split())
 
l1 = "1"*a + "0"*(w-a)
l2 = "0"*a + "1"*(w-a)
ans = "\n".join([l1] * b + [l2] * (h-b))
print(ans)

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(b):
  print(*([1]*a+[0]*(w-a)),sep="")
for i in range(h-b):
  print(*([0]*a+[1]*(w-a)),sep="")

Solution (Python):
H, W, A, B = map(int,input().split())
for i in range (B):
    print('0'*A + '1'*(W-A))
for i in range(H-B):
    print('1'*A + '0'*(W-A))

Solution (Python):
import sys
H,W,A,B = (int(i) for i in input().split())

ans = []
for h in range(B):
  row = [0]*A + [1]*(W-A)
  print(*row,sep="")
for h in range(H-B):
  row = [1]*A + [0]*(W-A)
  print(*row,sep="")
sys.exit()

Solution (Python):
H,W,A,B = map(int,input().split())

s = [[] for j in range(H)]

for row in range(H):
    if row <= B-1:
        s[row] += [0]*A + [1]*(W-A)
    else:
        s[row] += [1]*A + [0]*(W-A)

    res = ''.join(map(str,s[row]))
    print(res)

Solution (Python):
import numpy as np
h, w, a, b = list(map(int, input().split()))
Ans = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if ( i < b and j >= a ) or ( i >= b and j < a) :
            Ans[i][j] = 1
for i in range(h):
    print(''.join(list(map(str, Ans[i]))))

Solution (Python):
H,W,A,B = map(int,input().split())

if (A >= W//2 + 1) or (B >= H//2 + 1) :
    print("No")
else :

    L = [["0"]*W for i in range(H)]

    for i in range(H) :
        for j in range(W) :
            if ((i < H-B) and (j < W-A)) or ((i >= H-B) and (j >= W-A)) :
                L[i][j] = "1"


    for j in range(W) :
        zero = 0
        one = 0
        for i in range(H) :
            if L[i][j] == "0" :
                zero += 1
            else :
                one += 1
        if min(zero,one) != B :
            print("No")
            break
    else :
        for i in range(H) :
            print("".join(L[i]))

Solution (Python):
h, w, a, b = map(int, input().split())
ans = [[0] * w for _ in range(h)]

for i in range(b):
    for j in range(a):
        ans[i][j] = 1

for i in range(b, h):
    for j in range(a, w):
        ans[i][j] = 1

for i in range(h):
    print("".join(map(str, ans[i])))

Solution (Python):
H, W, A, B = map(int, input().split())

for i in range(B):
    print('1' * A + '0' * (W - A))

for i in range(H-B):
    print('0' * A + '1' * (W - A))

Solution (Python):
obj = input().strip().split(' ')

H = int(obj[0])
W = int(obj[1])
A = int(obj[2])
B = int(obj[3])

for i in range(B):
    print('1' * A + '0' * (W - A))
for i in range(H - B):
    print('0' * A + '1' * (W - A))

Solution (Python):
h, w, a, b = map(int,input().split())
s = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if i < b:
            if j < a:
                s[i][j] = 0
            else:
                s[i][j] = 1
        else:
            if j < a:
                s[i][j] = 1
            else:
                s[i][j] = 0
for i in s:
    print("".join(map(str,i)))

Solution (Python):
import sys
H, W, A, B = list(map(int, input().split()))

field = [[0 for i in range(W)] for j in range(H)]
for h in range(B):
  for w in range(A, W):
    field[h][w] = 1
for h in range(B, H):
  for w in range(A):
    field[h][w] = 1
for row in field:
  print("".join(map(str, row)))

Solution (Python):
import sys
h,w,a,b = map(int,input().split())
if a != 0 and b != 0:
    for i in range(b):
        row = [0]*a+[1]*(w-a)
        print(*row,sep='')
    for i in range(h-b):
        row = [1]*a+[0]*(w-a)
        print(*row,sep='')
    sys.exit()
elif a == 0 and b == 0:
    for i in range(h):
        row = [0]*w
        print(*row,sep='')
    sys.exit()
elif b == 0:
    for i in range(h):
        row = [1]*a+[0]*(w-a)
        print(*row,sep='')
    sys.exit()
elif a == 0:
    for i in range(h):
        if i//b==0:
            row = [1]*w
            print(*row,sep='')
        else:
            row = [0]*w
            print(*row,sep='')
    sys.exit()
print('No')

Solution (Python):
h,w,a,b,=map(int,input().split())
ans='No'
if h==1 and b==0:
        ans=['1']*a+['0']*(w-a)
        print(''.join(ans))
elif w==1 and a==0:
        ans=['1']*b+['0']*(h-b)
        for i in ans:
                print(i)
else:
    ans1='0'*a+'1'*(w-a)
    ans2='1'*a+'0'*(w-a)
    for i in range(h):
        if i<=b-1:
            print(ans1)
        else:
            print(ans2)

Solution (Python):
H, W, A, B = map(int, input().split())


for i in range(B):
    answer = ['0' if j < A else '1' for j in range(W)]
    print(''.join(answer))
for i in range(H-B):
    answer = ['1' if j < A else '0' for j in range(W)]
    print(''.join(answer))

Solution (Python):
H, W, A, B = map(int, input().split())

for _ in range(B):
  print(''.join(['0'] * A + ['1'] * (W-A)))
for _ in range(H-B):
  print(''.join(['1'] * A + ['0'] * (W-A)))

Solution (Python):
def p_a():
    H, W, A, B = map(int, input().split())

    S = [[0] * W for _ in range(H)]

    if A == 0 and B == 0:
        for i in range(H):
            print(*S[i], sep="")
        exit()

    for i in range(H):
        for j in range(W):
            if A == 0:
                if i < B:
                    S[i][j] = 1
                continue
            elif B == 0:
                if j < A:
                    S[i][j] = 1
                continue

            if i // B == 1 and j // A == 1:
                S[i][j] = 1

            if i // B == 1:
                continue

            if j // A == 1:
                continue

            S[i][j] = 1

    for i in range(H):
        print(*S[i], sep="")


if __name__ == '__main__':
    p_a()

Solution (Python):
H, W, A, B = map(int, input().split())

board = [[0] * W for _ in range(H)]
for i in range(B):
    for j in range(A):
        board[i][j] = 1
for i in range(B, H):
    for j in range(A, W):
        board[i][j] = 1
assert all(sum(row) in [A, W-A] for row in board)
assert all(sum(board[i][j] for i in range(H)) in [B, H-B] for j in range(W))
for row in board:
    print("".join(map(str, row)))

Solution (Python):
h, w, a, b = map(int, input().split( ))

ans = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    tmp = ''
    for j in range(w):
        w_check = 1
        h_check = 1
        if j < a:
            w_check = -1
        if i < b:
            h_check = -1
        
        if w_check * h_check == 1:
            ans[i][j] = 0
        else:
            ans[i][j] = 1
        
        tmp += str(ans[i][j])
    print(tmp)

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(b):print('0'*a+'1'*(w-a))
for i in range(h-b):print('1'*a+'0'*(w-a))

Solution (Python):
h, w, a, b = map(int, input().split())


col = [0 for i in range(w)]
correct = []


for r in range(h):
    tmp = ''
    for c in range(w):
        if c < a and r < b or (c in range(a, w) and r in range(b, h)):
            tmp += '0'
        else:
            tmp += '1'
    correct.append(tmp)

for s in correct:
    print(s)

Solution (Python):
h,w,a,b = map(int,input().split())

list1 = []
list2 = []
for i in range(a):
    list1.append(0)
for i in range(w-a):
    list1.append(1)
for i in range(w):
    if list1[i] == 1:
        list2.append(0)
    else:
        list2.append(1)

for i in range(b):
    print("".join(map(str,list1)))
for i in range(h-b):
    print("".join(map(str,list2)))

Solution (Python):
h, w, a, b = map(int, input().split())
for i in range(b):
    for j in range(a):
        print(0, end="")
    for j in range(w - a):
        print(1, end="")
    print()
for i in range(h - b):
    for j in range(a):
        print(1, end="")
    for j in range(w - a):
        print(0, end="")
    print()

Solution (Python):
h, w, a, b = map(int, input().split())

for i in range(b):
    line = '1'*a + '0' * (w-a)
    print(line)
for j in range(h-b):
    line = '0' * a + '1' * (w-a)
    print(line)

Solution (Python):
h, w, a, b = map(int, input().split())
ans = "".join(["0"]*a+["1"]*(w-a))
for i in range(b):
    print(ans)
ans = "".join(["1"]*a+["0"]*(w-a))
for i in range(h-b):
    print(ans)