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 vis[11][32][7776], vis2[11][32][7776], n, m, a[20], b[20];
int par[11][32][7776], par2[11][32][7776], bd[6][21];
int sz = 1;
void compute(int vis[11][32][7776], int kmax, int offset,
             int par[11][32][7776]) {
  for (int k = 0; k < kmax; ++k) {
    for (int bm = 0; bm < (1 << n); ++bm) {
      for (int s = 0; s < sz; ++s) {
        if (vis[k][bm][s]) {
          for (int next = 0; next < (1 << n); ++next) {
            int ch = 0;
            int x[5] = {0, 0, 0, 0, 0};
            bool set = false;
            for (int i = 0; i < n; ++i) {
              if (next & (1 << i)) {
                if (!set) {
                  set = true;
                  ++ch;
                }
                if (!(bm & (1 << i))) {
                  x[i] = 1;
                }
              } else {
                set = false;
              }
            }
            if (ch != b[k + offset]) continue;
            int ss = 0;
            int tmp = s;
            int y[5] = {0, 0, 0, 0, 0};
            for (int i = n - 1; i >= 0; --i) {
              y[i] = tmp % 6;
              tmp /= 6;
            }
            for (int i = 0; i < n; ++i) {
              ss *= 6;
              ss += x[i] + y[i];
            }
            vis[k + 1][next][ss] = 1;
            par[k + 1][next][ss] = k * (1 << n) * sz + bm * sz + s;
          }
        }
      }
    }
  }
}
void printAnswer(int lf, int s, int rg, int ss) {
  int cur = (m / 2) * (1 << n) * sz + lf * sz + s;
  while (cur != 0) {
    int k = cur / ((1 << n) * sz);
    int bb = (cur - k * ((1 << n) * sz)) / sz;
    int ss = (cur - k * ((1 << n) * sz) - bb * sz);
    for (int i = 0; i < n; ++i) {
      bd[i][k] = (bb & (1 << i));
    }
    cur = par[k][bb][ss];
  }
  cur = (m - m / 2) * (1 << n) * sz + rg * sz + ss;
  while (cur != 0) {
    int k = cur / ((1 << n) * sz);
    int bb = (cur - k * ((1 << n) * sz)) / sz;
    int ss = (cur - k * ((1 << n) * sz) - bb * sz);
    for (int i = 0; i < n; ++i) {
      bd[i][m - k + 1] = (bb & (1 << i));
    }
    cur = par2[k][bb][ss];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (bd[i][j])
        printf("*");
      else
        printf(".");
    }
    printf("\n");
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]), sz *= 6;
  for (int i = 0; i < m; ++i) scanf("%d", &b[i]);
  vis[0][0][0] = vis2[0][0][0] = 1;
  compute(vis, m / 2, 0, par);
  reverse(b + m / 2, b + m);
  compute(vis2, m - m / 2, m / 2, par2);
  for (int lf = 0; lf < (1 << n); ++lf) {
    for (int s = 0; s < sz; ++s) {
      if (!vis[m / 2][lf][s]) continue;
      int x[5] = {0, 0, 0, 0, 0};
      int tmp = s;
      for (int i = n - 1; i >= 0; --i) {
        x[i] = tmp % 6;
        tmp /= 6;
      }
      for (int rg = 0; rg < (1 << n); ++rg) {
        int y[5] = {0, 0, 0, 0, 0};
        bool ok = true;
        for (int i = 0; i < n; ++i) {
          if (lf & (1 << i) && rg & (1 << i)) {
            y[i] = a[i] - x[i] + 1;
          } else {
            y[i] = a[i] - x[i];
          }
          if (y[i] < 0 || y[i] > ((m - m / 2) - (m - m / 2) / 2)) {
            ok = false;
            break;
          }
        }
        if (!ok) continue;
        int ss = 0;
        for (int i = 0; i < n; ++i) {
          ss *= 6;
          ss += y[i];
        }
        if (vis2[m - m / 2][rg][ss]) {
          printAnswer(lf, s, rg, ss);
          return 0;
        }
      }
    }
  }
  return 0;
}