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>
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T>
inline T lowbit(T x) {
  return x & (-x);
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline bool scan(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
const double pi = 3.14159265358979323846264338327950288L;
using namespace std;
int n, m;
int a[23], b[23];
short dp[21][1 << 5][11 * 11 * 11 * 11 * 11 + 5];
int Pow[6];
int ans[6][21];
bool ok(int i, int j) {
  int ans = 0;
  while (j) {
    if (j & 1) {
      ans++;
      while (j & 1) {
        j >>= 1;
      }
    }
    j >>= 1;
  }
  return ans == b[i];
}
bool ok(int num) {
  for (int i = 0; i < n; i++) {
    if (a[i] != num % 11) return 0;
    num /= 11;
  }
  return 1;
}
bool dfs(int i, int pre, int st) {
  if (dp[i][pre][st] != -1) return dp[i][pre][st];
  if (i == m - 1) {
    if (ok(st)) {
      dp[i][pre][st] = 1;
    } else
      dp[i][pre][st] = 0;
    return dp[i][pre][st];
  }
  i++;
  for (int now = 0; now < (1 << n); now++) {
    int tmp = st;
    for (int j = 0; j < n; j++) {
      if (!((pre & (1 << j)) > 0) && ((now & (1 << j)) > 0)) tmp += Pow[j];
    }
    if (ok(i, now) && dfs(i, now, tmp)) {
      for (int j = 0; j < 5; j++) ans[j][i] = ((now & (1 << j)) > 0);
      return dp[i - 1][pre][st] = 1;
    }
  }
  return dp[i - 1][pre][st] = 0;
}
int main() {
  Pow[0] = 1;
  for (int i = 1; i <= 5; i++) Pow[i] = Pow[i - 1] * 11;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < (1 << n); i++) {
    int tmp = 0;
    for (int j = 0; j < n; j++) {
      tmp += Pow[j] * ((i & (1 << j)) > 0);
    }
    if (ok(0, i) && dfs(0, i, tmp)) {
      for (int j = 0; j < 5; j++) ans[j][0] = ((i & (1 << j)) > 0);
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      printf("%c", (ans[i][j] ? '*' : '.'));
    }
    printf("\n");
  }
  return 0;
}