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 double PI = 2.0 * acos(0.0);
const double E = exp(1);
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
inline T sqr(T n) {
  return n * n;
}
inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }
template <typename T>
inline T pmod(T n, T m) {
  return ((n % m) + m) % m;
}
template <typename T>
T power(T n, int p) {
  return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template <typename T>
T bigmod(T n, int p, T m) {
  return (p == 0)
             ? (T)(1)
             : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %
                   m;
}
bool dp[21][(1 << 6)][11][11][11][11][11];
int row[6], col[23];
int r, c;
vector<int> save[1 << 6];
int calc(int mask) {
  int cnt = 0;
  int prv = 0;
  for (int i = 0; i < r; i++) {
    if (!prv && (mask & (1 << i))) {
      cnt++;
    }
    prv = mask & (1 << i);
  }
  return cnt;
}
char grid[21][21];
int tmp[10];
bool complet = 0;
void rec(int now, int prv_maks, int r1, int r2, int r3, int r4, int r5) {
  if (r1 < 0 || r2 < 0 || r3 < 0 || r4 < 0 || r5 < 0) return;
  if (complet) return;
  if (dp[now][prv_maks][r1][r2][r3][r4][r5]) return;
  dp[now][prv_maks][r1][r2][r3][r4][r5] = 1;
  if (now == c) {
    if (r1 + r2 + r3 + r4 + r5 == 0) {
      for (int i = 0; i < r; ++i) {
        for (int j = 0; j < c; ++j) printf("%c", grid[i][j]);
        printf("\n");
      }
      complet = 1;
    }
    return;
  }
  int mask = 0;
  for (int i = 0; i < (int)save[col[now]].size(); i++) {
    mask = save[col[now]][i];
    tmp[0] = r1;
    tmp[1] = r2;
    tmp[2] = r3;
    tmp[3] = r4;
    tmp[4] = r5;
    for (int j = 0; j < r; j++) {
      if (!(prv_maks & (1 << j)) && (mask & (1 << j))) {
        tmp[j]--;
      }
    }
    for (int j = 0; j < r; j++) {
      grid[j][now] = (mask & (1 << j)) ? '*' : '.';
    }
    rec(now + 1, mask, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4]);
    if (complet) return;
  }
}
int main() {
  scanf("%d %d", &r, &c);
  for (int i = 0; i < r; ++i) scanf("%d", &row[i]);
  for (int i = 0; i < c; ++i) {
    scanf("%d", &col[i]);
  };
  for (int i = 0; i < (1 << r); i++) {
    save[calc(i)].push_back(i);
  }
  rec(0, 0, row[0], row[1], row[2], row[3], row[4]);
}