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 N = 22;
int a[N], b[N], n, m, now[N], cnt[N];
bool adj[11][1 << 19][20][2];
char c[N][N];
vector<int> who[N];
struct hash_pair {
  inline size_t operator()(const pair<int, int> &v) const {
    return (v.first << 31) + v.second;
  }
};
unordered_set<pair<int, int>, hash_pair> s[N];
int Pow(int a, int b) { return b ? (b & 1 ? a : 1) * Pow(a * a, b >> 1) : 1; }
void bt(int col) {
  if (col == m) {
    for (int i = 0; i < n; i++)
      if (cnt[i] != a[i]) return;
    for (int i = 0; i < n; i++, printf("\n"))
      for (int j = 0; j < m; j++) printf("%c", c[i][j]);
    exit(0);
  }
  int state = 0;
  for (int i = 0; i < n; i++) state += Pow(11, i) * cnt[i];
  int mask = 0;
  for (int i = 0; i < n; i++) mask += (1 << i) * (c[i][col - 1] == '*');
  if (s[col].count({state, mask})) return;
  s[col].insert({state, mask});
  for (auto msk : who[b[col]]) {
    for (int i = 0; i < n; i++)
      if (msk >> i & 1) {
        c[i][col] = '*';
        if (col == 0 || c[i][col - 1] == '.') cnt[i]++;
      }
    bool go_on = true;
    for (int i = 0; i < n; i++) go_on &= adj[a[i]][now[i]][col][msk >> i & 1];
    if (col - 2 >= 0)
      for (int i = 1; i + 1 < n; i++)
        if (c[i][col - 1] == '.' && (c[i][col - 2] != c[i][col]) &&
            (c[i - 1][col - 1] != c[i + 1][col - 1]))
          go_on = false;
    for (int i = 0; i < n; i++) now[i] ^= (1 << col) * (msk >> i & 1);
    if (go_on || col == m - 1) bt(col + 1);
    for (int i = 0; i < n; i++) {
      if (c[i][col] == '*' && (col == 0 || c[i][col - 1] == '.')) cnt[i]--;
      c[i][col] = '.';
    }
    for (int i = 0; i < n; i++) now[i] ^= (1 << col) * (msk >> i & 1);
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) c[i][j] = '.';
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) scanf("%d", &b[i]);
  for (int msk = 0; msk < 1 << n; msk++) {
    vector<bool> v;
    for (int i = 0; i < n; i++) v.push_back(msk >> i & 1);
    v.push_back(0);
    int res = 0;
    for (int i = 1; i < n + 1; i++) res += (v[i] == 0 && v[i - 1] == 1);
    who[res].push_back(msk);
  }
  for (int msk = 0; msk < 1 << m; msk++) {
    vector<bool> v;
    for (int i = 0; i < m; i++) v.push_back(msk >> i & 1);
    v.push_back(0);
    int res = 0;
    for (int i = 1; i < m + 1; i++) res += (v[i] == 0 && v[i - 1] == 1);
    int now = 0;
    for (int i = 0; i < m; i++) {
      if (now < 1 << 19) adj[res][now][i][v[i]] = true;
      now ^= (1 << i) & (msk);
    }
  }
  bt(0);
  return 0;
}