Buggy python submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split())

if A==0 and B==0:
    for i in range(H):
        ans=["1"]*W
        print("".join(ans))
        exit()
elif A==0:
    ans = ["1"] * W
    for i in range(B):
        print("".join(ans))
    ans=["0"]*W
    for i in range(H-B):
        print("".join(ans))
elif B==0:
    ans1 = ["1"] * A
    ans2 = ["0"] * (W - A)
    for i in range(H):
        ans1.extend(ans2)
        print("".join(ans1))
elif W%A==0 and H%B==0 and W//A==H//B:
    for j in range(H//B):
        ans=[]
        for i in range(W//A):
            if i==j:
                temp=["1"]*A
                ans.extend(temp)
            else:
                temp=["0"]*A
                ans.extend(temp)
        for k in range(B):
            print("".join(ans))
else:
    print("No")

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

if A == 0 and B == 0:
    for i in range(H):
        ans = ["1"] * W
        print("".join(ans))
elif A == 0:
    for i in range(B):
        ans=[]
        temp = ["1"] * W
        ans.extend(temp)
        print("".join(ans))
    for i in range(H - B):
        ans=[]
        temp = ["0"] * W
        ans.extend(temp)
        print("".join(ans))
elif B == 0:
    for i in range(H):
        ans1=[]
        ans1 = ["1"] * A
        ans2 = ["0"] * (W - A)
        ans1.extend(ans2)
        print("".join(ans1))
else:
    for i in range(B):
        ans1 = ["1"]*A
        ans2=["0"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))
    for i in range(H-B):
        ans1=["0"]*A
        ans2=["1"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))

Buggy python submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split())

if A==0 and B==0:
    for i in range(H):
        ans=["1"]*W
        print("".join(ans))
        exit()
elif A==0:
    ans = ["1"] * W
    for i in range(B):
        print("".join(ans))
    ans=["0"]*W
    for i in range(H-B):
        print("".join(ans))
elif B==0:
    ans1 = ["1"] * A
    ans2 = ["0"] * (W - A)
    for i in range(H):
        ans1.extend(ans2)
        print("".join(ans1))
elif W%A==0 and H%B==0:
    for j in range(H//B):
        ans=[]
        for i in range(W//A):
            if i==j:
                temp=["1"]*A
                ans.extend(temp)
            else:
                temp=["0"]*A
                ans.extend(temp)
        for k in range(B):
            print("".join(ans))
else:
    print("No")

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

if A == 0 and B == 0:
    for i in range(H):
        ans = ["1"] * W
        print("".join(ans))
elif A == 0:
    for i in range(B):
        ans=[]
        temp = ["1"] * W
        ans.extend(temp)
        print("".join(ans))
    for i in range(H - B):
        ans=[]
        temp = ["0"] * W
        ans.extend(temp)
        print("".join(ans))
elif B == 0:
    for i in range(H):
        ans1=[]
        ans1 = ["1"] * A
        ans2 = ["0"] * (W - A)
        ans1.extend(ans2)
        print("".join(ans1))
else:
    for i in range(B):
        ans1 = ["1"]*A
        ans2=["0"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))
    for i in range(H-B):
        ans1=["0"]*A
        ans2=["1"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))