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;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string get() {
  char ch[1000010];
  scanf("%s", ch);
  return ch;
}
const int MAX_LG = 21;
const int maxn = 50 + 10;
const int base = 29;
const int mod = 1e9 + 7;
const int INF = 1e18;
int a[maxn], b[maxn], n, m;
int a2[maxn];
int grid[10][300];
bool mark[20][32][20000];
vector<int> vc[maxn];
inline void solve(int col, int colmask, int HashRow) {
  if (col == m) {
    for (int i = 0; i < n; i++)
      if (a2[i] < a[i]) return;
    for (int i = 0; i < n; i++, cout << "\n")
      for (int j = 0; j < m; j++) {
        if (grid[i][j])
          cout << "*";
        else
          cout << ".";
      }
    exit(0);
  }
  if (mark[col][colmask][HashRow]) return;
  mark[col][colmask][HashRow] = true;
  for (auto colmask2 : vc[b[col]]) {
    bool fl = true;
    for (int i = 0; i < n; i++) {
      if (colmask2 & (1 << i)) {
        grid[i][col] = true;
        if ((col == 0 || grid[i][col - 1] == 0)) {
          a2[i]++;
          if (a2[i] > a[i]) fl = false;
        }
        if (a2[i] + (m - col - 1) < a[i]) {
          fl = false;
        }
      }
    }
    if (fl) {
      int newHashRow = 0;
      for (int i = 0; i < n; i++) newHashRow = newHashRow * n + a2[i];
      solve(col + 1, colmask2, newHashRow);
    }
    for (int i = 0; i < n; i++) {
      if (colmask2 & (1 << i)) {
        grid[i][col] = false;
        if ((col == 0 || grid[i][col - 1] == 0)) a2[i]--;
      }
    }
  }
}
int32_t main() {
  n = in(), m = in();
  for (int i = 0; i < n; i++) a[i] = in();
  for (int i = 0; i < m; i++) b[i] = in();
  for (int mask = 0; mask < (1 << n); mask++) {
    int cnt = 0;
    for (int j = 0; j < n; j++)
      if ((mask & (1 << j)) && (j == 0 || !(mask & (1 << (j - 1))))) cnt++;
    vc[cnt].push_back(mask);
  }
  solve(0, 0, 0);
}