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;
const int maxA =
    1 + 10 + 11 * 10 + 11 * 11 * 10 + 11 * 11 * 11 * 10 + 121 * 121 * 10;
int a[6], lim[22], ans[22];
vector<int> MASKS[5];
int n, m;
bool mem[22][33][maxA];
void print();
inline int modify(int a, int mask, int sub, int sign = -1) {
  int b = 0;
  int temp = 1;
  for (int i = 1; i <= n; i++) {
    int y = (((mask >> i - 1) & 1)) * sign * (1 - ((sub >> i - 1) & 1));
    int dg = (a % 11) + y;
    a /= 11;
    if (dg < 0) return -1;
    b = (b + dg * temp);
    temp *= 11;
  }
  return b;
}
inline bool check(int a, int remain) {
  remain = (remain + 1) / 2;
  for (int i = 1; i <= n; i++) {
    int x = a % 11;
    a /= 11;
    if (x > remain) return 0;
  }
  return 1;
}
void f(int step, int a, int sub) {
  if (mem[step][sub][a] || !check(a, m - step + 1)) {
    return;
  }
  mem[step][sub][a] = 1;
  if (step == m + 1) {
    if (a == 0) print();
    return;
  }
  int sz = MASKS[lim[step]].size();
  for (int i = 0; i < sz; i++) {
    int mask = MASKS[lim[step]][i];
    int b = modify(a, mask, sub);
    if (b != -1) {
      ans[step] = mask;
      f(step + 1, b, mask);
    }
  }
}
void print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << ((((ans[j] >> i - 1) & 1) == 1) ? '*' : '.');
    }
    cout << endl;
  }
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  srand(31415);
  cin >> n >> m;
  for (int mask = 0; mask < (1 << n); mask++) {
    int x = 0;
    for (int i = 0; i < n; i++) {
      if (((mask >> i) & 1) && (i == 0 || !((mask >> i - 1) & 1))) x++;
    }
    MASKS[x].push_back(mask);
  }
  for (int i = 0; i <= 3; i++) random_shuffle(MASKS[i].begin(), MASKS[i].end());
  for (int i = 1; i <= n; i++) cin >> a[i];
  int temp = 1, A = 0;
  for (int i = 1; i <= n; i++) {
    A += temp * a[i];
    temp *= 11;
  }
  assert(A < maxA);
  for (int i = 1; i <= m; i++) cin >> lim[i];
  f(1, A, 0);
  return 0;
}