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;
bool dp[6][(1 << 5)];
bool vis[20][(1 << 5)][162000];
int a[20], b[20];
void Read(int n, int m) {
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < m; j++) cin >> b[j];
}
int cal(int i) {
  int ret = 0;
  int pre = 0;
  while (i) {
    if (i % 2 == 1) {
      if (pre == 0) {
        ret++;
      }
      pre = 1;
    } else
      pre = 0;
    i /= 2;
  }
  return ret;
}
void init(int n) {
  memset(dp, 0, sizeof(dp));
  int s[10] = {0};
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < (1 << (n)); i++) {
    dp[cal(i)][i] = true;
    s[cal(i)]++;
  }
}
int ans[20];
int num[5];
int cnt = 0;
bool DFS(int n, int m, int col) {
  if (col == m) {
    bool flag = true;
    for (int i = 0; i < n; i++) {
      if (a[i] != num[i]) flag = false;
    }
    return flag;
  }
  bool flag = true;
  int temp;
  for (int i = 0; i < (1 << (n)); i++) {
    if (dp[b[col]][i]) {
      flag = true;
      temp = 0;
      ans[col] = i;
      for (int k = 0; k < n; k++) {
        if (i & (1 << k)) {
          if (col == 0 || (ans[col - 1] & (1 << k)) == 0) {
            num[k]++;
            if (num[k] > a[k]) flag = false;
          }
        }
        temp = temp * 10 + num[k];
      }
      if (flag && !vis[col][i][temp] && DFS(n, m, col + 1)) {
        return true;
      }
      if (flag) vis[col][i][temp] = true;
      for (int k = 0; k < n; k++) {
        if (i & (1 << k)) {
          if (col == 0 || (ans[col - 1] & (1 << k)) == 0) {
            num[k]--;
          }
        }
      }
    }
  }
  return false;
}
void answer(int n, int m) {
  memset(num, 0, sizeof(num));
  if (!DFS(n, m, 0)) cout << "NO" << endl;
}
void output(int n, int m) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((1 << i) & ans[j]) {
        cout << "*";
      } else {
        cout << ".";
      }
    }
    cout << endl;
  }
}
int main() {
  std::iostream::sync_with_stdio(false);
  int n, m;
  while (cin >> n >> m) {
    Read(n, m);
    init(n);
    answer(n, m);
    output(n, m);
  }
  return 0;
}