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):
def main():
    H, W, A, B = map(int, input().split())
    for _ in range(B):
        tmp = ['0']*A + ['1']*(W-A)
        print(''.join(tmp))
    
    for _ in range(H-B):
        tmp = ['1']*A + ['0']*(W-A)
        print(''.join(tmp))
    
if __name__ == "__main__":
    main()

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





H, W, A, B = getNM()

"""
0, ?の場合は対応可能

0 0 0 1 1
0 0 0 1 1
0 0 0 1 1
0 0 0 1 1
0 0 0 1 1

対応出来ないケース無さそう？
1, 2の場合は？

これは1, 2
1 1 1 1 0
1 1 1 1 0
0 0 0 0 1
0 0 0 0 1
0 0 0 0 1
"""

res = [[''] * W for i in range(H)]

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

Solution (Python):






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





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

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

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

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

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

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

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

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'

for i in range(h):
  print (''.join(s[i]))

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

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

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

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

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

for a in ans:
    for n in a:
        print(n,end='')
    print()

Solution (Python):

def resolve():
    H, W, A, B = map(int, input().split())
    G = [[0] * W for _ in range(H)]

    for i in range(B):
        for j in range(A):
            G[i][j] = 1

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

    for g in G:
        print(*g, sep="")


if __name__ == "__main__":
    resolve()

Solution (Python):

def resolve():
    H, W, A, B = map(int, input().split())
    G = [[0] * W for _ in range(H)]

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


if __name__ == "__main__":
    resolve()

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

Solution (Python):

import sys

sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


sys.setrecursionlimit(10**7)
import math








INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def run():
    H, W, A, B = map(int, sysread().split())
    MAP = [[0] * W for _ in range(H)]


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


    for m in MAP:
        print(''.join([str(s) for s in m]))

if __name__ == "__main__":
    run()

Solution (Python):
import sys, math
from functools import lru_cache
from collections import defaultdict
from decimal import Decimal
sys.setrecursionlimit(10**9)
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    H, W, A, B = mi()
    ans = [[None]*W for i in range(H)]
    for i in range(B):
        for j in range(A):
            ans[i][j] = '0'
        for j in range(A, W):
            ans[i][j] = '1'
    for i in range(B, H):
        for j in range(A):
            ans[i][j] = '1'
        for j in range(A, W):
            ans[i][j] = '0'

    print(*[''.join(ans[i]) for i in range(H)], sep='\n')

if __name__ == '__main__':
    main()

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

Solution (Python):
H, W, A, B = list(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())

if W//2 < A or H//2 < B:
    print("No")
    exit(0)

