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 read() {
  int s = 0;
  bool f = 0;
  char ch = ' ';
  while (!isdigit(ch)) {
    f |= (ch == '-');
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + (ch ^ 48);
    ch = getchar();
  }
  return (f) ? (-s) : (s);
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x < 10) {
    putchar(x + '0');
    return;
  }
  write(x / 10);
  putchar((x % 10) + '0');
}
const int N = 25;
int n, m, a[N], b[N], bin[N], f[1 << 5];
bool bo[N];
vector<int> wwx[N];
short dp[21][1 << 5][11][11][11][11][11];
char jyl[N][N];
inline bool dfs(int now, int zt) {
  int i, j, oo;
  bool flg;
  if (now == m + 1) {
    for (i = 1; i <= n; i++)
      if (a[i] != 0) return false;
    return true;
  }
  if (dp[now][zt][a[1]][a[2]][a[3]][a[4]][a[5]] != -1)
    return dp[now][zt][a[1]][a[2]][a[3]][a[4]][a[5]];
  for (i = 0; i < wwx[b[now]].size(); i++) {
    oo = wwx[b[now]][i];
    for (j = 1; j <= n; j++)
      if ((!(zt & bin[j - 1])) && (oo & bin[j - 1])) a[j]--;
    flg = 1;
    for (j = 1; j <= n && flg; j++)
      if ((a[j] < 0) || (m - now + 1) / 2 < a[j]) flg = 0;
    if (flg && dfs(now + 1, oo)) {
      for (j = 1; j <= n; j++) jyl[j][now] = (oo & bin[j - 1]) ? '*' : '.';
      return dp[now][zt][a[1]][a[2]][a[3]][a[4]][a[5]] = 1;
    }
    for (j = 1; j <= n; j++)
      if ((!(zt & bin[j - 1])) && (oo & bin[j - 1])) a[j]++;
  }
  return dp[now][zt][a[1]][a[2]][a[3]][a[4]][a[5]] = 0;
}
int main() {
  int i, j;
  n = read();
  m = read();
  for (i = 1; i <= n; i++) a[i] = read();
  for (i = 1; i <= m; i++) b[i] = read();
  bin[0] = 1;
  for (i = 1; i <= 20; i++) bin[i] = bin[i - 1] << 1;
  for (i = 0; i < bin[n]; i++) {
    memset(bo, 0, sizeof bo);
    for (j = 1; j <= n; j++)
      if (i & bin[j - 1]) bo[j] = 1;
    f[i] = 0;
    for (j = 1; j <= n; j++)
      if (bo[j] && (!bo[j - 1])) f[i]++;
    wwx[f[i]].push_back(i);
  }
  memset(dp, -1, sizeof dp);
  dp[0][0][a[1]][a[2]][a[3]][a[4]][a[5]] = 1;
  dfs(1, 0);
  for (i = 1; i <= n; i++, putchar('\n')) {
    for (j = 1; j <= m; j++) putchar(jyl[i][j]);
  }
  return 0;
}