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())
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=list(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(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
sys.setrecursionlimit(10**7)


from collections import deque
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy


def getlist():
	return list(map(int, input().split()))


def main():
	H, W, A, B = getlist()
	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 = [['0' for _ in range(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 x in ans:
    print(''.join(x))

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

zero_one = "0"*A + "1"*(W-A)
one_zero = "1"*A + "0"*(W-A)

for _ in range(B):
    print(zero_one)
for _ in range(H-B):
    print(one_zero)

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())
mat=[]
for _ in range(B):
  r='0'*A+'1'*(W-A)
  mat.append(r)

for _ in range(H-B):
  r='1'*A+'0'*(W-A)
  mat.append(r)

for i in range(H):
  print(mat[i])

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

row_str="0"*A+"1"*(W-A)
inv_row_str="1"*A+"0"*(W-A)

for i in range(B):
  print(row_str)
for i in range(H-B):
  print(inv_row_str)

Solution (Python):
H, W, A, B = input().strip().split()
H, W, A, B = [int(H), int(W), int(A), int(B)]

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"*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())
mat = [[0 for j in range(w)] for i in range(h)]
for i in range(b, h):
    for j in range(a):
        mat[i][j] = 1
for i in range(b):
    for j in range(a, w):
        mat[i][j] = 1
for _ in mat:
    print(*_,sep='')

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

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())





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

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

if A > W/2 or B > H/2:
    print('No')
    exit()

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

Solution (Python):
H, W, A, B = map(int, input().split())
ans = [[1] * A + [0] * (W-A)] * (H-B) + [[0] * A + [1] * (W-A)] * B
print('\n'.join(''.join(str(e) for e in r) for r in ans))

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


if __name__ == "__main__":
    main()

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


if __name__ == "__main__":
    main()

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(H):
  if i < B:
    s = "0"*A+"1"*(W-A)
  else:
    s = "1"*A+"0"*(W-A)
  print(s)

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

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

col1 = []
col2 = []

for _ in range(A):
    col1.append("0")
    col2.append("1")
    
for _ in range(W - A):
    col1.append("1")
    col2.append("0")
    
row1 = "".join(col1)  
row2 = "".join(col2)  

for _ in range(B):
    print(row1)
    
for _ in range(H - B):
    print(row2)

Solution (Python):
h,w,a,b=map(int,input().split())
l1=[]
l2=[]
for c in range(a):
    l1.append("0")
    l2.append("1")
for c in range(w-a):
    l1.append("1")
    l2.append("0")
s1="".join(l1)
s2="".join(l2)
for c in range(b):
    print(s1)
for c in range(h-b):
    print(s2)

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):
import numpy as np
H, W, A, B = map(int, input().split())

mat = [np.array(([0] * A) + ([1] * (W - A))) for _ in range(H)]

for i in range(min(H, B)):
    mat[i] = 1 - mat[i]

mat = [r.astype(str).tolist() for r in mat]
print("\n".join("".join(r) for r in mat))

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())
ans = [[0]*W for i in range(H)]
for i in range(A):
  for j in range(B):
    ans[j][i] = 1

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

for l in ans:
  for i in l:
    print(i,end="")
  print()

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

print('\n'.join(ans))

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

for i in range(h):
    print(ans[i])

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

s = [[0 for _ in range(w)] for _ in range(h)]

num = ["0", "1"]
flag = True
for i in range(h):
    for j in range(w):
        if b <= i and flag:
            num.reverse()
            flag = False
        if j < a:
            s[i][j] = num[0]
        else:
            s[i][j] = num[1]


for row in s:
    print("".join(row))

Solution (Python):
H, W, A, B = map(int, input().split())
ans = [[''] * W for i in range(H)]
 
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())
ans = [[''] * W for i in range(H)]
 
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())
ans = [[''] * W for i in range(H)]

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())

l1 = '0' * a + '1' * (w - a)
l2 = '1' * a + '0' * (w - a)
for i in range(b):
	print('{}'.format(l1))
for i in range(h-b):
	print('{}'.format(l2))

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

Solution (Python):
H,W,A,B = map(int,input().split())
temp = ""
for l in range(0,W):
    temp = temp + "0"


Alist = list()
for k in range(0,H):
    Alist.append(list(temp))


for i in range(0,H):
    for j in range(0,W):
        if i < B and j < A :
            Alist[i][j] = "1"
        elif j >= A and i<B:
            Alist[i][j] = "0"
        elif i >= B and j < A :
            Alist[i][j] = "0"
        else:
            Alist[i][j] = "1"

