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;
#pragma comment(linker, "/STACK:102400000,102400000")
int a[(100 + 20)], b[(100 + 20)], c[(100 + 20)];
;
vector<int> st[(100 + 20)];
bool found;
int n, m;
bool vis[22][(200000 + 10)][40];
bool judge(int hx) {
  for (int i = 0; i < n; ++i) {
    if (hx % 11 != a[i]) return 0;
    hx /= 11;
  }
  return 1;
}
void output() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (c[j] & (1 << i))
        putchar('*');
      else
        putchar('.');
    }
    puts("");
  }
  puts("");
}
int tmp[(100 + 20)];
bool check(int i, int hx) {
  for (int j = 0; j < n; ++j) {
    tmp[j] = hx % 11, hx /= 11;
    if (tmp[j] > a[j]) return 0;
    if (tmp[j] + (m - i + 1) / 2 < a[j]) return 0;
  }
  return 1;
}
int getnxt(int hx, int pre, int now) {
  int ret = 0;
  for (int j = 0; j < n; ++j) {
    tmp[j] = hx % 11, hx /= 11;
    if (((pre >> j) & 1) == 0 && ((now >> j) & 1) == 1) tmp[j]++;
  }
  for (int j = n - 1; j >= 0; --j) ret = ret * 11 + tmp[j];
  return ret;
}
void dfs(int i, int hx, int pre) {
  if (vis[i][hx][pre]) return;
  if (i == m) {
    if (judge(hx)) {
      output();
      found = 1;
    }
    return;
  }
  if (!check(i, hx)) {
    vis[i][hx][pre] = 1;
    return;
  }
  for (int j = 0; j < st[b[i]].size(); ++j) {
    c[i] = st[b[i]][j];
    int nxt = getnxt(hx, pre, c[i]);
    dfs(i + 1, nxt, c[i]);
    if (found) return;
  }
  vis[i][hx][pre] = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &b[i]);
  for (int s = 0; s < (1 << n); ++s) {
    int cnt = 0;
    bool f = 0;
    for (int j = 0; j < n; ++j) {
      if ((1 << j) & s) {
        if (!f) ++cnt;
        f = 1;
      } else
        f = 0;
    }
    st[cnt].push_back(s);
  }
  dfs(0, 0, 0);
}