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;
int n, m;
int a[7];
int b[21];
vector<int> column_config[5];
static bool res[7][21];
map<pair<int, vector<int>>, long long> first_half, second_half;
map<pair<pair<int, int>, vector<int>>, bool> vst;
void rc(int idx, vector<int> v, bool t) {
  int mask = 0;
  if (idx) {
    for (int i = 0; i < n; ++i)
      if (res[i][idx - 1]) mask ^= (1 << i);
  }
  if (vst.count({{idx, mask}, v})) return;
  vst[{{idx, mask}, v}] = true;
  if (t) {
    if (idx == (m + 1) / 2) {
      long long tmp = 0;
      for (int i = 0; i < n; ++i)
        for (int j = 0; j < (m + 1) / 2; ++j)
          if (res[i][j]) tmp ^= (1LL << (i * ((m + 1) / 2) + j));
      first_half[{mask, v}] = tmp;
      return;
    }
  } else {
    if (idx == m / 2) {
      long long tmp = 0;
      for (int i = 0; i < n; ++i)
        for (int j = 0; j < m / 2; ++j)
          if (res[i][j]) tmp ^= (1LL << (i * (m / 2) + j));
      second_half[{mask, v}] = tmp;
      return;
    }
  }
  for (int config : column_config[t ? b[idx] : b[m - idx - 1]]) {
    bool valid = true;
    vector<int> next_v = v;
    for (int i = 0; i < n; ++i) {
      if (config & (1 << i)) {
        res[i][idx] = true;
        if (idx == 0 || res[i][idx - 1] == false) next_v[i]++;
        if (next_v[i] > a[i]) {
          valid = false;
          break;
        }
      } else
        res[i][idx] = false;
    }
    if (valid) {
      rc(idx + 1, next_v, t);
    }
  }
}
void out(long long mask1, long long mask2) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < (m + 1) / 2; ++j) {
      if (mask1 & (1LL << (i * ((m + 1) / 2) + j)))
        res[i][j] = true;
      else
        res[i][j] = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m / 2; ++j) {
      if (mask2 & (1LL << (i * (m / 2) + j)))
        res[i][m - j - 1] = true;
      else
        res[i][m - j - 1] = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) cout << (res[i][j] ? '*' : '.');
    cout << '\n';
  }
  exit(0);
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];
  for (int mask = 0; mask < (1 << n); ++mask) {
    int ctr = mask & 1;
    for (int i = 1; i < n; ++i)
      if ((mask & (1 << i)) && ((mask & (1 << (i - 1))) == 0)) ctr++;
    column_config[ctr].push_back(mask);
  }
  rc(0, vector<int>(n), 1);
  vst.clear();
  rc(0, vector<int>(n), 0);
  for (auto x : first_half) {
    int mask = x.first.first;
    vector<int> v = x.first.second;
    for (int other_mask = 0; other_mask < (1 << n); ++other_mask) {
      vector<int> other_v(n);
      for (int i = 0; i < n; ++i) {
        if ((mask & other_mask) & (1 << i))
          other_v[i] = a[i] - v[i] + 1;
        else
          other_v[i] = a[i] - v[i];
      }
      if (second_half.count({other_mask, other_v})) {
        out(x.second, second_half[{other_mask, other_v}]);
      }
    }
  }
  cerr << -1 << '\n';
  return 0;
}