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 long double EPS = 1e-9;
const int MAXN = 11 * 11 * 11 * 11 * 11 + 10;
const int base = 11;
bool dp[22][MAXN][(1 << 5) + 10];
int a[22];
int b[22];
int n, m;
int D[22];
void decode(int x) {
  for (int i = 0; i < (int)n; ++i) {
    D[i] = (x % base);
    x /= base;
  }
}
int code() {
  int res = 0;
  for (int i = ((int)n) - 1; i >= 0; --i) {
    int d = D[i];
    res = res * base + d;
  }
  return res;
}
int ans[22][22];
vector<int> masks[22];
inline bool bit(int mask, int i) { return (mask >> i) & 1; }
int main() {
  cin >> n >> m;
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  for (int i = 0; i < (int)m; ++i) cin >> b[i];
  for (int mask = 0; mask < (int)1 << n; ++mask) {
    int bl = 0;
    for (int i = 0; i < (int)n; ++i) {
      if (bit(mask, i)) {
        if (i == n - 1 || !bit(mask, i + 1)) {
          ++bl;
        }
      }
    }
    masks[bl].push_back(mask);
  }
  dp[0][0][0] = true;
  for (int j = 0; j < (int)m; ++j) {
    for (int C = 0; C < (int)MAXN; ++C) {
      decode(C);
      bool bad = false;
      for (int i = 0; i < (int)n; ++i) {
        if (D[i] > a[i] || D[i] + (m - j + 2) / 2 < a[i]) {
          bad = true;
        }
      }
      if (bad) {
        continue;
      }
      for (int mask = 0; mask < (int)1 << n; ++mask) {
        if (!dp[j][C][mask]) {
          continue;
        }
        for (int cur_mask : masks[b[j]]) {
          decode(C);
          for (int i = 0; i < (int)n; ++i) {
            if (!bit(mask, i) && bit(cur_mask, i)) {
              ++D[i];
            }
          }
          dp[j + 1][code()][cur_mask] = true;
        }
      }
    }
  }
  for (int i = 0; i < (int)n; ++i) {
    D[i] = a[i];
  }
  int need_C = code();
  int need_mask = -1;
  for (int j = ((int)m) - 1; j >= 0; --j) {
    bool ready = false;
    for (int C = 0; C < (int)MAXN; ++C) {
      if (ready) {
        break;
      }
      for (int mask = 0; mask < (int)1 << n; ++mask) {
        if (ready) {
          break;
        }
        if (!dp[j][C][mask]) {
          continue;
        }
        for (int cur_mask : masks[b[j]]) {
          if (need_mask != -1 && cur_mask != need_mask) {
            continue;
          }
          decode(C);
          for (int i = 0; i < (int)n; ++i) {
            if (!bit(mask, i) && bit(cur_mask, i)) {
              ++D[i];
            }
          }
          if (code() == need_C) {
            for (int i = 0; i < (int)n; ++i) {
              if (bit(cur_mask, i)) {
                ans[i][j] = 1;
              }
            }
            need_C = C;
            ready = true;
            need_mask = mask;
            break;
          }
        }
      }
    }
    assert(ready);
  }
  for (int i = 0; i < (int)n; ++i) {
    for (int j = 0; j < (int)m; ++j) {
      putchar(ans[i][j] ? '*' : '.');
    }
    puts("");
  }
  return 0;
}