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 = 11, MSK = 1 << 5;
bool dp[N << 1][N][N][N][N][N][32];
char res[N][N << 1];
int n, m, a[N], b[N << 1], bl[32][32][6];
char par[N << 1][N][N][N][N][N][32], cntbl[32];
inline int calc(int msk) {
  int ted = 0;
  bool bb = 0;
  for (int i = 0; i < n; i++) {
    if (msk >> i & 1) {
      if (!bb) ted++;
      bb = 1;
    } else
      bb = 0;
  }
  return ted;
}
inline void init() {
  for (int msk = 0; msk < 1 << n; msk++) cntbl[msk] = calc(msk);
  for (int i = 0; i < 1 << n; i++)
    for (int j = 0; j < 1 << n; j++)
      for (int z = 0; z < n; z++)
        if ((i >> z & 1) && (j >> z & 1 ^ 1)) bl[i][j][z] = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < m; i++) scanf("%d", b + i);
  init();
  memset(dp, 0, sizeof dp);
  dp[0][0][0][0][0][0][0] = 1;
  for (int c = 1; c <= m; c++)
    for (int i = 0; i <= a[0]; i++)
      for (int j = 0; j <= a[1]; j++)
        for (int k = 0; k <= a[2]; k++)
          for (int s = 0; s <= a[3]; s++)
            for (int t = 0; t <= a[4]; t++) {
              if ((i << 1) > c + 1 || (j << 1) > c + 1 || (k << 1) > c + 1 ||
                  (s << 1) > c + 1 || (t << 1) > c + 1)
                continue;
              for (int cur = 0; cur < (1 << n); cur++) {
                if (cntbl[cur] != b[c - 1]) continue;
                if (c == 1) {
                  if (bl[cur][0][0] <= i && bl[cur][0][1] <= j &&
                      bl[cur][0][2] <= k && bl[cur][0][3] <= s &&
                      bl[cur][0][4] <= t &&
                      dp[c - 1][i - bl[cur][0][0]][j - bl[cur][0][1]]
                        [k - bl[cur][0][2]][s - bl[cur][0][3]]
                        [t - bl[cur][0][4]][0]) {
                    dp[c][i][j][k][s][t][cur] = 1;
                  }
                } else {
                  for (int bef = 0; bef < (1 << n); bef++)
                    if (cntbl[bef] == b[c - 2]) {
                      if (bl[cur][bef][0] <= i && bl[cur][bef][1] <= j &&
                          bl[cur][bef][2] <= k && bl[cur][bef][3] <= s &&
                          bl[cur][bef][4] <= t &&
                          dp[c - 1][i - bl[cur][bef][0]][j - bl[cur][bef][1]]
                            [k - bl[cur][bef][2]][s - bl[cur][bef][3]]
                            [t - bl[cur][bef][4]][bef]) {
                        dp[c][i][j][k][s][t][cur] = 1;
                        par[c][i][j][k][s][t][cur] = bef;
                      }
                    }
                }
              }
            }
  int x[5], ansm = -1, col = m;
  for (int msk = 0; msk < (1 << n); msk++)
    if (dp[m][a[0]][a[1]][a[2]][a[3]][a[4]][msk]) {
      ansm = msk;
      break;
    }
  assert(ansm != -1);
  int bef;
  for (int i = 0; i < 5; i++) x[i] = a[i];
  while (col > 0) {
    bef = par[col][x[0]][x[1]][x[2]][x[3]][x[4]][ansm];
    for (int i = 0; i < n; i++) res[i][col - 1] = (ansm >> i & 1) ? '*' : '.';
    if (col == 1) break;
    for (int i = 0; i < 5; i++) x[i] -= bl[ansm][bef][i];
    ansm = bef;
    --col;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%c", res[i][j]);
    printf("\n");
  }
  return 0;
}