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;
inline int Pow(int x, int y, int mod) {
  long long t = x, r = 1;
  for (; y; y >>= 1, t = t * t % mod) y& 1 ? r = r * t % mod : 0;
  return r;
}
inline int Get() {
  int res = 0, q = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') q = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') res = res * 10 + ch - '0', ch = getchar();
  return res * q;
}
const double eps = 1e-12, pi = M_PI;
const int oo = (int)2.1e9, mod = (int)1e9 + 7;
const long long INF = (long long)1e17;
int n, m, tmp, tot;
int a[10], cal[40], use[25][40], cnt[25], trans[40][40][7];
bool dp[2][170001][32];
short from[21][170001][32];
int id[11][11][11][11][11];
char out[7][25];
void Get(int x, int y) {
  for (int i = (1), end = (n); i <= end; ++i)
    out[i][x] = y & (1 << (i - 1)) ? '*' : '.';
}
int main() {
  scanf(
      "%d"
      "%d"
      "\n",
      &n, &m);
  for (int i = (1), end = (n); i <= end; ++i) scanf("%d", a + i);
  for (int i = (0), end = ((1 << n) - 1); i <= end; ++i) {
    for (int j = (1), end = (n - 1); j <= end; ++j)
      if (!(i & (1 << (j - 1))) && (i & (1 << j))) ++cal[i];
    cal[i] += (i & 1);
    for (int j = (0), end = ((1 << n) - 1); j <= end; ++j) {
      for (int k = (1), end = (n); k <= end; ++k)
        if (!(i & (1 << (k - 1))) && (j & (1 << (k - 1)))) trans[i][j][k] = 1;
    }
  }
  for (int t1 = (0), end = (a[1]); t1 <= end; ++t1)
    for (int t2 = (0), end = (a[2]); t2 <= end; ++t2)
      for (int t3 = (0), end = (a[3]); t3 <= end; ++t3)
        for (int t4 = (0), end = (a[4]); t4 <= end; ++t4)
          for (int t5 = (0), end = (a[5]); t5 <= end; ++t5)
            id[t1][t2][t3][t4][t5] = tot++;
  for (int i = (1), end = (m); i <= end; ++i) {
    scanf("%d", &tmp);
    for (int j = (0), end = ((1 << n) - 1); j <= end; ++j) {
      if (cal[j] == tmp) use[i][++cnt[i]] = j;
    }
  }
  int cur = 0;
  dp[0][0][0] = 1;
  use[0][++cnt[0]] = 0;
  for (int i = (1), end = (m); i <= end; ++i) {
    int f1 = min(i >> 1, a[1]), f2 = min(i >> 1, a[2]), f3 = min(i >> 1, a[3]),
        f4 = min(i >> 1, a[4]), f5 = min(i >> 1, a[5]);
    for (int t1 = (0), end = (f1); t1 <= end; ++t1) {
      for (int t2 = (0), end = (f2); t2 <= end; ++t2) {
        for (int t3 = (0), end = (f3); t3 <= end; ++t3) {
          for (int t4 = (0), end = (f4); t4 <= end; ++t4) {
            for (int t5 = (0), end = (f5); t5 <= end; ++t5) {
              for (int j = (1), end = (cnt[i - 1]); j <= end; ++j) {
                int x = use[i - 1][j], tid = id[t1][t2][t3][t4][t5];
                if (dp[cur][tid][x]) {
                  for (int k = (1), end = (cnt[i]); k <= end; ++k) {
                    int y = use[i][k];
                    if (t1 + trans[x][y][1] > a[1] ||
                        t2 + trans[x][y][2] > a[2] ||
                        t3 + trans[x][y][3] > a[3] ||
                        t4 + trans[x][y][4] > a[4] ||
                        t5 + trans[x][y][5] > a[5])
                      continue;
                    int vid = id[t1 + trans[x][y][1]][t2 + trans[x][y][2]]
                                [t3 + trans[x][y][3]][t4 + trans[x][y][4]]
                                [t5 + trans[x][y][5]];
                    dp[cur ^ 1][vid][y] = 1, from[i][vid][y] = x;
                  }
                  dp[cur][tid][x] = 0;
                }
              }
            }
          }
        }
      }
    }
    cur ^= 1;
  }
  int k = id[a[1]][a[2]][a[3]][a[4]][a[5]], p = 0;
  for (; p < 1 << n; ++p)
    if (dp[cur][k][p]) break;
  for (int i = (m), end = (1); i >= end; --i) {
    Get(i, p);
    int t = from[i][k][p];
    for (int j = (1), end = (5); j <= end; ++j) a[j] -= trans[t][p][j];
    k = id[a[1]][a[2]][a[3]][a[4]][a[5]], p = t;
  }
  for (int i = (1), end = (n); i <= end; ++i) puts(out[i] + 1);
  return 0;
}