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;
set<long long int> dp;
char board[10][25];
int f(int cur, int last, vector<int> &row, vector<int> &col, vector<int> &v,
      vector<vector<int> > &mask) {
  int n = row.size();
  int m = col.size();
  long long int st = (cur << 5) | last;
  for (int(i) = (0); (i) < (v.size()); (i)++) {
    st = (st << 5) | v[i];
  }
  if (dp.count(st)) return 0;
  dp.insert(st);
  for (int(i) = (0); (i) < (n); (i)++) {
    if (v[i] > row[i]) {
      return 0;
    }
    int diff = m - cur;
    if (v[i] + diff < row[i]) {
      return 0;
    }
  }
  if (cur == m) {
    for (int(i) = (0); (i) < (n); (i)++)
      if (v[i] != row[i]) return 0;
    for (int(i) = (0); (i) < (n); (i)++) {
      for (int(j) = (0); (j) < (m); (j)++) cout << board[i][j];
      cout << '\n';
    }
    return 1;
  }
  for (int(i) = (0); (i) < (mask[col[cur]].size()); (i)++) {
    int r = mask[col[cur]][i];
    for (int(k) = (0); (k) < (n); (k)++) {
      if ((r >> k) & 1) {
        board[k][cur] = '*';
        if (cur == 0) {
          v[k] = 1;
        } else {
          if (board[k][cur - 1] == '.') {
            v[k]++;
          }
        }
      } else {
        board[k][cur] = '.';
        if (cur == 0) {
          v[k] = 0;
        }
      }
    }
    int ret = f(cur + 1, r, row, col, v, mask);
    if (ret) return ret;
    for (int(k) = (0); (k) < (n); (k)++) {
      if ((r >> k) & 1) {
        if (cur and board[k][cur - 1] == '.') {
          v[k]--;
        }
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  vector<int> row(n), col(m);
  for (int(i) = (0); (i) < (n); (i)++) cin >> row[i];
  for (int(i) = (0); (i) < (m); (i)++) cin >> col[i];
  vector<vector<int> > mask(n + 1);
  for (int(m) = (0); (m) < (1 << n); (m)++) {
    int cnt = 0;
    for (int(k) = (1); (k) < (n + 1); (k)++) {
      int a = (m >> k) & 1;
      int b = (m >> (k - 1)) & 1;
      if (!a and b) {
        cnt++;
      }
    }
    mask[cnt].push_back(m);
  }
  vector<int> v(n);
  f(0, 0, row, col, v, mask);
  return 0;
}