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 seg(int msk) {
  if (!msk) return 0;
  int ret = 0, prev = 0;
  while (msk > 0) {
    int lst = msk & -msk;
    if (lst > (prev << 1)) ret++;
    prev = lst;
    msk -= lst;
  }
  return ret;
}
int N, M, req, a[6], b[21], mx = (1 << 5), cmp[32][32][5];
short dp[21][32][11][11][11][11][11];
char s[5][22];
vector<int> v[13];
int solve(int pos, int fr, int sc, int th, int fo, int fi) {
  if (fr < 0 || sc < 0 || th < 0 || fo < 0 || fi < 0) return -2;
  int p = 0;
  memset(dp, -1, sizeof(dp));
  dp[p][0][0][0][0][0][0] = 1;
  for (int iM = 1; iM < (int)pos + 1; iM++) {
    int imsk, prev;
    int nw = (p + 1) % 21;
    for (int i = 0; i < (int)mx; i++)
      for (int ifr = 0; ifr < (int)fr + 1; ifr++)
        for (int isc = 0; isc < (int)sc + 1; isc++)
          for (int ith = 0; ith < (int)th + 1; ith++)
            for (int ifo = 0; ifo < (int)fo + 1; ifo++)
              for (int ifi = 0; ifi < (int)fi + 1; ifi++)
                dp[nw][i][ifr][isc][ith][ifo][ifi] = -1;
    for (int j = 0; j < (int)v[b[iM - 1]].size(); j++)
      for (int ifr = 0; ifr < (int)fr + 1; ifr++)
        for (int isc = 0; isc < (int)sc + 1; isc++)
          for (int ith = 0; ith < (int)th + 1; ith++)
            for (int ifo = 0; ifo < (int)fo + 1; ifo++)
              for (int ifi = 0; ifi < (int)fi + 1; ifi++)
                for (int i = 0; i < (int)v[b[iM]].size(); i++) {
                  prev = v[b[iM - 1]][j];
                  imsk = v[b[iM]][i];
                  if (dp[p][prev][ifr][isc][ith][ifo][ifi] >= 0) {
                    if (ifr + cmp[prev][imsk][0] > 10 ||
                        isc + cmp[prev][imsk][1] > 10)
                      continue;
                    if (ith + cmp[prev][imsk][2] > 10 ||
                        ifo + cmp[prev][imsk][3] > 10)
                      continue;
                    if (ifi + cmp[prev][imsk][4] > 10) continue;
                    dp[nw][imsk][ifr + cmp[prev][imsk][0]]
                      [isc + cmp[prev][imsk][1]][ith + cmp[prev][imsk][2]]
                      [ifo + cmp[prev][imsk][3]][ifi + cmp[prev][imsk][4]] =
                          prev;
                  }
                }
    p = nw;
  }
  return p;
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < (int)N; i++) scanf("%d", &a[i + 1]);
  for (int i = 0; i < (int)M; i++) scanf("%d", &b[i + 1]);
  for (int i = 0; i < (int)mx; i++) v[seg(i)].push_back(i);
  for (int i = 0; i < (int)mx; i++)
    for (int j = 0; j < (int)mx; j++)
      for (int k = 0; k < (int)5; k++)
        cmp[i][j][k] = (!(i & (1 << k)) && (j & (1 << k))) ? 1 : 0;
  int nw, imsk, msk = -1, pos = M, val[5], ar[5];
  for (int i = 1; i < (int)6; i++) val[i - 1] = a[i];
  while (pos > 0) {
    nw = solve(pos, val[0], val[1], val[2], val[3], val[4]);
    if (msk == -1)
      for (int i = 0; i < (int)mx; i++)
        if (dp[nw][i][val[0]][val[1]][val[2]][val[3]][val[4]] >= 0) {
          msk = i;
          break;
        }
    for (int i = 0; i < (int)21; i++) {
      if (pos <= 0) break;
      imsk = dp[nw][msk][val[0]][val[1]][val[2]][val[3]][val[4]];
      for (int i = 0; i < (int)5; i++)
        s[i][pos - 1] = (msk & (1 << i)) ? '*' : '.';
      pos--;
      for (int i = 0; i < (int)5; i++) val[i] -= cmp[imsk][msk][i];
      msk = imsk;
      nw = (nw - 1 + 21) % 21;
    }
  }
  for (int i = 0; i < (int)N; i++) {
    for (int j = 0; j < (int)M; j++) putchar(s[i][j]);
    puts("");
  }
  return 0;
}