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;
void smain();
int main() {
  ios_base::sync_with_stdio(0);
  smain();
  return 0;
}
int n, m;
int rows[22], cols[22];
int ans[6];
inline int calc(int mask, int len) {
  int cnt = 0, pr = -1;
  for (int i = 0; i < len; i++) {
    if ((mask >> i) & 1) {
      if (pr != 1) cnt += 1;
      pr = 1;
    } else
      pr = 0;
  }
  return cnt;
}
inline bool check() {
  for (int i = 0; i < n; i++) {
    if (calc(ans[i], m) != rows[i]) return false;
  }
  return true;
}
int rc[22];
vector<int> masks[22], rm[22];
bool can[5][1 << 20];
set<pair<int, vector<int> > > was;
bool dfs(int v, vector<int> need) {
  if (v == m) return check();
  auto key = make_pair(v, need);
  if (was.count(key)) return false;
  was.insert(key);
  for (auto mask : masks[v]) {
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if ((mask >> i) & 1) {
        ans[i] |= 1 << v;
        if (v == 0 || ((ans[i] >> (v - 1)) & 1) == 0) need[i] -= 1;
      }
      if (!can[i][ans[i]]) ok = false;
    }
    if (ok && dfs(v + 1, need)) return true;
    for (int i = 0; i < n; i++) {
      ans[i] &= ~(1 << v);
      if ((mask >> i) & 1)
        if (v == 0 || ((ans[i] >> (v - 1)) & 1) == 0) need[i] += 1;
    }
  }
  return false;
}
void outmask(int mask, int len) {
  for (int i = 0; i < len; i++) cout << ((mask >> i) & 1);
  cout << endl;
}
void smain() {
  for (; cin >> n >> m;) {
    for (int i = 0; i < n; i++) cin >> rows[i];
    for (int i = 0; i < m; i++) cin >> cols[i];
    for (int v = 0; v < m; v++) {
      int mm = 1 << n;
      masks[v].clear();
      for (int mask = 0; mask < mm; mask++) {
        if (calc(mask, n) == cols[v]) masks[v].push_back(mask);
      }
    }
    memset(can, 0, sizeof(can));
    for (int i = 0; i < n; i++) can[i][0] = true, ans[i] = 0;
    int mm = 1 << m;
    for (int mask = 0; mask < mm; mask++) {
      int cnt = calc(mask, m);
      for (int i = 0; i < n; i++)
        if (cnt == rows[i]) {
          can[i][mask] = true;
          int t = mask;
          for (int j = m - 1; j >= 0; j--)
            if ((t >> j) & 1) can[i][t] = true, t -= 1 << j;
        }
    }
    was.clear();
    vector<int> need(n);
    for (int i = 0; i < n; i++) need[i] = rows[i];
    assert(dfs(0, need));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) cout << (((ans[i] >> j) & 1) ? "*" : ".");
      cout << "\n";
    }
    cout << endl;
  }
}