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;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1e9 + 1;
const long double EPS = 1e-9;
void precalc() {}
const int maxn = 5, maxm = 20;
int n, m;
int rows[maxn], cols[maxm];
bool read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &rows[i]);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &cols[i]);
  }
  return 1;
}
const int maxcnt = (int)52e5;
bool d[maxcnt], nd[maxcnt];
int dans[maxcnt][maxn], ndans[maxcnt][maxn];
int coef[maxn];
int getRowValue(int code, int r) {
  code >>= n;
  for (int i = n - 1; i > r; --i) {
    code /= rows[i] + 1;
  }
  return code % (rows[r] + 1);
}
void solve() {
  int cnt = 1;
  for (int i = 0; i < n; ++i) {
    cnt *= rows[i] + 1;
  }
  cnt <<= n;
  memset(d, 0, sizeof(d));
  memset(nd, 0, sizeof(nd));
  d[0] = 1;
  for (int i = 0; i < n; ++i) {
    dans[0][i] = 0;
  }
  coef[n - 1] = 1;
  for (int i = n - 2; i >= 0; --i) {
    coef[i] = coef[i + 1] * (rows[i + 1] + 1);
  }
  for (int c = 0; c < m; ++c) {
    for (int r = 0; r < n; ++r) {
      for (int code = 0; code < cnt; ++code) {
        if (!d[code]) {
          continue;
        }
        int mask = (code & ((1 << n) - 1));
        for (int col = 0; col < 2; ++col) {
          int ncode = code;
          if (col != ((mask >> r) & 1)) {
            ncode ^= (1 << r);
            if (col == 1) {
              if (getRowValue(code, r) == rows[r]) {
                continue;
              }
              ncode += (coef[r] << n);
            }
          }
          assert(ncode < cnt);
          if (!nd[ncode]) {
            nd[ncode] = 1;
            memcpy(ndans[ncode], dans[code], sizeof(dans[code]));
            ndans[ncode][r] ^= (col << c);
          }
        }
      }
      for (int code = 0; code < cnt; ++code) {
        d[code] = nd[code];
        if (d[code]) {
          nd[code] = 0;
          memcpy(dans[code], ndans[code], sizeof(dans[code]));
        }
      }
    }
    for (int code = 0; code < cnt; ++code) {
      if (!d[code]) {
        continue;
      }
      int last = 0;
      int group = 0;
      for (int i = 0; i < n; ++i) {
        int x = ((dans[code][i] >> c) & 1);
        if (x && !last) {
          ++group;
        }
        last = x;
      }
      if (group != cols[c]) {
        d[code] = 0;
      }
    }
  }
  for (int code = cnt - 1; code >= cnt - (1 << n); --code) {
    if (!d[code]) {
      continue;
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        printf("%c", ((dans[code][i] >> j) & 1) ? '*' : '.');
      }
      printf("\n");
    }
    return;
  }
  assert(0);
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}