The Looksery company, consisting of *n* staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts about how cool it is. At the same time everyone is trying to spend as much time on the fun as possible, so they send messages to everyone without special thinking, moreover, each person even sends a message to himself or herself.

Igor and Max, Looksery developers, started a dispute on how many messages each person gets. Igor indicates *n* numbers, the *i*-th of which indicates how many messages, in his view, the *i*-th employee is going to take. If Igor guesses correctly at least one of these numbers, he wins, otherwise Max wins.

You support Max in this debate, so you need, given the contact lists of the employees, to determine whether there is a situation where Igor loses. Specifically, you need to determine which employees should come to the party, and which should not, so after all the visitors send messages to their contacts, each employee received a number of messages that is different from what Igor stated.
The first line contains a single integer *n* (1 ≤ *n* ≤ 100) — the number of employees of company Looksery.

Next *n* lines contain the description of the contact lists of the employees. The *i*-th of these lines contains a string of length *n*, consisting of digits zero and one, specifying the contact list of the *i*-th employee. If the *j*-th character of the *i*-th string equals 1, then the *j*-th employee is in the *i*-th employee's contact list, otherwise he isn't. It is guaranteed that the *i*-th character of the *i*-th line is always equal to 1.

The last line contains *n* space-separated integers: *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *n*), where *a*<sub class="lower-index">*i*</sub> represents the number of messages that the *i*-th employee should get according to Igor.
n=int(input().strip())

nums=['']+[' '+input().strip() for _ in range(n)]
a=[0]+list(map(int,input().split()))


def send(x):
    for i in range(1,n+1):
        if nums[x][i]=='1':
            a[i]-=1

vis=[0]*(n+1)
while True:
    for i in range(1,n+1):
        if not vis[i] and not a[i]:
            vis[i]=1
            send(i)
            break
    else:
        for i in range(1,n+1):
            if not a[i]:
                print(-1)
                exit()
        break


ans=[]
for i in range(1,n+1):
    if vis[i]:
        ans.append(i)

if ans:
    print(len(ans))
    print(*ans)
else:
    print(0)
