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;
int a[10];
int b[25];
int s[10][44];
bool d[25][58];
int n, m;
set<int> been[40];
bool q[25];
vector<int> z[40];
bool go(int l) {
  if (l == m + 1) {
    for (int i = 0; i < n; i++)
      if (s[i][l - 1] != a[i]) return false;
    for (int i = 0; i < n; i++) {
      for (int j = 1; j <= m; j++)
        if (d[i][j])
          printf("*");
        else
          printf(".");
      printf("\n");
    }
    return true;
  }
  if (b[l - 1] == 0) {
    for (int i = 0; i < n; i++) {
      d[i][l] = false;
      s[i][l] = s[i][l - 1];
    }
    return go(l + 1);
  } else if (b[l - 1] == 3) {
    for (int i = 0; i < n; i++) s[i][l] = s[i][l - 1];
    if (!d[0][l - 1]) s[0][l]++;
    if (!d[2][l - 1]) s[2][l]++;
    if (!d[4][l - 1]) s[4][l]++;
    d[1][l] = d[3][l] = false;
    d[0][l] = d[2][l] = d[4][l] = true;
    return go(l + 1);
  }
  for (int q = 0; q < z[b[l - 1]].size(); q++) {
    int t = z[b[l - 1]][q];
    int mask = t;
    for (int i = 0; i < n; i++) {
      d[i][l] = (t % 2) > 0;
      t /= 2;
    }
    bool ok = true;
    for (int i = 0; i < n; i++) {
      s[i][l] = s[i][l - 1];
      if (d[i][l] && !d[i][l - 1]) s[i][l]++;
      if (s[i][l] > a[i]) {
        ok = false;
        break;
      }
      if (s[i][l] + (m - l + 1) / 2 < a[i]) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    int value = 0;
    for (int i = 0; i < n; i++) value = value * 11 + s[i][l];
    value *= 1 << n;
    value += mask;
    if (been[l + 1].find(value) != been[l + 1].end()) continue;
    been[l + 1].insert(value);
    if (go(l + 1)) return true;
  }
  return false;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int mask = 0; mask < (1 << n); mask++) {
    int t = mask;
    for (int i = 0; i < n; i++) {
      q[i] = (t % 2) != 0;
      t /= 2;
    }
    if (q[0])
      t = 1;
    else
      t = 0;
    for (int i = 1; i < n; i++)
      if (q[i] && !q[i - 1]) t++;
    z[t].push_back(mask);
  }
  go(1);
  return 0;
}