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 MOD = 1 << 12;
const int SIZE = 1e6 + 10;
int row[10], col[40];
map<int, pair<int, int> > dp[22][1 << 12];
int seg_n[32];
void pre() {
  int d[5];
  for (int i = 0; i < (32); ++i) {
    memset((d), 0, sizeof((d)));
    for (int j = 0; j < (5); ++j) d[j] = (i >> j) & 1;
    for (int j = 0; j < (5); ++j) {
      if (d[j]) {
        if (j == 0 || d[j - 1] == 0) seg_n[i]++;
      }
    }
  }
}
char res[5][40];
char ch(int x) {
  if (x) return '*';
  return '.';
}
void print(int m, int v) {
  map<int, pair<int, int> >::iterator it = dp[m][v & (MOD - 1)].find(v);
  for (int k = 0; k < (5); ++k)
    res[k][m - 1] = ch((((it->second).second) >> k) & 1);
  if (m > 1) print(m - 1, (it->second).first);
}
bool get_answer(int x, int v, int n, int m) {
  if (x == n) {
    if (dp[m][v & (MOD - 1)].count(v)) {
      print(m, v);
      return 1;
    }
    return 0;
  }
  if (get_answer(x + 1, v | ((row[x] * 2) << (5 * x)), n, m)) return 1;
  if (row[x] && get_answer(x + 1, v | ((row[x] * 2 - 1) << (5 * x)), n, m))
    return 1;
  return 0;
}
int main() {
  pre();
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%d", &(row[i]));
  for (int i = 0; i < (m); ++i) scanf("%d", &(col[i]));
  dp[0][0][0] = make_pair(-1, -1);
  int nn = 1 << n;
  for (int i = 0; i < (m); ++i) {
    for (int mod = 0; mod < (MOD); ++mod) {
      for (map<int, pair<int, int> >::iterator it = dp[i][mod].begin();
           it != dp[i][mod].end(); it++) {
        int me[5];
        int now = it->first;
        for (int j = 0; j < (n); ++j) {
          me[j] = now & 31;
          now >>= 5;
        }
        for (int j = 0; j < (nn); ++j) {
          if (seg_n[j] != col[i]) continue;
          int you[5];
          memcpy(you, me, sizeof(int) * n);
          for (int k = 0; k < (n); ++k) {
            if ((you[k] & 1) != ((j >> k) & 1)) you[k]++;
          }
          int nxt = 0;
          bool err = 0;
          for (int k = 0; k < (n); ++k) {
            if (you[k] > row[k] * 2 || you[k] + (m - i) < row[k] * 2) err = 1;
            nxt |= you[k] << (5 * k);
          }
          if (err) continue;
          dp[i + 1][nxt & (MOD - 1)][nxt] = make_pair(it->first, j);
        }
      }
    }
  }
  if (!get_answer(0, 0, n, m)) puts("err!!!");
  for (int i = 0; i < (n); ++i) puts(res[i]);
  return 0;
}