for a in Alist:
    print(''.join(a))

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

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

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

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

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

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

if A == 0:
    for i in range(H):
        for j in range(W):
            if 0 <= i < B:
                grid[i][j] = "1"

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

else:
    for i in range(H):
        for j in range(W):
            if (0 <= i < B and 0 <= j < A) or (B <= i < H and A <= j < W):
                grid[i][j] = "1"

for line in grid:
    print("".join(line))

Solution (Python):
import sys

input = sys.stdin.readline

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

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

for y in range(B):
	for x in range(A):
		out[y][x] = 1

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

for i in out: print(*i, sep='')

Solution (Python):
h,w,a,b = map(int, input().split())
if a*2>w or b*2>h:
    print('No')
else:
    ans = [[0 for i in range(w)]for j in range(h)]
    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(map(str,ans[i])))

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

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

Solution (Python):
n,m,a,b=[int(i) for i in input().split()]
l=[[0 for i in range(m)] for j in range(n)]

for i in range(n):
    for j in range(m):
        if i<b:
            if j<a:
                l[i][j] = 0
            else:
                l[i][j] = 1
        else:
            if j<a:
                l[i][j] = 1
            else:
                l[i][j] = 0
for i in range(n):
    print("".join(str(e) for e in l[i]))

Solution (Python):
h,w,a,b=[int(j) for j in input().split()]

for i in range(h-b):

    print("1"*a+"0"*(w-a))
for i in range(b):

    print("0"*a+"1"*(w-a))

Solution (Python):
h,w,a,b = map(int, input().split())
for i in range(h):
  ans = []
  for j in range(w):
    if i <= b-1:
      if j <=a-1:
        ans.append(0)
      else:
        ans.append(1)
    else:
      if j <=a-1:
        ans.append(1)
      else:
        ans.append(0)
  for x in range(w):
    print(ans[x], end='')
  print()

Solution (Python):
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')

h,w,a,b = map(int,input().split())
if a > w // 2 or b > h // 2:
    print('No')
    exit()
l = [0] * (w - a) + [1] * a
for i in range(h):
    for j in l:
        p = j ^ (i < b)
        print(p, end = '')
    print()

Solution (Python):
S = list(map(int, input().split()))
H = S[0]
W = S[1]
A = S[2]
B = S[3]

s1 = ''
s2 = ''
for i in range(W):
	if i < A:
		s1 += '0'
		s2 += '1'
	else:
		s1 += '1'
		s2 += '0'
for _ in range(B):
	print(s1)
for _ in range(H-B):
	print(s2)

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

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

for i in range(H):
    for j in range(W):
        if i+1<=B and j+1>A:
            L[i][j]="1"
        elif i+1>B and j+1<=A:
            L[i][j]="1"
for i in range(H):
    print("".join(L[i]))

Solution (Python):
a = list(map(int, input().split()))
for i in range(a[0]):
    for j in range(a[1]):
        if i<a[3] :
            if j<a[2] :print(0,end="")
            else :print(1,end="")
        else :
            if j<a[2] :print(1,end="")
            else :print(0,end="")
    print("")

Solution (Python):
a = list(map(int, input().split()))
for i in range(a[0]):
    for j in range(a[1]):
        if i<a[3] :
            if j<a[2] :print(0,end="")
            else :print(1,end="")
        else :
            if j<a[2] :print(1,end="")
            else :print(0,end="")
    print("")

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

Solution (Python):
H, W, A, B = map(int, open(0).read().split())

S = [["01"[(i < B) ^ (j < A)] for j in range(W)] for i in range(H)]
print("\n".join("".join(s) for s in S))

Solution (Python):
H, W, A, B = map(int, open(0).read().split())

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

for i in range(H):
    for j in range(W):
        if (i < B) ^ (j < A):
            S[i][j] = "1"

print("\n".join("".join(s) for s in S))

Solution (Python):
def solve():
    H, W, A, B = map(int, input().split())
    if B <= H // 2 and A <= W // 2:
        for _ in range(B):
            print("0" * A + "1" * (W - A))
        for _ in range(H - B):
            print("1" * A + "0" * (W - A))
    else: print("No")
 
    return 0

if __name__ == "__main__":
    solve()

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):
s = input().split(" ")
h = int(s[0])
w = int(s[1])
a = int(s[2])
b = int(s[3])

for i in range(b):
  for j in range(w):
    if j < a:
      print(1,end="")
    else:
      print(0,end="")
  print("")

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

Solution (Python):

import sys
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()



