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 = 12;
int a[100], b[100];
int n, m;
int cc[100];
vector<int> dd[100];
void init() {
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if ((i >> j) & 1) {
        if (0 == j || (((i ^ (i << 1)) >> j) & 1)) cc[i]++;
      }
    }
    dd[cc[i]].push_back(i);
  }
}
struct Re {
  int a, b, c;
  Re() {}
  Re(int a, int b, int c) : a(a), b(b), c(c) {}
};
bitset<12 * 12 * 12 * 12 * 12> vis[22][1 << 5], dp[22][1 << 5];
map<int, Re> pp[22][1 << 5];
int fs;
int dfs(int row, int pre, int st) {
  if (vis[row][pre][st]) {
    if (dp[row][pre][st]) return 1;
    return 0;
  }
  vis[row][pre][st] = 1;
  if (row == m) {
    if (st == fs) return dp[row][pre][st] = 1;
    return dp[row][pre][st] = 0;
  }
  int x[6], y[6];
  for (int i = n - 1, j = st; i >= 0; i--) {
    x[i] = j % Mod;
    j /= Mod;
  }
  for (int k = 0; k < dd[b[row]].size(); k++) {
    int i = dd[b[row]][k];
    for (int j = 0; j < n; j++) y[j] = x[j];
    for (int j = 0; j < n; j++) {
      if ((i >> j) & 1) {
        if ((pre >> j) & 1) continue;
        y[j]++;
      }
    }
    int nowst = 0;
    bool judge = true;
    for (int j = 0; j < n; j++) {
      if (y[j] > a[j] || y[j] + (m - row + 1) / 2 < a[j]) {
        judge = false;
        break;
      }
      nowst *= Mod;
      nowst += y[j];
    }
    if (!judge) {
      continue;
    }
    if (dfs(row + 1, i, nowst)) {
      pp[row + 1][i][nowst] = Re(row, pre, st);
      return dp[row][pre][st] = 1;
    }
  }
  return dp[row][pre][st] = 0;
}
char mat[10][30];
void out(int row, int msk, int st) {
  Re now = Re(row, msk, st);
  while (now.a) {
    for (int i = 0; i < n; i++) {
      if ((now.b >> i) & 1) {
        mat[i][now.a - 1] = '*';
      } else {
        mat[i][now.a - 1] = '.';
      }
    }
    now = pp[now.a][now.b][now.c];
  }
  for (int i = 0; i < n; i++) {
    puts(mat[i]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  init();
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    fs = fs * Mod + a[i];
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  dfs(0, 0, 0);
  for (int i = 0; i < (1 << n); i++) {
    if (dp[m][i][fs]) {
      out(m, i, fs);
      break;
    }
  }
  return 0;
}