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;
#pragma comment(linker, "/STACK:64000000")
const int infi = 1e9 + 7;
const long long infl = 1e18;
const long double eps = 1e-8;
const long double eps1 = 1e-10;
const int mod = (1e9 + 7);
const long long mod2 = 1e9 + 9;
const long long p1 = 31;
const long long p2 = 37;
const long long p3 = 29;
const int ver1 = (62 * 62);
const int maxm = 10000;
const int maxx = 1e9, maxy = 1e9;
vector<int> mask1[4];
int n, m;
void gen1(int mask, int i, int q) {
  if (i == n) {
    mask1[q].push_back(mask);
    return;
  }
  if (i && (mask & (1 << (i - 1)))) {
    gen1(mask | (1 << i), i + 1, q);
  } else {
    gen1(mask | (1 << i), i + 1, q + 1);
  }
  gen1(mask, i + 1, q);
  return;
}
int mod1[5];
int ar[5];
int arz[21];
char dp[21][32][11][11][11][11][11];
char p[21][32][11][11][11][11][11];
int ans1[30][30];
int main() {
  cin >> n >> m;
  gen1(0, 0, 0);
  for (int i = 0; i < n; ++i) {
    cin >> ar[i];
  }
  for (int i = 1; i <= m; ++i) {
    cin >> arz[i];
  }
  dp[0][0][ar[0]][ar[1]][ar[2]][ar[3]][ar[4]] = 1;
  for (int i = 1; i <= m; ++i) {
    for (int z = 0; z < (int)mask1[arz[i]].size(); ++z) {
      for (int x = 0; x < (int)mask1[arz[i - 1]].size(); ++x) {
        int maskl = mask1[arz[i - 1]][x];
        int maskr = mask1[arz[i]][z];
        memset(mod1, 0, sizeof mod1);
        for (int i = 0; i < n; ++i) {
          if (!(maskl & (1 << i)) && (maskr & (1 << i))) {
            ++mod1[i];
          }
        }
        int flag = 0;
        for (int q = 0; q + mod1[0] <= ar[0]; ++q) {
          for (int w = 0; w + mod1[1] <= ar[1]; ++w) {
            for (int e = 0; e + mod1[2] <= ar[2]; ++e) {
              for (int r = 0; r + mod1[3] <= ar[3]; ++r) {
                for (int t = 0; t + mod1[4] <= ar[4]; ++t) {
                  if (dp[i - 1][maskl][q + mod1[0]][w + mod1[1]][e + mod1[2]]
                        [r + mod1[3]][t + mod1[4]]) {
                    dp[i][maskr][q][w][e][r][t] = flag = 1;
                    p[i][maskr][q][w][e][r][t] = maskl;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  int mask;
  for (int i = 0; i < (int)mask1[arz[m]].size(); ++i) {
    mask = mask1[arz[m]][i];
    if (dp[m][mask][0][0][0][0][0]) {
      break;
    }
  }
  vector<int> ans;
  int q, w, e, r, t;
  q = w = e = r = t = 0;
  for (int i = m; i; --i) {
    ans.push_back(mask);
    int nmask = p[i][mask][q][w][e][r][t];
    for (int j = 0; j < n; ++j) {
      if ((mask & (1 << j)) && !(nmask & (1 << j))) {
        if (j == 0) {
          ++q;
        }
        if (j == 1) {
          ++w;
        }
        if (j == 2) {
          ++e;
        }
        if (j == 3) {
          ++r;
        }
        if (j == 4) {
          ++t;
        }
      }
    }
    mask = nmask;
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < (int)ans.size(); ++i) {
    for (int j = 0; j < n; ++j) {
      if (ans[i] & (1 << j)) {
        ans1[i][j] = 1;
      }
    }
  }
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i < m; ++i) {
      if (ans1[i][j]) {
        cout << '*';
      } else {
        cout << '.';
      }
    }
    cout << endl;
  }
  return 0;
}