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;
bool vis[20][32][11][11][11][11][11];
bool dp[20][32][11][11][11][11][11];
int r[25], c[25], R, C;
bool dp_func(int row, int prv, int col1, int col2, int col3, int col4,
             int col5);
inline bool check(int mask, int pos) { return (bool)(mask & (1 << pos)); }
int ou[25];
bool rec(int row, int prv, int col1, int col2, int col3, int col4, int col5,
         int pos, int ager, int seg) {
  if (seg > r[row]) return 0;
  if (pos == C) {
    if (seg == r[row])
      return dp_func(row + 1, prv, col1, col2, col3, col4, col5);
    return 0;
  }
  int tmp[] = {col1, col2, col3, col4, col5};
  int ret = 0;
  if (check(prv, pos)) {
    ret |= rec(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 1,
               seg + (ager == 0));
    if (ret) return 1;
    ret |= rec(row, prv ^ (1 << pos), tmp[0], tmp[1], tmp[2], tmp[3], tmp[4],
               pos + 1, 0, seg);
    return ret;
  }
  ret |= rec(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 0, seg);
  if (ret) return 1;
  if (c[pos] == tmp[pos]) return 0;
  tmp[pos]++;
  ret |= rec(row, prv | (1 << pos), tmp[0], tmp[1], tmp[2], tmp[3], tmp[4],
             pos + 1, 1, seg + (ager == 0));
  return ret;
}
bool dp_func(int row, int prv, int col1, int col2, int col3, int col4,
             int col5) {
  if (row == R) {
    if (col1 == c[0] && col2 == c[1] && col3 == c[2] && col4 == c[3] &&
        col5 == c[4])
      return 1;
    return 0;
  }
  if (vis[row][prv][col1][col2][col3][col4][col5])
    return dp[row][prv][col1][col2][col3][col4][col5];
  vis[row][prv][col1][col2][col3][col4][col5] = 1;
  bool d = rec(row, prv, col1, col2, col3, col4, col5, 0, 0, 0);
  return dp[row][prv][col1][col2][col3][col4][col5] = d;
}
void path(int row, int prv, int col1, int col2, int col3, int col4, int col5,
          int pos, int ager, int seg) {
  if (seg > r[row]) assert(0);
  if (row == R) return;
  if (pos == C) {
    if (seg == r[row] && dp_func(row + 1, prv, col1, col2, col3, col4, col5)) {
      path(row + 1, prv, col1, col2, col3, col4, col5, 0, 0, 0);
      ou[row] |= prv;
      return;
    }
    assert(0);
  }
  int tmp[] = {col1, col2, col3, col4, col5};
  int ret = 0;
  if ((bool)(prv & (1 << pos))) {
    ret |= rec(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 1,
               seg + (ager == 0));
    if (ret == 1) {
      path(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 1,
           seg + (ager == 0));
      return;
    }
    path(row, prv ^ (1 << pos), tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1,
         0, seg);
    return;
  }
  ret |= rec(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 0, seg);
  if (ret) {
    path(row, prv, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1, 0, seg);
    return;
  }
  tmp[pos]++;
  path(row, prv | (1 << pos), tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], pos + 1,
       1, seg + (ager == 0));
}
int main() {
  int i, j, k, l, m, n;
  scanf("%d%d", &R, &C);
  swap(R, C);
  for (int i = 0; i < C; i++) scanf("%d", &c[i]);
  for (int i = 0; i < R; i++) scanf("%d", &r[i]);
  int d = dp_func(0, 0, 0, 0, 0, 0, 0);
  path(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < R; j++) {
      if (check(ou[j], i))
        printf("*");
      else
        printf(".");
    }
    printf("\n");
  }
}