Vouchers

No attempts yetTime limit3sMemory limit128 MB

Problem

A candy shop sells caramel candies. For every positive integer cc there is exactly one package that contains exactly cc candies, so the packages have sizes 1,2,3,1, 2, 3, \dots, one package of each size, and no new deliveries will arrive.

To reward customers, the owner has hidden mm vouchers, each good for a year's supply of chocolate. Each voucher is placed in a different package (at most one voucher per package); the kk-th voucher sits in the package of size bkb_k.

The town's carnival lasts nn days. On day kk a party with aka_k guests is held. On the morning of day kk, each of those aka_k guests buys the smallest package still on sale whose candy count is divisible by aka_k, so that it can be split evenly among the aka_k guests. Because there are aka_k guests, day kk removes the aka_k smallest still-available packages whose size is a multiple of aka_k, in increasing order of size.

Customers are numbered 1,2,3,1, 2, 3, \dots across the whole carnival in the order they buy: all of an earlier day's buyers come before a later day's, and within one day the buyer of a smaller package gets the smaller number.

For example, with n=2n = 2, a1=4a_1 = 4, a2=2a_2 = 2, on day 1 the packages of 4,8,12,164, 8, 12, 16 candies are sold, and on day 2 the packages of 22 and 66 candies are sold.

Determine which customers end up buying a package that holds a voucher.

Input

The first line contains an integer mm (1m1,000,0001 \le m \le 1{,}000{,}000), the number of vouchers.

Each of the next mm lines contains an integer bkb_k (1bk1,000,0001 \le b_k \le 1{,}000{,}000), the size (number of candies) of the package holding the kk-th voucher. The values bkb_k are given in strictly increasing order.

The next line contains an integer nn (1n1,000,0001 \le n \le 1{,}000{,}000), the number of carnival days.

Each of the next nn lines contains an integer aka_k (1ak1,000,0001 \le a_k \le 1{,}000{,}000), the number of guests at the party on day kk.

Output

Print an integer zz on the first line: the number of vouchers that are sold.

On the next zz lines print, in increasing order, the numbers of the customers who bought a package containing a voucher. If z=0z = 0, print only the first line.