ans = [[0 for _ in range(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

for j in range(H):
    print("".join(str(x) for x in ans[j]))

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:
            print(0, end="")
        elif i >= b and j < a:
            print(1, end="")
        elif i < b and j >= a:
            print(1, end="")
        else:
            print(0, end="")
    print()

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

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

for r in range(h):
    for c in range(w):
        if (0<=r<b and 0<=c<a) or (b<=r<h and a<=c<w):
            ans[r][c]+=1
    
    print(''.join([str(c) for c in ans[r]]))

Solution (Python):


import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    h, w, a, b = input_int_list()
    grid = []
    for i in range(h):
        if i < b:
            grid.append("1" * a + "0" * (w - a))
        else:
            grid.append("0" * a + "1" * (w - a))
    for line in grid:
        print(line)

    return


if __name__ == "__main__":
    main()

Solution (Python):
h,w,a,b=map(int,input().split())
for i in range(h):
  print("".join(map(str,[((i<b)+(j<a))%2 for j in range(w)])))

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,l1,l2=list(map(int,input().split()))
import numpy as np
l=np.zeros((H,W))
if l2>0:
   l[0:l2,l1:]=1
if l1>0:
   l[l2:,0:l1]=1
for i in l:
   print(*list(map(int,i)),sep="")

Solution (Python):
import sys

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

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

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


H,W,A,B = MI()
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 LI():
    return list(map(int, input().split()))


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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

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

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

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

Solution (Python):
def main(H,W,A,B):
    ans = [[] for _ in range(H)]
    
    cntB = 0
    for i in range(H):
        cntB += 1
        cntA = 1
        for j in range(W):
            if cntB <= B:
                if cntA <= A:
                    ans[i].append(0)
                    cntA += 1
                else:
                    ans[i].append(1)
            else:
                if cntA <= A:
                    ans[i].append(1)
                    cntA += 1
                else:
                    ans[i].append(0)
    return ans

H,W,A,B = map(int,input().split())
ans = main(H,W,A,B)
for i in range(H):
    tmp = ans[i]
    tmp = map(str,tmp)
    print(''.join(tmp))

Solution (Python):
H,W,A,B = map(int,input().split())
C = [["0" for _ in range(W)] for _ in range(H)]
for i in range(H-B):
    for j in range(A,W):
        C[i][j] = "1"
for i in range(H-B,H):
    for j in range(A):
        C[i][j] = "1"
for i in range(H):
    print("".join(C[i]))

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

G = [['0'] * W for _ in range(H)]
for h in range(H - B):
    for w in range(W - A):
        G[h][w] = '1'
for h in range(H - B, H):
    for w in range(W - A, W):
        G[h][w] = '1'

for row in G:
    print(''.join(row))

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

s = [["1"] * a + ["0"] * (w - a) for _ in range(b)] + [["0"] * a + ["1"] * (w - a) for _ in range(h - b)]

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w,a,b = inpl()
for i in range(h):
    res = []
    tmp = 0 if i < b else 1
    for j in range(w):
        if j < a:
            res.append(str(tmp))
        else:
            res.append(str(tmp^1))
    print(''.join(res))

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

ansl = [[-1]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if i < b and j < a:
            ansl[i][j] = '0'
        elif i >= b and j >= a:
            ansl[i][j] = '0'
        else:
            ansl[i][j] = '1'

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  


H,W,A,B = MI()
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):
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):
  for j in range(w):
    print(int((i<b)^(j<a)), end="")
  print()

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

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

Solution (Python):
from itertools import chain

def solve(H,W,A,B):

    return '\n'.join(chain(('1'*A+'0'*(W-A) for _ in range(B)), ('0'*A+'1'*(W-A) for _ in range(H-B))))




if __name__ == '__main__':
    H,W,A,B = map(int,input().split())
    print(solve(H,W,A,B))

Solution (Python):
H,W,A,B=map(int,input().split())
ans=[]
for h in range(H):
    if h<B:
        ans.append("0"*A+"1"*(W-A))
    else:
        ans.append("1"*A+"0"*(W-A))

for a in ans:
    print(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 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())
ans = [[0 for w in range(W)] for h in range(H)]
for i in range(B):
    for j in range(A):
        ans[i][j] = 1
    print(''.join(map(str, ans[i])))
for i in range(B, H):
    for j in range(A, W):
        ans[i][j] = 1
    print(''.join(map(str, ans[i])))

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

X="".join(map(str,[1]*A+[0]*(W-A)))+"\n"
Y="".join(map(str,[0]*A+[1]*(W-A)))+"\n"

print((X*B+Y*(H-B))[:-1])

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):
import numpy as np


def main():
    H, W, A, B = map(int, input().split())
    s = np.zeros((H, W), dtype=np.int64)
    s[:B, :A] = 1
    s[B:, A:] = 1
    
    for l in s:
        print(*l, sep='')


if __name__ == "__main__":
    main()

Solution (Python):
H,W,A,B = map(int,input().split())
X = ''.join(['0']*A+['1']*(W-A))
Y = ''.join(['1']*A+['0']*(W-A))
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())

grid_1 = [0] * A + [1] * (W - A)
grid_2 = [1] * A + [0] * (W - A)

for i in range(B):
    print(*grid_1, sep='')
for i in range(H - B):
    print(*grid_2, sep='')

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

Solution (Python):
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    h, w, a, b = mi()
    g = np.zeros((h, w), dtype=int)
    g[:b, :a] = 1
    g[b:, a:] = 1
    for i in range(h):
        print(*g[i], sep='')


if __name__ == '__main__':
    main()

Solution (Python):
H, W, A, B = map(int, input().split())
L = [[0 for __ in range(W)] for _ in range(H)]
for i in range(B):
  for j in range(A):
    L[i][j] = 1
for i in range(B, H):
  for j in range(A, W):
    L[i][j] = 1
for i in range(H):
  for j in range(W):
    print(L[i][j], end = '')
  print()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    H, W, A, B = map(int, readline().split())
    L = [[0]*W for _ in range(H)]
    for h in range(B):
        for w in range(A,W):
            L[h][w] = 1
    for h in range(B,H):
        for w in range(A):
            L[h][w] = 1
    for l in L:
        print(''.join(map(str,l)))
    


