beecrowd | 2946

Dabriel and the Divisibility

By Gabriel Duarte, UFF BR Brazil

Timelimit: 1

Dabriel loves to play with numbers and this time has a very interesting game. It has a binary number N and a list with M numbers and you want to know for which numbers Mi from that list N is divisible.
This task is very easy for him, so you will not waste time doing this, can you help him?

Input

The first line contains a number in binary N (1 ≤ |N| ≤ 105). In the second line contains an integer M (1 ≤ M ≤ 10), which represents how many numbers one wants to know the divisibility. In the next M lines, it will have an integer Mi (1 ≤ Mi ≤ 105), where Mi is the number Dabriel wants to know if it divides N.

Output

Print out all the numbers that divide N from the list given by Dabriel (as he is a little inattentive there may be duplicates in his list, so print out all), separated by a space, ordered in ascending order. If no number exists, print: "Nenhum", without quotation marks.

Input Samples Output Samples

1011
2
5
2

Nenhum

1100
6
1
7
2
6
5
4

1 2 4 6