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;
struct data {
  int prej, prek;
  data(int _prej = -1, int _prek = -1) : prej(_prej), prek(_prek) {}
};
typedef bool dpmat[12][7777][1 << 5];
typedef data tracemat[12][7777][1 << 5];
int n, m, a[6], b[21], c[21], cnt[1 << 5], tmp[12];
dpmat sdsdggeww4, vddgerdf;
tracemat tleft, tright;
char resl[6][12], resr[6][12];
int calc_newj(int x, int m1, int m2) {
  int nx = x, dm = m2 & (m1 ^ m2), pw = 1;
  for (int i = (0); i < (n); ++i) {
    if (((dm >> i) & 1)) nx += pw;
    pw *= 6;
  }
  return nx;
}
void calc(int lmt, dpmat dp, tracemat trace) {
  dp[0][0][0] = true;
  for (int i = (0); i < (lmt); ++i) {
    for (int j = (0); j < (7776); ++j)
      for (int k = (0); k < (1 << n); ++k)
        if (cnt[k] == c[i] && dp[i][j][k]) {
          for (int x = (0); x < (1 << n); ++x)
            if (cnt[x] == c[i + 1]) {
              int newj = calc_newj(j, k, x);
              dp[i + 1][newj][x] = true, trace[i + 1][newj][x] = data(j, k);
            }
        }
  }
}
void trace_ans(tracemat trace, int i, int j, int k, char res[][12]) {
  if (!i) return;
  for (int x = (0); x < (n); ++x)
    if (((k >> x) & 1) == 1)
      res[x + 1][i] = '*';
    else
      res[x + 1][i] = '.';
  trace_ans(trace, i - 1, trace[i][j][k].prej, trace[i][j][k].prek, res);
}
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]);
  for (int i = (0); i < (1 << n); ++i) {
    int pre = 0, cnt2 = 0;
    for (int j = (0); j < (n); ++j) {
      cnt2 += (((i >> j) & 1) && ((i >> j) & 1) != pre);
      pre = ((i >> j) & 1);
    }
    cnt[i] = cnt2;
  }
  for (int i = (1); i <= (m / 2); ++i) c[i] = b[i];
  calc(m / 2, sdsdggeww4, tleft);
  int ctmp = 0;
  for (int i = (m); i >= (m / 2 + 1); --i) c[++ctmp] = b[i];
  calc(ctmp, vddgerdf, tright);
  for (int j = (0); j < (7776); ++j)
    for (int mask1 = (0); mask1 < (1 << n); ++mask1)
      if (sdsdggeww4[m / 2][j][mask1]) {
        for (int mask2 = (0); mask2 < (1 << n); ++mask2) {
          int x = j;
          for (int k = (1); k <= (n); ++k) tmp[k] = x % 6, x /= 6;
          bool ok = true;
          for (int k = (0); k < (n); ++k) {
            if (tmp[k + 1] <= a[k + 1]) {
              if (((mask1 >> k) & 1) == 1 && ((mask2 >> k) & 1) == 1)
                tmp[k + 1] = a[k + 1] - tmp[k + 1] + 1;
              else
                tmp[k + 1] = a[k + 1] - tmp[k + 1];
            } else {
              ok = false;
              break;
            }
          }
          if (!ok) continue;
          for (int k = (1); k <= (n); ++k)
            if (tmp[k] > ctmp / 2 + ctmp % 2) {
              ok = false;
              break;
            }
          if (!ok) continue;
          int j2 = 0, pw = 1;
          for (int k = (1); k <= (n); ++k) j2 += pw * tmp[k], pw *= 6;
          if (!vddgerdf[ctmp][j2][mask2]) continue;
          trace_ans(tleft, m / 2, j, mask1, resl);
          trace_ans(tright, ctmp, j2, mask2, resr);
          for (int u = (1); u <= (n); ++u) {
            for (int v = (1); v <= (m / 2); ++v) putchar(resl[u][v]);
            for (int v = (ctmp); v >= (1); --v) putchar(resr[u][v]);
            putchar('\n');
          }
          return 0;
        }
      }
  return 0;
}