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, L1[35], L2[35];
vector<int> vec[35];
int f[22][17000][32];
int g[22][17000][32];
int tr[32][32], P[32];
char ans[55][55];
void init() {
  for (int i = (int)(0); i <= (int)((1 << n) - 1); i++) {
    int sum = 0;
    for (int j = (int)(0); j <= (int)(n - 1); j++)
      if ((i & (1 << j)) == (1 << j)) sum++;
    for (int j = (int)(0); j <= (int)(n - 2); j++)
      if ((i & (3 << j)) == (3 << j)) sum--;
    vec[sum].push_back(i);
  }
  P[0] = 1;
  for (int i = (int)(1); i <= (int)(n); i++) P[i] = 1ll * P[i - 1] * 7;
  for (int i = (int)(0); i <= (int)((1 << n) - 1); i++)
    for (int j = (int)(0); j <= (int)((1 << n) - 1); j++)
      for (int k = (int)(0); k <= (int)(n - 1); k++)
        if ((j & (1 << k)) && !(i & (1 << k))) tr[i][j] += P[k];
}
void construct(int p, int s1, int s2, int la) {
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    for (int j = (int)(1); j <= (int)(m); j++) ans[i][j] = '.';
  for (int pp = p, S = s1, st = la; pp; pp--) {
    for (int i = (int)(0); i <= (int)(n - 1); i++)
      if (st & (1 << i)) ans[i][pp] = '*';
    int tmp = f[pp][S][st];
    S -= tr[tmp][st];
    st = tmp;
  }
  for (int pp = p, S = s2, st = la; pp <= m; pp++) {
    for (int i = (int)(0); i <= (int)(n - 1); i++)
      if (st & (1 << i)) ans[i][pp] = '*';
    int tmp = g[pp][S][st];
    S -= tr[tmp][st];
    st = tmp;
  }
  for (int i = (int)(0); i <= (int)(n - 1); i++) printf("%s\n", ans[i] + 1);
  exit(0);
}
int main() {
  scanf("%d%d", &n, &m);
  init();
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", &L1[i]);
  for (int i = (int)(1); i <= (int)(m); i++) scanf("%d", &L2[i]);
  int mid = (m + 1) / 2;
  memset(f, -1, sizeof(f));
  memset(g, -1, sizeof(g));
  f[0][0][0] = 0;
  g[m + 1][0][0] = 0;
  for (int i = (int)(1); i <= (int)(mid); i++)
    for (int j = (int)(0); j <= (int)(P[n] - 1); j++)
      for (auto la : vec[L2[i - 1]])
        if (f[i - 1][j][la] != -1)
          for (auto no : vec[L2[i]]) f[i][j + tr[la][no]][no] = la;
  for (int i = (int)(m); i >= (int)(mid); i--)
    for (int j = (int)(0); j <= (int)(P[n] - 1); j++)
      for (auto la : vec[L2[i + 1]])
        if (g[i + 1][j][la] != -1)
          for (auto no : vec[L2[i]]) g[i][j + tr[la][no]][no] = la;
  for (int j = (int)(0); j <= (int)(P[n] - 1); j++)
    for (auto la : vec[L2[mid]])
      if (f[mid][j][la] != -1) {
        int flg = 0, now = 0;
        for (int k = (int)(0); k <= (int)(n - 1); k++) {
          int v = j / P[k] % 7;
          v = L1[k + 1] + ((la >> k) & 1) - v;
          if (v >= 0 && v <= 6)
            now += P[k] * v;
          else
            flg = 1;
        }
        if (flg == 1 || g[mid][now][la] == -1) continue;
        construct(mid, j, now, la);
      }
}