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 INF = 0x7fffffff;
const int N = 50 + 5;
inline int read() {
  int x = 0, rev = 0, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') rev = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return rev ? -x : x;
}
int n, m, a[N], b[N];
vector<int> f[N];
char ans[N][N];
void dfs(int op, int use, int sum, int pos) {
  if (pos == n) {
    f[sum].push_back(op);
    return;
  }
  dfs(op, 0, sum, pos + 1), dfs(op | (1 << pos), 1, sum + (use == 0), pos + 1);
}
set<int> g[N][N];
bool dp(int pos, int pre) {
  if (pos == m) {
    for (int i = 0; i < n; i++)
      if (a[i] != 0) return 0;
    for (int i = 0; i < n; i++) ans[i][pos] = '\0';
    return 1;
  }
  int tmp = 1, p = 0;
  for (int i = 0; i < 5; i++) p += a[i] * tmp, tmp *= 11;
  if (g[pos][pre].count(p)) return 0;
  for (auto d : f[b[pos]]) {
    for (int j = 0; j < n; j++) {
      if ((d & (1 << j)) && (pre & (1 << j)) == 0) a[j]--;
    }
    int flg = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] < 0 || ((m - 1 - pos) / 2 + 1 < a[j])) {
        flg = 1;
        break;
      }
    }
    if (!flg && dp(pos + 1, d)) {
      for (int j = 0; j < n; j++) ans[j][pos] = (d & (1 << j)) ? '*' : '.';
      return 1;
    }
    for (int j = 0; j < n; j++) {
      if ((d & (1 << j)) && (pre & (1 << j)) == 0) a[j]++;
    }
  }
  g[pos][pre].insert(p);
  return 0;
}
int main() {
  n = read(), m = read();
  dfs(0, 0, 0, 0);
  for (int i = 0; i < n; i++) a[i] = read();
  for (int i = n + 1; i < 5; i++) a[i] = 0;
  for (int i = 0; i < m; i++) b[i] = read();
  for (int i = 0; i < m; i++)
    for (int j = 0; j < 33; j++) g[i][j].clear();
  dp(0, 0);
  for (int i = 0; i < n; i++) cout << ans[i] << endl;
  return 0;
}