Problem: In this task you have to write a program dealing with nonograms on fields no larger than 5 × 20.

Simplified nonogram is a task where you have to build such field (each cell is either white or black) that satisfies the given information about rows and columns. For each row and each column the number of contiguous black segments is specified. 

For example if size of the field is n = 3, m = 5, аnd numbers of contiguous black segments in rows are: [2, 3, 2] and in columns are: [1, 0, 1, 2, 1] then the solution may look like:

<image>

It is guaranteed that on each test in the testset there exists at least one solution.

Input

In the first line there follow two integers n, m (1 ≤ n ≤ 5, 1 ≤ m ≤ 20) — number of rows and number of columns respectively.

Second line contains n integers a1, a2, ..., an where ai is the number of contiguous black segments in i-th row of the field. 

Similarly, third line contains m integers b1, b2, ..., bm where bi is the number of contiguous black segments in the i-th column of the field.

It is guaranteed that there exists at least one solution.

Output

Output any possible solution. Output should consist of n lines each containing m characters. Denote white cell as "." and black cell as "*".

Examples

Input

3 5
2 3 2
1 0 1 2 1


Output

*.**.
*.*.*
*..**

Input

3 3
2 1 2
2 1 2


Output

*.*
.*.
*.*


Input

3 3
1 0 1
2 2 2


Output

***
...
***

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 5, M = 20, P = 11 * 11 * 11 * 11 * 11 + 10;
int n, m, a[N], b[M];
short bk[M][1 << N][P], diff[1 << N][1 << N];
char ans[N][M];
vector<int> vec[M];
short part(int mask) {
  short res = 0;
  for (int i = 1; i <= n; i++)
    if ((mask & (1 << i)) == 0 && (mask & (1 << (i - 1)))) res++;
  return res;
}
int change_base(int mask) {
  int res = 0;
  for (int i = 0, p = 1; i < n; i++, p *= 10)
    if (mask & (1 << i)) res += p;
  return res;
}
short dif(int a, int b) {
  short res = 0;
  for (int i = 0, p = 1; i < n; i++, p *= 10)
    if ((a & (1 << i)) - (b & (1 << i)) > 0) res += p;
  return res;
}
int main() {
  cin >> n >> m;
  for (int mask = 0; mask < (1 << n); mask++) vec[part(mask)].push_back(mask);
  for (int i = 0; i < (1 << n); i++)
    for (int j = 0; j < (1 << n); j++) diff[i][j] = dif(i, j);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < m; i++)
    for (int mask = 0; mask < (1 << n); mask++)
      for (int j = 0; j < P; j++) bk[i][mask][j] = -1;
  for (int mask : vec[b[0]]) bk[0][mask][change_base(mask)] = 1;
  for (int i = 1; i < m; i++) {
    for (int mask_2 : vec[b[i]])
      for (int mask_10 = 0; mask_10 < P; mask_10++)
        for (int mask_last : vec[b[i - 1]])
          if (mask_10 - diff[mask_2][mask_last] >= 0 &&
              bk[i - 1][mask_last][mask_10 - diff[mask_2][mask_last]] != -1) {
            bk[i][mask_2][mask_10] = mask_last;
            break;
          }
  }
  int mask_2 = 0, mask_10 = 0;
  for (int i = 0, p = 1; i < n; i++, p *= 10) mask_10 += a[i] * p;
  for (;; mask_2++)
    if (bk[m - 1][mask_2][mask_10] != -1) break;
  for (int i = m - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++)
      if (mask_2 & (1 << j))
        ans[j][i] = '*';
      else
        ans[j][i] = '.';
    int help = bk[i][mask_2][mask_10];
    mask_10 -= dif(mask_2, bk[i][mask_2][mask_10]);
    mask_2 = help;
  }
  for (int i = 0; i < n; i++, cout << '\n')
    for (int j = 0; j < m; j++) cout << ans[i][j];
  return 0;
}