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 one(int mask, int pos) { return (mask >> pos) & 1; }
short int d[11][11][11][11][11][21][1 << 5];
int n, m;
int a[10], b[25];
int masks[10][25], cnt_mask[10];
int id[15], id2[15];
char ans[10][25];
void calc(int col, int mask) {
  while (col) {
    int prev_mask = d[a[1]][a[2]][a[3]][a[4]][a[5]][col][mask];
    for (int i = 0; i < 5; ++i) {
      if (one(mask, i)) {
        ans[i + 1][col] = '*';
        if (!one(prev_mask, i)) --a[i + 1];
      } else
        ans[i + 1][col] = '.';
    }
    --col;
    mask = prev_mask;
  }
}
int main() {
  for (int mask = 0; mask < (1 << 5); ++mask) {
    int tot = 0;
    for (int pos = 0; pos < 5; ++pos)
      if (one(mask, pos)) {
        if (!pos || !one(mask, pos - 1)) ++tot;
      }
    masks[tot][++cnt_mask[tot]] = mask;
  }
  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(d, -1, sizeof d);
  d[0][0][0][0][0][0][0] = 0;
  for (int col = 1; col <= m; ++col) {
    for (int i = 1; i <= cnt_mask[b[col - 1]]; ++i) {
      int prev_mask = masks[b[col - 1]][i];
      for (id[0] = 0; id[0] <= 10; ++id[0]) {
        for (id[1] = 0; id[1] <= 10; ++id[1]) {
          for (id[2] = 0; id[2] <= 10; ++id[2]) {
            for (id[3] = 0; id[3] <= 10; ++id[3]) {
              for (id[4] = 0; id[4] <= 10; ++id[4]) {
                if (d[id[0]][id[1]][id[2]][id[3]][id[4]][col - 1][prev_mask] !=
                    -1) {
                  for (int j = 1; j <= cnt_mask[b[col]]; ++j) {
                    int cur_mask = masks[b[col]][j];
                    for (int it = 0; it < 5; ++it) {
                      id2[it] = id[it];
                      if (!one(prev_mask, it) && one(cur_mask, it)) ++id2[it];
                    }
                    d[id2[0]][id2[1]][id2[2]][id2[3]][id2[4]][col][cur_mask] =
                        prev_mask;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  for (int mask = 0; mask < (1 << 5); ++mask) {
    if (d[a[1]][a[2]][a[3]][a[4]][a[5]][m][mask] != -1) {
      calc(m, mask);
      break;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) putchar(ans[i][j]);
    puts("");
  }
  return 0;
}