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, A[11], B[21];
vector<int> DP[21];
vector<int> T[5];
int res[11][21];
int temp[21], temp2[21];
inline void getTemp(int j, int x) {
  for (int i = 0; i < N; i++) {
    temp[i] = x % j;
    x /= j;
  }
}
inline int getNum(int j) {
  int res = 0;
  for (int i = N - 1; i >= 0; i--) {
    res = res * j + temp2[i];
  }
  return res;
}
int main() {
  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 i = 0; i <= M; i++) {
    int S = 1;
    for (int j = 0; j < N; j++) {
      S *= (i + 1);
    }
    DP[i].assign(S, -1);
  }
  for (int i = 0; i < (1 << N); i++) {
    int cnt = i & 1;
    for (int j = 1; j < N; j++) {
      if ((i & (1 << j)) > 0 && (i & (1 << (j - 1))) == 0) {
        cnt++;
      }
    }
    T[cnt].push_back(i);
  }
  DP[0][0] = 0;
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < DP[i].size(); j++) {
      if (DP[i][j] == -1) continue;
      getTemp(i + 1, j);
      for (int k = 0; k < T[B[i]].size(); k++) {
        for (int l = 0; l < N; l++) {
          temp2[l] = temp[l] + ((temp[l] & 1) ^ ((T[B[i]][k] >> l) & 1));
        }
        DP[i + 1][getNum(i + 2)] = j;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    temp[i] = max(0, 2 * A[i] - 1);
  }
  int idx = -1;
  for (int i = 0; i < (1 << N); i++) {
    bool valid = 1;
    for (int j = 0; j < N; j++) {
      temp2[j] = temp[j] + ((i >> j) & 1);
      if (temp2[j] > M) {
        valid = 0;
        break;
      }
    }
    if (valid) {
      if (DP[M][getNum(M + 1)] > -1) {
        idx = getNum(M + 1);
        break;
      }
    }
  }
  if (idx == -1) {
    return 1;
  }
  for (int i = M; i; i--) {
    getTemp(i + 1, idx);
    for (int j = 0; j < N; j++) {
      res[j][i - 1] = temp[j] & 1;
    }
    idx = DP[i][idx];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (res[i][j]) {
        cout << "*";
      } else {
        cout << ".";
      }
    }
    cout << "\n";
  }
  return 0;
}