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;
int H, W;
int A[30], B[30];
string S[50];
set<int> cand[5];
int p12[6], tar;
map<pair<int, int>, pair<int, int> > from[21];
int ok(int curv, int c) {
  int i;
  for (i = 0; i < H; i++) {
    int seg = curv / p12[i] % 12;
    if (seg > A[i]) return 0;
    if (seg + (W - c) / 2 + 2 < A[i]) return 0;
  }
  return 1;
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  p12[0] = 1;
  for (i = 0; i < 5; i++) p12[i + 1] = p12[i] * 12;
  cin >> H >> W;
  for (i = 0; i < H; i++) cin >> A[i], tar += p12[i] * A[i];
  for (i = 0; i < W; i++) cin >> B[i];
  for (i = 0; i < 1 << H; i++) {
    x = 0;
    for (y = 0; y < 10; y++)
      if ((i & (1 << y)) && ((i & (1 << (y + 1))) == 0)) x++;
    cand[x].insert(i);
  }
  from[0][make_pair(0, 0)] = make_pair(0, 0);
  for (i = 0; i < W; i++) {
    for (auto& r : from[i]) {
      for (auto& c : cand[B[i]]) {
        x = r.first.first;
        for (y = 0; y < H; y++)
          if ((c & (1 << y)) && ((r.first.second & (1 << y)) == 0)) x += p12[y];
        if (ok(x, i)) from[i + 1][make_pair(x, c)] = r.first;
      }
    }
  }
  pair<int, int> goal;
  for (auto& r : from[W])
    if (r.first.first == tar) goal = r.first;
  for (x = W - 1; x >= 0; x--) {
    for (y = 0; y < H; y++) S[y] += ".*"[(goal.second & (1 << y)) > 0];
    goal = from[x + 1][goal];
  }
  for (y = 0; y < H; y++) {
    reverse(S[y].begin(), S[y].end());
    cout << S[y] << endl;
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < argc - 1; i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < s.size(); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}