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 = 6 * 6 * 6 * 6 * 6 * 32;
int pre[11][N], suf[11][N];
int n, m, A[23], B[23];
int ds[32], DLT[32][32];
char mp[33][33];
inline int calc(int x, int y) {
  int _ = 1, res = 0;
  for (int i = 0; i < n; ++i) {
    if (!(x >> i & 1) && (y >> i & 1)) res += _;
    _ *= 6;
  }
  return res;
}
void out1(int S, int l) {
  if (!l) return;
  int t = S & 31;
  for (int i = 0; i < n; ++i)
    if (t >> i & 1)
      mp[i + 1][l] = '*';
    else
      mp[i + 1][l] = '.';
  out1(pre[l][S], l - 1);
}
void out2(int S, int l) {
  if (!l) return;
  int t = S & 31;
  for (int i = 0; i < n; ++i)
    if (t >> i & 1)
      mp[i + 1][m - l + 1] = '*';
    else
      mp[i + 1][m - l + 1] = '.';
  out2(suf[l][S], l - 1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", A + i);
  for (int i = 1; i <= m; ++i) scanf("%d", B + i);
  memset(pre, -1, sizeof pre);
  memset(suf, -1, sizeof suf);
  for (int t = 0; t < 1 << n; ++t) {
    int& f = ds[t];
    f = t & 1;
    for (int i = 1; i < n; ++i)
      if ((t >> i & 1) && !(t >> (i - 1) & 1)) ++f;
  }
  **pre = **suf = 0;
  for (int i = 0; i < 1 << n; ++i)
    for (int j = 0; j < 1 << n; ++j) DLT[i][j] = calc(i, j);
  for (int i = 1; i <= (m + 1) / 2; ++i) {
    for (int S = 0; S < N; ++S)
      if (pre[i - 1][S] != -1)
        for (int t = 0; t < 1 << n; ++t)
          if (ds[t] == B[i]) {
            int p = S >> 5, L = S & 31;
            int np = p + DLT[L][t];
            pre[i][np << 5 | t] = S;
          }
  }
  for (int i = 1; i <= m / 2; ++i) {
    for (int S = 0; S < N; ++S)
      if (suf[i - 1][S] != -1)
        for (int t = 0; t < 1 << n; ++t)
          if (ds[t] == B[m - i + 1]) {
            int p = S >> 5, L = S & 31;
            int np = p + DLT[L][t];
            suf[i][np << 5 | t] = S;
          }
  }
  for (int S = 0; S < N; ++S)
    if (pre[(m + 1) / 2][S] != -1) {
      int t = S >> 5, d = S & 31;
      int a[] = {A[1] - t % 6, A[2] - t / 6 % 6, A[3] - t / 36 % 6,
                 A[4] - t / 216 % 6, A[5] - t / 1296};
      for (int x = 0; x < 1 << n; ++x) {
        bool ok = 1;
        int b[] = {a[0], a[1], a[2], a[3], a[4]};
        for (int y = 0; y < n; ++y)
          if ((d >> y & 1) && (x >> y & 1)) ++b[y];
        for (int i = 0; i < n; ++i)
          if (b[i] < 0 || b[i] > 5) ok = 0;
        if (!ok) continue;
        int zt = (((b[4] * 6 + b[3]) * 6 + b[2]) * 6 + b[1]) * 6 + b[0];
        if (suf[m / 2][zt << 5 | x] != -1) {
          out1(S, (m + 1) / 2), out2(zt << 5 | x, m / 2);
          for (int i = 1; i <= n; ++i) puts(mp[i] + 1);
          return 0;
        }
      }
    }
  return 1;
}