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;
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
template <typename T>
inline int sign(const T& a) {
  return a < 0 ? -1 : a > 0;
}
void task();
int main() {
  task();
  return 0;
}
char dp[21][1 << 5][161050 + 10];
char par[21][1 << 5][161050 + 10];
int n, m;
int an[6], am[21];
vector<int> mask_by_cnt[6];
vector<int> to_11[161050 + 10];
int pw[11];
inline int to_number(vector<int>& v) {
  return v[0] + v[1] * 11 + v[2] * 11 * 11 + v[3] * 11 * 11 * 11 +
         v[4] * 11 * 11 * 11 * 11;
}
void task() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> an[i];
  for (int i = 0; i < m; ++i) cin >> am[i];
  pw[0] = 1;
  for (int i = 1; i < 11; ++i) pw[i] = pw[i - 1] * 11;
  for (int mask = 0; mask < (1 << n); ++mask) {
    vector<int> v;
    for (int j = 0; j < n; ++j) v.push_back((mask & (1 << j)) > 0);
    v.push_back(17);
    int cnt = 0;
    for (int i = v.size() - 2; i >= 0; --i)
      cnt += v[i] == 1 && v[i] != v[i + 1];
    mask_by_cnt[cnt].push_back(mask);
  }
  for (int a = 0; a <= 10; ++a)
    for (int b = 0; b <= 10; ++b)
      for (int c = 0; c <= 10; ++c)
        for (int d = 0; d <= 10; ++d)
          for (int e = 0; e <= 10; ++e) {
            int number = e + d * 11 + c * 11 * 11 + b * 11 * 11 * 11 +
                         a * 11 * 11 * 11 * 11;
            to_11[number] = {e, d, c, b, a};
          }
  int limit_number = 1;
  for (int i = 0; i < n; ++i) limit_number *= 11;
  dp[0][0][0] = 1;
  par[0][0][0] = -1;
  for (int i = 0; i < m; ++i)
    for (int prev_mask : mask_by_cnt[i - 1 >= 0 ? am[i - 1] : 0])
      for (int number = 0; number < limit_number; ++number)
        if (dp[i][prev_mask][number])
          for (int cur_mask : mask_by_cnt[am[i]]) {
            int nb = number;
            int ok = 1;
            for (int j = 0; j < n; ++j)
              if ((prev_mask & (1 << j)) == 0 && (cur_mask & (1 << j)) > 0) {
                nb += pw[j];
                if (to_11[number][j] == an[j]) {
                  ok = 0;
                  break;
                }
              }
            if (!ok) continue;
            dp[i + 1][cur_mask][nb] = 1;
            par[i + 1][cur_mask][nb] = prev_mask;
          }
  vector<int> v = {an[0], an[1], an[2], an[3], an[4]};
  int number = to_number(v);
  for (int mask = 0; mask < (1 << n); ++mask) {
    if (dp[m][mask][number]) {
      (void(1));
      ;
      vector<string> ans(n, string(m, 0));
      int cur_mask = mask;
      for (int i = m; i > 0; --i) {
        for (int j = 0; j < n; ++j)
          ans[j][i - 1] = (cur_mask & (1 << j)) > 0 ? '*' : '.';
        int prev_mask = par[i][cur_mask][number];
        for (int j = 0; j < n; ++j)
          if ((prev_mask & (1 << j)) == 0 && (cur_mask & (1 << j)) > 0) {
            number -= pw[j];
          }
        cur_mask = prev_mask;
      }
      for (int i = 0; i < n; ++i) cout << ans[i] << "\n";
      return;
    }
  }
  (void(1));
  ;
}