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, Row[6], Column[22];
char mp[6][22];
struct Node {
  char mp[6][11];
} a[200010];
int Index[6 * 6 * 6 * 6 * 6 + 6][34][13], tot;
bool check1(int state1, int y) {
  for (int i = 1; i <= n; ++i) {
    if (state1 % 6 > Row[i]) return 0;
    if (mp[i][y] == '*') {
      if (Row[i] - state1 % 6 > (m - y) / 2) return 0;
    } else {
      if (Row[i] - state1 % 6 > (m - y + 1) / 2) return 0;
    }
    state1 /= 6;
  }
  return 1;
}
void dfs(int state1, int state2, int y) {
  if (Index[state1][state2][y]) return;
  Index[state1][state2][y] = -1;
  if (y == m / 2 + 1) {
    Index[state1][state2][y] = ++tot;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m / 2 + 1; ++j) a[tot].mp[i][j] = mp[i][j];
    return;
  }
  for (int s = 0; s < 1 << n; ++s) {
    int num = 0, temp = s;
    while (temp) {
      if (temp & 1) {
        while (temp & 1) temp >>= 1;
        ++num;
      }
      temp >>= 1;
    }
    if (num != Column[y]) continue;
    int s1 = state1, s2 = 0;
    for (int i = 1, base1 = 1, base2 = 1; i <= n; ++i, base1 *= 6, base2 *= 2)
      if (s & base2) {
        mp[i][y] = '*';
        if (mp[i][y - 1] != '*') s1 += base1;
        s2 += base2;
      } else
        mp[i][y] = '.';
    if (check1(s1, y)) dfs(s1, s2, y + 1);
  }
}
bool check2(int state1, int y) {
  for (int i = 1; i <= n; ++i) {
    if (state1 % 6 > Row[i]) return 0;
    if (mp[i][y] == '*') {
      if (Row[i] - state1 % 6 > (y - 1) / 2) return 0;
    } else {
      if (Row[i] - state1 % 6 > (y) / 2) return 0;
    }
    state1 /= 6;
  }
  return 1;
}
bool dfs2(int state1, int state2, int y) {
  if (y == m / 2) {
    if (m < 2) return 1;
    int temp = state1;
    for (int s2 = 0; s2 < 1 << n; ++s2) {
      bool flag = 1;
      int s1 = 0;
      state1 = temp;
      for (int i = 1, base = 1; i <= n && flag; ++i, base *= 6) {
        if (s2 & (1 << (i - 1))) {
          if (state2 & (1 << (i - 1))) {
            s1 += base * (Row[i] - state1 % 6 + 1);
            if (Row[i] - state1 % 6 + 1 == 6) flag = 0;
          } else
            s1 += base * (Row[i] - state1 % 6);
        } else
          s1 += base * (Row[i] - state1 % 6);
        state1 /= 6;
      }
      if (flag && Index[s1][s2][y + 1]) {
        for (int i = 1; i <= n; ++i)
          for (int j = 1; j <= m / 2; ++j)
            mp[i][j] = a[Index[s1][s2][y + 1]].mp[i][j];
        return 1;
      }
    }
    return 0;
  }
  for (int s = 0; s < 1 << n; ++s) {
    int num = 0, temp = s;
    while (temp) {
      if (temp & 1) {
        while (temp & 1) temp >>= 1;
        ++num;
      }
      temp >>= 1;
    }
    if (num != Column[y]) continue;
    int s1 = state1, s2 = 0;
    for (int i = 1, base1 = 1, base2 = 1; i <= n; ++i, base1 *= 6, base2 *= 2) {
      if (s & base2) {
        mp[i][y] = '*';
        if (mp[i][y + 1] != '*') s1 += base1;
        s2 += base2;
      } else
        mp[i][y] = '.';
    }
    if (check2(s1, y) && dfs2(s1, s2, y - 1)) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &Row[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &Column[i]);
  dfs(0, 0, 1);
  dfs2(0, 0, m);
  for (int i = 1; i <= n; ++i) printf("%s\n", mp[i] + 1);
  return 0;
}