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 eps = 1e-8;
inline int max(int a, int b) { return a < b ? b : a; }
inline int min(int a, int b) { return a > b ? b : a; }
inline long long max(long long a, long long b) { return a < b ? b : a; }
inline long long min(long long a, long long b) { return a > b ? b : a; }
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long inf = 1e18;
long long fl(long long x, long long y) {
  if (x >= 0) return x / y;
  return x / y - (x % y ? 1 : 0);
}
long long cl(long long x, long long y) {
  if (x >= 0) return (x + y - 1) / y;
  return x / y;
}
int A[10], B[25];
int dp1[12][7776][32], dp2[12][7776][32], bc[32], C[22];
int n, m;
vector<pair<int, int> > ans;
int find(int s, int mask1, int mask2) {
  int ns = 0, po = 1;
  for (int i = 0; i < n; ++i) {
    int c = s % 6;
    s /= 6;
    if (!(mask1 & 1 << i) && (mask2 & 1 << i)) c++;
    ns += po * c;
    po *= 6;
  }
  return ns;
}
int restore(int s, int mask1, int mask2) {
  int ns = 0, po = 1;
  for (int i = 0; i < n; ++i) {
    int c = s % 6;
    s /= 6;
    if (((mask1 >> i) & 1) && !((mask2 >> i) & 1)) c--;
    ns += po * c;
    po *= 6;
  }
  return ns;
}
void solve(int dp[12][7776][32], int l) {
  for (int i = 0; i < l + 1; ++i) {
    for (int j = 0; j < 7776; ++j)
      for (int k = 0; k < 1 << n; ++k) dp[i][j][k] = -1;
  }
  dp[0][0][0] = 0;
  for (int i = 0; i < l; ++i) {
    for (int s = 0; s < 7776; ++s) {
      for (int mask = 0; mask < 1 << n; ++mask) {
        if (bc[mask] != C[i]) continue;
        if (dp[i][s][mask] == -1) continue;
        for (int mask2 = 0; mask2 < 1 << n; ++mask2) {
          if (bc[mask2] != C[i + 1]) continue;
          int ns = find(s, mask, mask2);
          dp[i + 1][ns][mask2] = mask;
        }
      }
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &A[i]);
  for (int i = 0; i < m; ++i) scanf("%d", &B[i]);
  int l = m / 2, r = m - l;
  for (int i = 0; i < 1 << n; ++i) {
    int mask = i;
    int prev = 0;
    for (int j = 0; j < n; ++j) {
      if (((mask >> j) & 1) && !prev) bc[mask]++;
      prev = (mask >> j) & 1;
    }
  }
  if (m == 1) {
    for (int i = 0; i < n; ++i) {
      if (A[i] == 0)
        printf(".");
      else
        printf("*");
    }
    printf("\n");
    return 0;
  }
  for (int i = 0; i < l; ++i) {
    C[i + 1] = B[i];
  }
  solve(dp1, l);
  for (int i = 0; i < r; ++i) {
    C[i + 1] = B[m - 1 - i];
  }
  solve(dp2, r);
  for (int s = 0; s < 7776; ++s) {
    for (int mask1 = 0; mask1 < 1 << n; ++mask1) {
      if (B[l - 1] != bc[mask1]) continue;
      if (dp1[l][s][mask1] == -1) continue;
      for (int mask2 = 0; mask2 < 1 << n; ++mask2) {
        if (B[l] != bc[mask2]) continue;
        int ns = 0, ss = s, po = 1, f = 0;
        for (int i = 0; i < n; ++i) {
          int p = ss % 6;
          ss /= 6;
          int ii = A[i] - p;
          if (mask1 & mask2 & 1 << i) {
            ii++;
          }
          if (ii < 0 || ii >= 6) {
            f = 1;
            break;
          }
          ns += ii * po;
          po *= 6;
        }
        if (f == 1) continue;
        if (ns > 7776 || dp2[r][ns][mask2] == -1) continue;
        ans.push_back(make_pair(l, mask1));
        ans.push_back(make_pair(l + 1, mask2));
        ss = s;
        int pmask = mask1;
        for (int i = l; i > 1; i--) {
          ans.push_back(make_pair(i - 1, dp1[i][ss][pmask]));
          int ppmask = dp1[i][ss][pmask];
          ss = restore(ss, pmask, ppmask);
          pmask = ppmask;
        }
        ss = ns;
        pmask = mask2;
        for (int i = r; i > 1; i--) {
          ans.push_back(make_pair(l + 2 + r - i, dp2[i][ss][pmask]));
          int ppmask = dp2[i][ss][pmask];
          ss = restore(ss, pmask, ppmask);
          pmask = ppmask;
        }
        sort(ans.begin(), ans.end());
        for (int i = 0; i < n; ++i) {
          for (int j = 0; j < ans.size(); ++j) {
            if (ans[j].second % 2) {
              printf("*");
            } else
              printf(".");
            ans[j].second /= 2;
          }
          printf("\n");
        }
        return 0;
      }
    }
  }
  return 0;
}