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>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 64;
const int MAX2 = 170000;
const int BASE = 1000000000;
const int CNT = MAX2 / 32 + 1;
double eps = 1E-7;
int n, m;
int R[MAX];
int C[MAX];
unsigned int A[21][1 << 5][MAX2 / 32];
int D[1 << 5][1 << 5];
int W[1 << 5];
int P[MAX];
int B[MAX][MAX];
int get(int a, int b, int c) {
  return (A[a][b][c / 32] & (1 << (c % 32))) != 0;
}
int main() {
  P[0] = 1;
  for (int i = (1); i < (MAX); ++i) P[i] = P[i - 1] * 11;
  cin >> n >> m;
  for (int i = (0); i < (n); ++i) cin >> R[i];
  for (int i = (0); i < (m); ++i) cin >> C[i];
  for (int i = (0); i < ((1 << n)); ++i) {
    W[i] = 0;
    for (int j = (0); j < (n); ++j) {
      if ((i & (1 << j)) != 0)
        if (j == 0 || ((i & (1 << (j - 1))) == 0)) ++W[i];
    }
  }
  for (int i = (0); i < ((1 << n)); ++i) {
    for (int j = (0); j < ((1 << n)); ++j) {
      D[i][j] = 0;
      for (int k = (0); k < (n); ++k) {
        if ((i & (1 << k)) == 0)
          if ((j & (1 << k)) != 0) D[i][j] += P[k];
      }
    }
  }
  A[0][0][0] = 1;
  for (int i = (0); i < (m); ++i)
    for (int j = (0); j < ((1 << n)); ++j) {
      for (int k = (0); k < ((1 << n)); ++k) {
        if (W[k] != C[i]) continue;
        int add = D[j][k];
        int pos = add;
        int id = pos / 32;
        for (int l = 0; l < CNT; ++l) {
          if (id + 1 >= CNT) break;
          if (A[i][j][l] != 0) {
            if (pos % 32 == 0) {
              A[i + 1][k][id] |= A[i][j][l];
            } else {
              int a = (pos % 32);
              int b = (32 - a);
              A[i + 1][k][id] |= (A[i][j][l] << a);
              A[i + 1][k][id + 1] |= (A[i][j][l] >> b);
            }
          }
          ++id;
          pos += 32;
        }
      }
    }
  int w = 0;
  for (int i = (0); i < (n); ++i) w += P[i] * R[i];
  int mask = -1;
  for (int i = (0); i < ((1 << n)); ++i)
    if (get(m, i, w) == 1) {
      mask = i;
    }
  int x = m;
  while (x > 0) {
    for (int i = (0); i < (n); ++i)
      if ((mask & (1 << i)) != 0) B[i][x - 1] = 1;
    for (int mask2 = (0); mask2 < ((1 << n)); ++mask2) {
      int w2 = (w - D[mask2][mask]);
      if (w2 >= 0) {
        if (get(x - 1, mask2, w2)) {
          mask = mask2;
          w = w2;
          --x;
          break;
        }
      }
    }
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j)
      if (B[i][j])
        cout << '*';
      else
        cout << '.';
    cout << endl;
  }
  return 0;
}