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 BMASK = 33, EMASK = 122222;
bool dp[21][BMASK][EMASK];
bool vs[21][BMASK][EMASK];
int n, m, a[6], b[21], mp[6][21];
vector<int> seg[6];
void read() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 1; j <= m; j++) cin >> b[j];
  b[0] = 0;
}
bool dfs(int col, int bMask, int eMask) {
  if (col == 0) {
    if (bMask == 0 && eMask == 0) return true;
    return false;
  }
  if (vs[col][bMask][eMask]) return dp[col][bMask][eMask];
  vs[col][bMask][eMask] = true;
  dp[col][bMask][eMask] = false;
  int tmp = eMask, c[6], d[6];
  for (int i = 0; i < n; i++) {
    c[i] = tmp % 11;
    tmp /= 11;
    if ((col + 1) / 2 < c[i]) return false;
  }
  for (int i = 0; i < n; i++) {
    if (bMask & (1 << i))
      mp[i][col - 1] = 1;
    else
      mp[i][col - 1] = 0;
  }
  for (int i = 0; i < (int)seg[b[col - 1]].size(); i++) {
    int bm = seg[b[col - 1]][i], em = 0;
    bool can = true;
    for (int j = 0; j < n; j++) d[j] = c[j];
    for (int j = n - 1; j >= 0; j--) {
      int t1 = bm & (1 << j), t2 = bMask & (1 << j);
      if (t2 > 0 && t1 == 0) d[j]--;
      if (d[j] < 0) {
        can = false;
        break;
      }
      em = em * 11 + d[j];
    }
    if (!can) continue;
    bool flag = dfs(col - 1, bm, em);
    if (flag) {
      dp[col][bMask][eMask] = true;
      return true;
    }
  }
  return false;
}
void print() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (mp[i][j] == 1)
        printf("*");
      else
        printf(".");
    }
    printf("\n");
  }
}
void solve() {
  for (int i = 0; i < n; i++) seg[i].clear();
  for (int mask = 0; mask < (1 << n); mask++) {
    int j = 0, k = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        if (k == 0) {
          j++;
          k = 1;
        }
      } else {
        k = 0;
      }
    }
    seg[j].push_back(mask);
  }
  memset(vs, false, sizeof(vs));
  memset(dp, false, sizeof(dp));
  int dMask = 0;
  for (int i = n - 1; i >= 0; i--) {
    dMask = dMask * 11 + a[i];
  }
  for (int i = 0; i < (int)seg[b[m]].size(); i++) {
    int mask = seg[b[m]][i];
    bool can = true;
    for (int j = 0; j < n; j++)
      if (mask & (1 << j)) {
        if (a[j] == 0) {
          can = false;
          break;
        }
      }
    if (!can) continue;
    if (dfs(m, mask, dMask)) {
      print();
      return;
    }
  }
}
int main() {
  read();
  solve();
  return 0;
}