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;
using ll = long long;
using ld = long double;
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 5, M = 20, K = M / 2 + 1;
int a[N], b[M];
short vis[M][1 << N][K * K * K * K * K];
vector<int> T[N];
int n, m;
char g[N][M + 1];
short recur(int S, int j, int I) {
  if (j == m) {
    for (auto i = (0); i < (n); ++i) {
      if (I % K != a[i]) return -1;
      I /= K;
    }
    return +1;
  }
  if (!vis[j][S][I]) {
    for (auto X : T[b[j]]) {
      int p = 1;
      int J = I;
      for (auto i = (0); i < (n); ++i) {
        J += ((X & ~S) >> i & 1) * p;
        p *= K;
      }
      if (recur(X, j + 1, J) > 0) {
        for (auto i = (0); i < (n); ++i) g[i][j] = X >> i & 1 ? '*' : '.';
        return vis[j][S][I] = +1;
      }
    }
    vis[j][S][I] = -1;
  }
  return vis[j][S][I];
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  for (auto i = (0); i < (n); ++i) cin >> a[i];
  for (auto j = (0); j < (m); ++j) cin >> b[j];
  for (auto S = (0); S < (1 << n); ++S) {
    bool open = false;
    int res = 0;
    for (auto i = (0); i < (n); ++i) {
      if (~S >> i & 1)
        open = false;
      else if (!open) {
        ++res;
        open = true;
      }
    }
    T[res].push_back(S);
  }
  recur(0, 0, 0);
  for (auto i = (0); i < (n); ++i) cout << g[i] << '\n';
}