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 N = 200032;
int n, m, a[32], b[32];
char f[22][11][11][11][11][11][32];
char s[100][100];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (1); i <= (n); i++) scanf("%d", a + i);
  for (int i = (1); i <= (m); i++) scanf("%d", b + i);
  int nn = n;
  n = 5;
  memset(f, 0xff, sizeof f);
  f[0][0][0][0][0][0][0] = 0;
  vector<int> could;
  could.push_back(0);
  for (int i = 1; i <= m + 1; i++) {
    vector<int> can;
    for (int j = 0; j < 32; j++) {
      int cnt = 0;
      for (int k = 1; k < 7; k++)
        if ((j & 1 << k - 1) && !(j & 1 << k)) cnt++;
      if (cnt == b[i]) {
        can.push_back(j);
      }
    }
    for (int i1 = (0); i1 <= (i >> 1); i1++)
      for (int i2 = (0); i2 <= (i >> 1); i2++)
        for (int i3 = (0); i3 <= (i >> 1); i3++)
          for (int i4 = (0); i4 <= (i >> 1); i4++)
            for (int i5 = (0); i5 <= (i >> 1); i5++)
              for (int t = 0; t < int(could.size()); t++) {
                int mask = could[t];
                if (f[i - 1][i1][i2][i3][i4][i5][mask] != -1) {
                  for (int j = 0; j < int(can.size()); j++) {
                    int nmask = can[j];
                    int j1 = i1, j2 = i2, j3 = i3, j4 = i4, j5 = i5;
                    for (int l = 0; l < int(5); l++)
                      if (!(mask & 1 << l) && (nmask & 1 << l)) {
                        if (l == 0)
                          j1++;
                        else if (l == 1)
                          j2++;
                        else if (l == 2)
                          j3++;
                        else if (l == 3)
                          j4++;
                        else if (l == 4)
                          j5++;
                      }
                    if (j1 <= a[1] && j2 <= a[2] && j3 <= a[3] && j4 <= a[4] &&
                        j5 <= a[5])
                      f[i][j1][j2][j3][j4][j5][nmask] = mask;
                  }
                }
              }
    could = can;
  }
  int i1 = a[1], i2 = a[2], i3 = a[3], i4 = a[4], i5 = a[5], i = m + 1,
      mask = 0;
  while (i > 1) {
    int nmask = f[i][i1][i2][i3][i4][i5][mask];
    for (int j = 0; j < int(5); j++)
      if (nmask & 1 << j)
        s[j][i - 2] = '*';
      else
        s[j][i - 2] = '.';
    for (int j = 0; j < int(5); j++)
      if (!(nmask & 1 << j) && (mask & 1 << j)) {
        if (j == 0)
          i1--;
        else if (j == 1)
          i2--;
        else if (j == 2)
          i3--;
        else if (j == 3)
          i4--;
        else if (j == 4)
          i5--;
      }
    i--;
    mask = nmask;
  }
  for (int i = 0; i < int(nn); i++) printf("%s\n", s[i]);
  return 0;
}