if __name__ == '__main__':
    main()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W, A, B = LI()

    ans = [['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:
                ans[i][j] = '1'

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

if __name__ == '__main__':
    resolve()

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

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

list_s = [0 for i in range(a)]
list_t = [1 for i in range(a)]

while len(list_s) != w:
    list_s.append(1)
    list_t.append(0)

s = ''.join(map(str, list_s))
t = ''.join(map(str, list_t))

for i in range(h):
    if i < b:
        print(s)
    else:
        print(t)

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

for i in range(h):
    if i >= h-b:
        for j in range(w-a,w):
            ans[i][j] = 1
    else:
        for j in range(w-a):
            ans[i][j] = 1
for i in ans:
    print(*i,sep="")

Solution (Python):
import sys
from collections import defaultdict, deque, Counter
import math


from bisect import bisect_left, bisect_right
import heapq

sys.setrecursionlimit(1000000)


input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def fact_and_inv(SIZE):
    inv = [0] * SIZE  
    fac = [0] * SIZE  
    finv = [0] * SIZE  
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

class TwoDimGrid:
    
    def __init__(self, h, w, wall="
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid

    def pos(self, x, y):
        return y * (self.w + 2) + x + 1

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]

        ans = 0
        for i in range(1, self.h + 1):
            for j in range(1, self.w + 1):
                pass 

def solve():
    h, w, a, b = getList()
    if a > w // 2 or b > h // 2:
        print("No")
        return

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



def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    
    solve()

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def cell(i, j, A, B):
    if (i < A and j < B) or (i >= A and j >= B):
        return '1'
    return '0'


def solve():
    H, W, A, B = read_ints()
    print('\n'.join([
        ''.join([cell(i, j, A, B) for i in range(W)]) for j in range(H)
    ]))



if __name__ == '__main__':
    solve()

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

if A == 0 and B == 0:
  for _ in range(H):
    print("".join("0" * W))
  exit(0)
  
ANS = []
cnt = B
roll = 0
for i in range(B):
  wk = ["1"] * A + ["0"] * (W-A)
  ANS.append(wk)
for i in range(H-B):
  wk = ["0"] * A + ["1"] * (W-A)
  ANS.append(wk)
  
for ans in ANS:
  print("".join(ans))

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, a, b = MAP()

s = [[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 ):
            s[i][j] = 1

for i in range(h):
    print(*s[i][:], sep="")

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, a, b = MAP()

for i in range(h+1):
    for j in range(w+1):
        if a*i + (w-a)*(h-i) == b*j + (h-b)*(w-j):
            aa = i
            bb = j
            break
    else:
        continue
    break

s = [[0]*w for i in range(h)]
sum = [0]*w

for i in range(h):
    tmp = 0
    for j in range(w):
        if ( i < aa and tmp < a ) or ( i >= aa and tmp < w-a ):
            if ( j < bb and sum[j] < b ) or ( j >= bb and sum[j] < h-b ):
               s[i][j] = 1
               tmp += 1
               sum[j] += 1

for i in range(h):
    print(*s[i][:], sep="")

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

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 = list(map(int,input().split()))
M = [[0]*W for _ in range(H)]



for ih in range(H):
    for iw in range(W):
        if (ih<B and iw <A) or (ih>=B and iw >= A):
            M[ih][iw] = 1
for i in range(H):
    print(''.join(list(map(str,M[i]))))

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    h, w, a, b = map(int, readline().split())
    grid = [["0"] * w for _ in range(h)]

    for row in range(h):
        for col in range(w):
            c = 0
            if row < b:
                c ^= 1
            if col < a:
                c ^= 1
            grid[row][col] = str(c)

    for i in range(h):
        print("".join(grid[i]))


if __name__ == '__main__':
    main()

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sin
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

h,w,a,b=MI()
lis=[[0]*w for i in range(h)]
for i in range(b):
    for j in range(w):
        if j<a:
            lis[i][j]=1
        else:
            lis[i][j]=0

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

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

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

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

Solution (Python):
def solve(h, w, a, b):
    A = [[0]*w for _ in range(h)]
    for r in range(b):
        for c in range(a):
            A[r][c] = 1
    for r in range(b, h):
        for c in range(a, w):
            A[r][c] = 1
    return "\n".join(["".join(map(str, A[r])) for r in range(h)])

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

H, W, A, B = MAP()

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

H, W, A, B = MAP()

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
		if A <= x and B <= y:
			ans[y][x] = 1

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

Solution (Python):
def main():
  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) or (i >= B and j >= A):
        ans[i][j] = '1'
  for i in range(H):
    print(''.join(ans[i]))
    
if __name__ == "__main__":
  main()

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

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

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 (w-a<=j and h-b>i) or (w-a>j and h-b<=i):
            ans[i][j] = "1"
for i in range(h):
    print("".join(ans[i]))