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>
char str[100][100];
int len[32], adj[32][32];
int n, m, lim, row[5], col[20];
bool visited[20][32][11][11][11][11][11] = {false},
     dp[20][32][11][11][11][11][11];
bool F(int j, int lbit, int ar[5]) {
  if (ar[0] < 0 || ar[1] < 0 || ar[2] < 0 || ar[3] < 0 || ar[4] < 0)
    return false;
  if (j == m) return (!ar[0] && !ar[1] && !ar[2] && !ar[3] && !ar[4]);
  if (visited[j][lbit][ar[0]][ar[1]][ar[2]][ar[3]][ar[4]])
    return dp[j][lbit][ar[0]][ar[1]][ar[2]][ar[3]][ar[4]];
  bool res = false;
  int i, k, bitmask, cur = col[j], T[5] = {0};
  for (k = 0; k < len[cur]; k++) {
    bitmask = adj[cur][k];
    T[0] = ar[0], T[1] = ar[1], T[2] = ar[2], T[3] = ar[3], T[4] = ar[4];
    for (i = 0; i < n; i++) {
      if ((bitmask & (1 << i)) && !(lbit & (1 << i))) T[i]--;
    }
    res |= F(j + 1, bitmask, T);
    if (res) break;
  }
  visited[j][lbit][ar[0]][ar[1]][ar[2]][ar[3]][ar[4]] = true;
  return (dp[j][lbit][ar[0]][ar[1]][ar[2]][ar[3]][ar[4]] = res);
}
void backtrack(int j, int lbit, int ar[5]) {
  bool res = false;
  int i, k, bitmask, cur = col[j], T[5] = {0};
  if (j) {
    for (i = 0; i < n; i++) {
      if (lbit & (1 << i))
        str[i][j - 1] = '*';
      else
        str[i][j - 1] = '.';
    }
    if (j == m) {
      for (i = 0; i < n; i++) str[i][j] = 0;
      return;
    }
  }
  for (k = 0; k < len[cur]; k++) {
    bitmask = adj[cur][k];
    T[0] = ar[0], T[1] = ar[1], T[2] = ar[2], T[3] = ar[3], T[4] = ar[4];
    for (i = 0; i < n; i++) {
      if ((bitmask & (1 << i)) && !(lbit & (1 << i))) T[i]--;
    }
    res |= F(j + 1, bitmask, T);
    if (res) {
      backtrack(j + 1, bitmask, T);
      return;
    }
  }
}
int main() {
  int i, j, k, l, c, x, bitmask, ar[5] = {0};
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &row[i]);
    for (i = 0; i < m; i++) scanf("%d", &col[i]);
    memset(len, 0, sizeof(len));
    lim = (1 << n) - 1;
    for (bitmask = 0; bitmask <= lim; bitmask++) {
      c = 0, l = 0;
      for (i = 0; i < 5; i++) {
        if ((bitmask & (1 << i)) && !l) c++;
        if (bitmask & (1 << i))
          l = 1;
        else
          l = 0;
      }
      adj[c][len[c]++] = bitmask;
    }
    memset(ar, 0, sizeof(ar));
    for (i = 0; i < n; i++) ar[i] = row[i];
    backtrack(0, 0, ar);
    for (i = 0; i < n; i++) puts(str[i]);
  }
  return 0;
}