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;
vector<int> v[12];
int n, m;
int A[101];
int B[100];
vector<int> ans;
int mat[50][50][6];
bool dp[21][33][11][11][11][11][11];
bool vis[21][33][11][11][11][11][11];
char grid[50][50];
void pre() {
  for (int i = 0; i <= (1 << n); i++) {
    for (int j = 0; j <= (1 << n); j++) {
      int a = i;
      int b = j;
      for (int k = 0; k < n; k++) {
        if ((a & (1 << k)) == 0 && (b & (1 << k)))
          mat[i][j][k] = 1;
        else
          mat[i][j][k] = 0;
      }
    }
  }
}
bool solve(int pos, int bit, int a, int b, int c, int d, int e) {
  if (a > A[0] || b > A[1] || c > A[2] || d > A[3] || e > A[4]) return false;
  if (pos == m) {
    if (a == A[0] && b == A[1] && c == A[2] && d == A[3] && e == A[4]) {
      return true;
    }
    return false;
  }
  if (vis[pos][bit][a][b][c][d][e]) return dp[pos][bit][a][b][c][d][e];
  vis[pos][bit][a][b][c][d][e] = 1;
  bool &ret = dp[pos][bit][a][b][c][d][e];
  ret = 0;
  int id = B[pos], x, y;
  for (int i = 0; i < v[id].size(); i++) {
    x = bit;
    y = v[id][i];
    ret = ret | solve(pos + 1, y, a + mat[x][y][0], b + mat[x][y][1],
                      c + mat[x][y][2], d + mat[x][y][3], e + mat[x][y][4]);
    if (ret) return ret;
  }
  return ret;
}
void path(int pos, int bit, int a, int b, int c, int d, int e) {
  if (pos == m) {
    return;
  }
  int ret = 0;
  ret = 0;
  int id = B[pos], x, y;
  for (int i = 0; i < v[id].size(); i++) {
    x = bit;
    y = v[id][i];
    ret = ret | solve(pos + 1, y, a + mat[x][y][0], b + mat[x][y][1],
                      c + mat[x][y][2], d + mat[x][y][3], e + mat[x][y][4]);
    if (ret) {
      ans.push_back(y);
      path(pos + 1, y, a + mat[x][y][0], b + mat[x][y][1], c + mat[x][y][2],
           d + mat[x][y][3], e + mat[x][y][4]);
      return;
    };
  }
}
int main() {
  cin >> n >> m;
  for (int i = (0); i <= (n - 1); i++) cin >> A[i];
  for (int i = (0); i <= (m - 1); i++) cin >> B[i];
  for (int i = (0); i <= ((1 << n) - 1); i++) {
    int bit = i;
    int tmp[10];
    for (int j = (0); j <= (n - 1); j++) {
      if (i & (1 << j))
        tmp[j] = 1;
      else
        tmp[j] = 0;
    }
    int cnt = 0;
    for (int j = (0); j <= (n - 1); j++) {
      if (j == 0 && tmp[j] == 1)
        cnt++;
      else if (tmp[j] == tmp[j - 1])
        continue;
      else if (tmp[j] == 1 && tmp[j - 1] == 0)
        cnt++;
    }
    v[cnt].push_back(i);
  }
  pre();
  int ret = 0;
  ret = solve(0, 0, 0, 0, 0, 0, 0);
  path(0, 0, 0, 0, 0, 0, 0);
  for (int j = 0; j < m; j++) {
    int bit = ans[j];
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i))
        grid[i][j] = '*';
      else
        grid[i][j] = '.';
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << grid[i][j];
    }
    cout << endl;
  }
}