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;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int arr[7], rr[21], n, m, r[7];
short dp[21][11][11][11][11][11][11];
short cp[21][11][11][11][11][11][11];
vector<int> durum[7];
char ans[7][22];
int black(int x, int y) { return ((x & (1 << y)) > 0); }
int white(int x, int y) { return (!(x & (1 << y))); }
int component(int x) {
  int con = 0;
  for (int i = 0; i < n; i++)
    if (black(x, i) and white(x, i + 1)) con++;
  return con;
}
short rec(int x, int q1, int q2, int q3, int q4, int q5, int y) {
  if (q1 < 0 or q2 < 0 or q3 < 0 or q4 < 0 or q5 < 0) return 0;
  if (x == m + 1) return (!(q1 + q2 + q3 + q4 + q5));
  short& ret = dp[x][q1][q2][q3][q4][q5][y];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < durum[rr[x]].size(); i++) {
    int mask = durum[rr[x]][i], lmask = durum[rr[x - 1]][y];
    r[1] = q1, r[2] = q2, r[3] = q3, r[4] = q4, r[5] = q5;
    for (int j = 0; j < 5; j++)
      if (white(lmask, j) and black(mask, j)) r[j + 1]--;
    ret |= rec(x + 1, r[1], r[2], r[3], r[4], r[5], i);
    if (ret == 1) {
      cp[x][q1][q2][q3][q4][q5][y] = i;
      break;
    }
  }
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  for (int i = 1; i <= m; i++) scanf("%d", rr + i);
  for (int i = 0; i < (1 << n); i++) durum[component(i)].push_back(i);
  rec(1, arr[1], arr[2], arr[3], arr[4], arr[5], 0);
  short nono = 0, ind = 0;
  int r1 = arr[1], r2 = arr[2], r3 = arr[3], r4 = arr[4], r5 = arr[5],
      lmask = 0;
  while (nono != -1 and ind <= m) {
    nono = cp[++ind][r1][r2][r3][r4][r5][nono];
    int mask = durum[rr[ind]][nono];
    for (int j = 0; j < n; j++) ans[j + 1][ind] = (black(mask, j) ? '*' : '.');
    for (int j = 0; j < 5; j++)
      if (white(lmask, j) and black(mask, j)) {
        if (j == 0) r1--;
        if (j == 1) r2--;
        if (j == 2) r3--;
        if (j == 3) r4--;
        if (j == 4) r5--;
      }
    lmask = mask;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) printf("%c", ans[i][j]);
    puts("");
  }
  return 0;
}