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;
int n, m, a[25], b[25], ret[25][25], change[32][32], p[6];
char dp[25][32][161051], trace1[25][32][161051];
vector<char> state[25];
inline void Trace() {
  int rmask2 = 0;
  for (int i = n - 1; i >= 0; --i) rmask2 = rmask2 * 11 + a[i];
  int rmask1;
  for (rmask1 = 0; rmask1 < (1 << n); ++rmask1)
    if (dp[m - 1][rmask1][rmask2]) break;
  int j = m - 1;
  while (j >= 0) {
    int tmp1 = trace1[j][rmask1][rmask2];
    int tmp2 = rmask2 - change[rmask1][tmp1];
    for (int i = 0; i < n; ++i)
      if (rmask1 & (1 << i))
        ret[i][j] = 1;
      else
        ret[i][j] = 0;
    rmask1 = tmp1;
    rmask2 = tmp2;
    --j;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &b[i]);
  p[0] = 1;
  for (int i = 1; i <= n; ++i) p[i] = p[i - 1] * 11;
  int SZ = 1;
  for (int i = 0; i < n; ++i) SZ *= 11;
  for (int j = 0; j < m; ++j)
    for (int mask = 0; mask < (1 << n); ++mask) {
      int cnt = 0;
      for (int i = 0; i < n; ++i) {
        if ((i == 0 && ((mask >> i) & 1)) ||
            (((mask >> i) & 1) && !((mask >> (i - 1)) & 1)))
          ++cnt;
      }
      if (cnt != b[j]) continue;
      state[j].push_back(mask);
    }
  for (int mask1 = 0; mask1 < (1 << n); ++mask1)
    for (int mask2 = 0; mask2 < (1 << n); ++mask2) {
      int cnt = 0;
      for (int i = 0; i < n; ++i)
        if (((mask1 >> i) & 1) & !((mask2 >> i) & 1))
          change[mask1][mask2] += p[i];
    }
  for (int t = 0; t < state[0].size(); ++t)
    for (int mask2 = 0; mask2 < SZ; ++mask2) {
      int mask1 = state[0][t];
      int c[n];
      int tmp = mask2;
      bool ok = 1;
      for (int i = 0; i < n; ++i) {
        c[i] = tmp % 11, tmp /= 11;
        if (c[i] != ((mask1 >> i) & 1)) {
          ok = 0;
          break;
        }
      }
      if (!ok) continue;
      dp[0][mask1][mask2] = 1;
    }
  for (int j = 1; j < m; ++j)
    for (int t = 0; t < state[j].size(); ++t)
      for (int mask2 = 0; mask2 < SZ; ++mask2) {
        int mask1 = state[j][t];
        for (int tb = 0; tb < state[j - 1].size(); ++tb) {
          int bmask1 = state[j - 1][tb];
          int bmask2 = mask2 - change[mask1][bmask1];
          if (bmask2 < 0) continue;
          if (dp[j - 1][bmask1][bmask2]) {
            dp[j][mask1][mask2] |= dp[j - 1][bmask1][bmask2];
            trace1[j][mask1][mask2] = bmask1;
          }
        }
      }
  Trace();
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j)
      if (ret[i][j])
        printf("*");
      else
        printf(".");
    puts("");
  }
}