QOJ.ac

QOJ

Time Limit: 3.5 s Memory Limit: 64 MB Total points: 100

#13301. Vouchers

Statistics

The candy shop owned by Byteasar sells delicious caramel candy. For every positive integer there is exactly one package that contains c candies; currently no new deliveries are expected. To encourage customers to buy the sweets, Byteasar has planted m vouchers for an annual supply of chocolate into some packages, making sure to put at most one voucher in each package.

The carnival starts next week in Byteburg, and it will last n days; on the k-th day of the carnival a party with a_{k} guests will be held. Byteasar is confident that on the k-th day's morning each of those guests is going to buy, in his own store, the smallest package of candy available whose content can be equally distributed between the party guests. For example, if n=2, a_{1}=4, a_{2}=2, then on the first day of the carnival he expects to sell the packages containing four, eight, twelve, and sixteen candies, selling those with two and six candies on the second day.

Now he is wondering which customers will end up with the packages holding the vouchers. He has asked you to write a program that will determine this for him.

Input Format

On the first line of the standard input there is a single integer m (1 ≤ m ≤ 1,000,000) that denotes the number of vouchers. The k-th of the m lines that follow holds an integer b_{k} (1 ≤ b_{k} ≤ 1,000,000) denoting the size (i.e., the number of candies inside) of a package in which Byteasar has placed the k-th voucher. These numbers are given in an increasing order.

Then the next line contains a single integer n (1 ≤ n ≤ 1,000,000) that denotes the number of carnival days. The k-th of the n lines that follow holds an integer a_{k} (1 ≤ a_{k} ≤ 1,000,000) denoting the number of guests attending the k-th party.

Output Format

In the first line of the standard output your program should print an integer z - the number of packages with vouchers sold. The following z lines should specify the numbers of those customers who bought a package with a voucher, in an increasing order. The customers are numbered from 1 in the order of their purchases.

Example

Input

4
1
6
8
16
3
4
2
4

Output

3
2
4
6
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.