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 = 500007;
struct Hashmap {
  int head[MOD], ecnt;
  int to[MOD], cost[MOD], next[MOD];
  void init() {
    memset(head, -1, sizeof(head));
    ecnt = 0;
  }
  int find(int state) {
    int h = state % MOD;
    for (int p = head[h]; ~p; p = next[p])
      if (to[p] == state) return cost[p];
    return -1;
  }
  void insert(int state, int val) {
    int h = state % MOD;
    if (find(state) == -1) {
      to[ecnt] = state;
      cost[ecnt] = val;
      next[ecnt] = head[h];
      head[h] = ecnt++;
    }
  }
};
Hashmap dp[21];
int row[21], col[21];
int n, m;
int encode(int v[]) {
  int res = 0;
  for (int i = 0; i <= n; ++i) res = res * 33 + v[i];
  return res;
}
void decode(int v[], int state) {
  for (int i = n; i >= 0; --i) {
    v[i] = state % 33;
    state /= 33;
  }
}
int now[8], nxt[8];
int count(int state) {
  int res = __builtin_popcount(state);
  for (int i = 0; i < n - 1; ++i)
    if (((state >> i) & 3) == 3) res--;
  return res;
}
bool check(int c, int v[]) {
  for (int p = 0; p < n; ++p)
    if (v[p] > row[p]) return false;
  for (int p = 0; p < n; ++p)
    if (v[p] + (m - c + 1) / 2 < row[p]) return false;
  return true;
}
void solve() {
  dp[0].init();
  dp[0].insert(0, 0);
  for (int i = 1; i <= m; ++i) {
    dp[i].init();
    for (int _ = 0; _ < dp[i - 1].ecnt; ++_) {
      decode(now, dp[i - 1].to[_]);
      for (int t = 0; t < (1 << n); ++t)
        if (count(t) == col[i]) {
          for (int p = 0; p < n; ++p)
            if ((now[n] & (1 << p)) == 0 && (t & (1 << p)))
              nxt[p] = now[p] + 1;
            else
              nxt[p] = now[p];
          if (check(i, nxt)) {
            nxt[n] = t;
            dp[i].insert(encode(nxt), _);
          }
        }
    }
  }
}
char mat[21][21];
void print(int i, int id) {
  if (i == 0) return;
  int tmp = dp[i].to[id] % 33;
  for (int p = 0; p < n; ++p) mat[p][i - 1] = ((tmp >> p) & 1) ? '*' : '.';
  print(i - 1, dp[i].cost[id]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &row[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &col[i]);
  solve();
  for (int _ = 0; _ < dp[m].ecnt; ++_) {
    decode(now, dp[m].to[_]);
    bool flag = true;
    for (int p = 0; p < n; ++p)
      if (now[p] != row[p]) flag = false;
    if (flag) {
      print(m, _);
      break;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) putchar(mat[i][j]);
    puts("");
  }
}