def main():
    H, W, A, B = mi()
    a = [[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):
                a[i][j] = 1
    for l in a:
        print(*l, sep="")

if __name__ == '__main__':
    main()

Solution (Python):
H,W,A,B = map(int,input().split())
import numpy as np
ans = np.array([[0] * W] * H)
for h in range(H):
    for w in range(W):
        if w >= A and h >= B:
            pass
        elif w >= A:
            ans[h,w] = 1
        elif h >= B:
            ans[h,w] = 1
        else:
            pass
for h in range(H):
    a = ans[h].tolist()
    print(*a,sep="")

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

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    high, width, a, b = map(int, input().split())

    ans = [[0 for i in range(width)] for j in range(high)]

    for i in range(high):
        for j in range(width):
            if (i < b and j >= a) or (i >= b and j < a):
                ans[i][j] = 1
        print(''.join(list(map(str, ans[i]))))



if __name__ == '__main__':
    main()

Solution (Python):
H,W,A,B=map(int,input().split())
matrix=[[0]*W for i 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):
            pass
        elif (i<B and j>=A) or (i>=B and j<A):
            matrix[i][j]=1
        else:
            pass
for i in range(H):
    if i==0:
        pass
    else:
        print()
    for j in range(W):
        print(matrix[i][j],end="")

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

Solution (Python):
d=list(map(int, input().split()))

height = d[0]
width = d[1]
A = d[2]
B = d[3]

z = '0'
o = '1'

s=z*A+o*(width-A)
t=o*A+z*(width-A)

for i in range(B):
  print(s)

for i in range(height-B):
  print(t)

Solution (Python):
H,W,A,B=map(int,input().split())
b=0
for i in range(H):
  if b!=B:
    w=["1"]*A+["0"]*(W-A)
    b+=1
  else:
    w=["0"]*A+["1"]*(W-A)
  print("".join(w))

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('0' * a + '1' * (w - a))
for i in range(h-b):
    print('1' * a + '0' * (w - a))

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

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

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

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    h, w, a, b = list(map(int, input().rstrip('\n').split()))
    for i in range(h):
        if i < b:
            print("".join(["0"] * a + ["1"] * (w - a)))
        else:
            print("".join(["1"] * a + ["0"] * (w - a)))


if __name__ == '__main__':
    slove()

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    h, w, a, b = list(map(int, input().rstrip('\n').split()))
    for i in range(h):
        if i < b:
            print("".join(["0"] * a + ["1"] * (w - a)))
        else:
            print("".join(["1"] * a + ["0"] * (w - a)))


if __name__ == '__main__':
    slove()

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())
mat=[[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if i >= B and A > j:
            mat[i][j] = 1
        elif i < B and j >= A:
            mat[i][j] = 1
    print("".join(map(str, mat[i])))

Solution (Python):
h,w,a,b = [int(i) for i in input().split()]

lists = [[0]*w for _ in range(h)]
for i in range(b):
    for j in range(a):
        lists[i][j]=1
for i in range(h-b):
    for j in range(w-a):
        lists[b+i][a+j]=1

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

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 = (int(n) for n in input().split())

S = [[0 for i in range(W)] for j in range(H)]

if A > W/2 or B > H/2:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (i<B and j<A) or (B<=i and A<=j):
                S[i][j] = 1



    for s in S:
        print(''.join(map(str,s)))

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

for j in range(H):
    for i in range(W):
        if (i < A and j < B) or (A <= i and B <= j):
            print (0, end = '')
        else:
            print (1, end = '')
    print ()

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

lst = [[0 if (i < A and j < B) or (A <= i and B <= j) else 1 for i in range(W)] for j in range(H)]

for i in lst:
    print (*i, sep = '')

Solution (Python):
H, W, A, B = map(int, input().split())
 
for r in range(H):
    for c in range(W):
        if (c < A) ^ (r < B):
            print(str('1'), end="")
        else:
            print(str('0'), end="")
    print("")

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):
  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 r in range(H):
    for c in range(W):
        if (c < A) ^ (r < B):
            print(str('1'), end="")
        else:
            print(str('0'), end="")
    print("")

Solution (Python):
from sys import stdin

def main():
    input = lambda: stdin.readline()[:-1]
    H, W, A, B = map(int, input().split())

    grid = ['1' * A + '0' * (W - A) for _ in range(B)]
    grid += ['0' * A + '1' * (W - A) for _ in range(H - B)]
    print(*grid, sep='\n')

main()

Solution (Python):
from sys import stdin

def main():
    input = lambda: stdin.readline()[:-1]
    H, W, A, B = map(int, input().split())

    grid = [[1] * A + [0] * (W - A) for _ in range(B)]
    grid += [[0] * A + [1] * (W - A) for _ in range(H - B)]
    for n in grid:
        print(*n, sep='')

main()

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 = (int(i) for i in input().split())  
for i in range(b):
    print("0"*a+"1"*(w-a))
for _ in range(h-b):
    print("1"*a+"0"*(w-a))

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    h, w, a, b = rli()
    for y in range(h):
        ans = []
        for x in range(w):
            if y < b and x < a:
                ans.append("1")
            elif y >= b and x >= a:
                ans.append("1")
            else:
                ans.append("0")
        print("".join(ans))



if __name__ == '__main__':
    main()

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

for i 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()]
[print(''.join(["0" if j<A else "1" for j in range(W)])) if i<B else print(''.join(["1" if j<A else "0" for j in range(W)])) for i in range(H)]

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(b):
  s=''
  for j in range(a):
    s+='1'
  for j in range(w-a):
    s+='0'
  print(s)
