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;
bool visit[22][12][2][12][2][12][2][12][2][12][2];
struct node {
  bool ara[6];
  int len;
  void Show() {
    int i;
    for (i = 1; i <= len; i++) printf("%d", ara[i]);
    printf("\n");
    printf("---------\n");
  }
};
vector<node> v[5];
int n, cnt, k, m;
int row[20], col[30];
void make(int idx, int pos, bool ara[]) {
  if (idx == 0) {
    int i;
    node tmp;
    tmp.len = n;
    for (i = 1; i <= n; i++) tmp.ara[i] = ara[i];
    v[k].push_back(tmp);
    return;
  }
  if (pos > n) return;
  int i, j;
  make(idx, pos + 1, ara);
  for (i = pos; i <= n; i++) {
    for (j = pos; j <= i; j++) ara[j] = 1;
    make(idx - 1, i + 2, ara);
    for (j = pos; j <= i; j++) ara[j] = 0;
  }
}
int stan[6];
int check(int sit[], int c, int a, int b, bool cra[6][21]) {
  int i, oka = 1;
  if (col == 0) {
    node my = v[a][b];
    for (i = 1; i <= n; i++) {
      stan[i] = sit[i];
      if (my.ara[i]) stan[i]++;
      if (stan[i] > row[i]) return 0;
    }
  } else {
    node my = v[a][b];
    for (i = 1; i <= n; i++) {
      stan[i] = sit[i];
      if (cra[i][c - 1] == 0 && my.ara[i] == 1) stan[i]++;
      if (stan[i] > row[i]) return 0;
    }
  }
  return 1;
}
int confirm(int sit[]) {
  int i;
  for (i = 1; i <= n; i++)
    if (sit[i] < row[i]) return 0;
  return 1;
}
bool ANS;
bool ans[10][30];
void fun(int c, bool cra[6][21], int sit[]) {
  if (ANS) return;
  cnt++;
  if (c > m) {
    if (confirm(sit)) {
      ANS = 1;
      int i, j;
      for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++) ans[i][j] = cra[i][j];
    }
    return;
  }
  if (visit[c][sit[1]][cra[1][c - 1]][sit[2]][cra[2][c - 1]][sit[3]]
           [cra[3][c - 1]][sit[4]][cra[4][c - 1]][sit[5]][cra[5][c - 1]])
    return;
  int kk = col[c];
  int len = v[kk].size();
  int i, j;
  for (i = 0; i < len; i++) {
    node my = v[kk][i];
    if (ANS == 0 && check(sit, c, kk, i, cra)) {
      int ns[i];
      for (j = 1; j <= n; j++) {
        cra[j][c] = my.ara[j];
        ns[j] = stan[j];
      }
      for (j = n + 1; j <= 5; j++) {
        cra[j][c] = 0;
        ns[j] = 0;
      }
      fun(c + 1, cra, ns);
    }
  }
  visit[c][sit[1]][cra[1][c - 1]][sit[2]][cra[2][c - 1]][sit[3]][cra[3][c - 1]]
       [sit[4]][cra[4][c - 1]][sit[5]][cra[5][c - 1]] = 1;
}
bool bra[21], dra[6][21];
int s[6];
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &row[i]);
  for (i = 1; i <= m; i++) scanf("%d", &col[i]);
  k = 0;
  make(k, 1, bra);
  k = 1;
  make(k, 1, bra);
  k = 2;
  make(k, 1, bra);
  k = 3;
  make(k, 1, bra);
  fun(1, dra, s);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (ans[i][j])
        printf("*");
      else
        printf(".");
    }
    printf("\n");
  }
  return 0;
}