#D11348. by-M grid calculation

    ID: 9437 Type: Default 2000ms 536MiB

by-M grid calculation

by-M grid calculation

Problem Statement

Have you experienced 1010-by-1010 grid calculation? It's a mathematical exercise common in Japan. In this problem, we consider the generalization of the exercise, NN-by-MM grid calculation.

In this exercise, you are given an NN-by-MM grid (i.e. a grid with NN rows and MM columns) with an additional column and row at the top and the left of the grid, respectively. Each cell of the additional column and row has a positive integer. Let's denote the sequence of integers on the column and row by aa and bb, and the ii-th integer from the top in the column is aia_i and the jj-th integer from the left in the row is bjb_j, respectively.

Initially, each cell in the grid (other than the additional column and row) is blank. Let (i,j)(i, j) be the cell at the ii-th from the top and the jj-th from the left. The exercise expects you to fill all the cells so that the cell (i,j)(i, j) has ai×bja_i \times b_j. You have to start at the top-left cell. You repeat to calculate the multiplication ai×bja_i \times b_j for a current cell (i,j)(i, j), and then move from left to right until you reach the rightmost cell, then move to the leftmost cell of the next row below.

At the end of the exercise, you will write a lot, really a lot of digits on the cells. Your teacher, who gave this exercise to you, looks like bothering to check entire cells on the grid to confirm that you have done this exercise. So the teacher thinks it is OK if you can answer the dd-th digit (not integer, see an example below), you have written for randomly chosen xx. Let's see an example.

For this example, you calculate values on cells, which are 88, 5656, 2424, 11, 77, 33 in order. Thus, you would write digits 8, 5, 6, 2, 4, 1, 7, 3. So the answer to a question 44 is 22.

You noticed that you can answer such questions even if you haven't completed the given exercise. Given a column aa, a row bb, and QQ integers d1,d2,,dQd_1, d_2, \dots, d_Q, your task is to answer the dkd_k-th digit you would write if you had completed this exercise on the given grid for each kk. Note that your teacher is not so kind (unfortunately), so may ask you numbers greater than you would write. For such questions, you should answer 'x' instead of a digit.


Input

The input consists of a single test case formatted as follows.

NN MM a1a_1 \ldots aNa_N b1b_1 \ldots bMb_M QQ d1d_1 \ldots dQd_Q

The first line contains two integers NN (1N1051 \le N \le 10^5) and MM (1M1051 \le M \le 10^5), which are the number of rows and columns of the grid, respectively.

The second line represents a sequence aa of NN integers, the ii-th of which is the integer at the ii-th from the top of the additional column on the left. It holds 1ai1091 \le a_i \le 10^9 for 1iN1 \le i \le N.

The third line represents a sequence bb of MM integers, the jj-th of which is the integer at the jj-th from the left of the additional row on the top. It holds 1bj1091 \le b_j \le 10^9 for 1jM1 \le j \le M.

The fourth line contains an integer QQ (1Q3×1051 \le Q \le 3\times 10^5), which is the number of questions your teacher would ask.

The fifth line contains a sequence dd of QQ integers, the kk-th of which is the kk-th question from the teacher, and it means you should answer the dkd_k-th digit you would write in this exercise. It holds 1dk10151 \le d_k \le 10^{15} for 1kQ1 \le k \le Q.

Output

Output a string with QQ characters, the kk-th of which is the answer to the kk-th question in one line, where the answer to kk-th question is the dkd_k-th digit you would write if dkd_k is no more than the number of digits you would write, otherwise 'x'.

Examples

Input Output

2 3 8 1 1 7 3 5 1 2 8 9 1000000000000000

|

853xx

3 4 271 828 18 2845 90 45235 3 7 30 71 8 61 28 90 42

|

7x406x0

Example

Input

Output

inputFormat

Input

The input consists of a single test case formatted as follows.

NN MM a1a_1 \ldots aNa_N b1b_1 \ldots bMb_M QQ d1d_1 \ldots dQd_Q

The first line contains two integers NN (1N1051 \le N \le 10^5) and MM (1M1051 \le M \le 10^5), which are the number of rows and columns of the grid, respectively.

The second line represents a sequence aa of NN integers, the ii-th of which is the integer at the ii-th from the top of the additional column on the left. It holds 1ai1091 \le a_i \le 10^9 for 1iN1 \le i \le N.

The third line represents a sequence bb of MM integers, the jj-th of which is the integer at the jj-th from the left of the additional row on the top. It holds 1bj1091 \le b_j \le 10^9 for 1jM1 \le j \le M.

The fourth line contains an integer QQ (1Q3×1051 \le Q \le 3\times 10^5), which is the number of questions your teacher would ask.

The fifth line contains a sequence dd of QQ integers, the kk-th of which is the kk-th question from the teacher, and it means you should answer the dkd_k-th digit you would write in this exercise. It holds 1dk10151 \le d_k \le 10^{15} for 1kQ1 \le k \le Q.

outputFormat

Output

Output a string with QQ characters, the kk-th of which is the answer to the kk-th question in one line, where the answer to kk-th question is the dkd_k-th digit you would write if dkd_k is no more than the number of digits you would write, otherwise 'x'.

Examples

Input Output

2 3 8 1 1 7 3 5 1 2 8 9 1000000000000000

|

853xx

3 4 271 828 18 2845 90 45235 3 7 30 71 8 61 28 90 42

|

7x406x0

Example

Input

Output

样例