for i in range(h-b):
  s=''
  for j in range(a):
    s+='0'
  for j in range(w-a):
    s+='1'
  print(s)

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):



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

    
    
    
    
    
    
    
    
    
    
    
    
    for wi in range(a, w):
        for hi in range(b):
            ans[hi][wi] = 1

    for hi in range(b, h):
        for wi in range(a):
            ans[hi][wi] = 1

    for a in ans:
        print(''.join(map(str, a)))


if __name__ == '__main__':
    main()

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

ans=[[0]*w for _ in range(h)]

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

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

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

g = [[0 for j in range(W)] for i in range(H)]
for i in range(B):
    for j in range(A,W):
        g[i][j] = 1
for i in range(B,H):
    for j in range(A):
        g[i][j] = 1

for i in range(H):
    print(''.join(map(str, g[i])))

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())

"""
    W=12
    A=5
H=7 111110000000
B=3 111110000000
    111110000000
    00000
    00000
    00000
    00000
"""

if A == 0:
    
    for i in range(B):
        print("1"*W)
    for i in range(H-B):
        print("0"*W)
else:
    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())

ans = []
for i in range(H):
    hlist = []
    if i < B:
        for j in range(W):
            if j < A:
                hlist.append("0")
            else:
                hlist.append("1")
    else:
        for j in range(W):
            if j < A:
                hlist.append("1")
            else:
                hlist.append("0")
    ans.append(hlist)
    
for hlist in ans:
    for h in hlist:
        print(h,end="")
    print()

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

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

Solution (Python):

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


zero_str = '0'
one_str = '1'


for index in range(b):
    print(zero_str * a + one_str * (w - a))


for index in range(h-b):
    print(one_str * a + zero_str * (w - a))

Solution (Python):
h, w, a, b = [int(i) for i in 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):
import sys
 
def main():
    input = sys.stdin.readline
    H, W, A, B = map(int, input().split())
 
    ans = []
    for h in range(B):
        row = [0]*A + [1]*(W-A)
        ans.append(row)
    
    for h in range(H-B):
        row = [1]*A + [0]*(W-A)
        ans.append(row)
    
    for a in ans:
        print(''.join(map(str, a)))
 
if __name__ == '__main__':
    main()

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())

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

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(B):
        for j in range(A):
            S[i][j] = 1

    for i in range(B, H):
        for j in range(A, W):
            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())
ans = []
for i in range(H - B):
  line = ["1" if j <= A - 1 else "0" for j in range(W) ]
  ans.append(line)
for i in range(H - B, H):
  line = ["0" if j <= A - 1 else "1" for j in range(W)]
  ans.append(line)
for i in ans:
  print("".join(i))

Solution (Python):
H, W, A, B = map(int, input().split())
assert A <= W // 2 and B <= H // 2

for y in range(H):
    print(''.join('1' if (x < A) ^ (y < B) else '0' for x in range(W)))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    h,w,a,b = LI()
    r = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if (i < b) == (j < a):
                r[i][j] = 1

    return JAA(r, "\n", "")


print(main())

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

ans = []
b = 0

for _ in range(H):
    if b < B:
        ans.append(''.join(map(str, [1] * A + [0] * (W - A))))
        b += 1
    else:
        ans.append(''.join(map(str, [0] * A + [1] * (W - A))))

print(*ans, sep='\n')

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 j in range(B):
    print("".join(["0" if i <A else "1" for i in range(W) ]))
for j in range(H-B):
    print("".join(["1" if i <A else "0" for i in range(W) ]))