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 int N = 25;
int a[N], b[N], c[N], d[N];
map<pair<int, int>, bool> dp[22];
map<pair<int, int>, pair<int, int> > pre[22];
char s[N][N];
void find(int n, int m, int first, int second) {
  if (!m) return;
  pair<int, int> pi = pre[m][make_pair(first, second)];
  find(n, m - 1, pi.first, pi.second);
  for (int i = 0; i < n; i++)
    if (second & (1 << i))
      s[i][m] = '*';
    else
      s[i][m] = '.';
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  vector<int> v[N];
  for (int i = 0; i < (1 << n); i++) {
    int tot = 0, pre = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) {
        if (pre == 0) pre = 1, tot++;
      } else
        pre = 0;
    v[tot].push_back(i);
  }
  int base = 1 + *max_element(a, a + n);
  dp[0][make_pair(0, 0)] = true;
  for (int i = 0; i < m; i++) {
    for (map<pair<int, int>, bool>::iterator it = dp[i].begin();
         it != dp[i].end(); it++) {
      int first = it->first.first;
      int second = it->first.second;
      for (int j = n - 1, t = first; j >= 0; j--) {
        c[j] = t % base;
        t /= base;
      }
      for (int j = 0; j < v[b[i + 1]].size(); j++) {
        int st = v[b[i + 1]][j];
        int new_x = 0;
        bool flag = true;
        for (int k = 0; k < n; k++) {
          if (!(second & (1 << k)) && (st & (1 << k))) {
            if (c[k] + 1 > a[k]) {
              flag = false;
              break;
            }
            if (c[k] + 1 + ((m - i) >> 1) < a[k]) {
              flag = false;
              break;
            }
            new_x = new_x * base + c[k] + 1;
          } else {
            if (c[k] + ((m - i + 1 - ((st >> k) & 1)) >> 1) < a[k]) {
              flag = false;
              break;
            }
            new_x = new_x * base + c[k];
          }
        }
        if (!flag) continue;
        dp[i + 1][make_pair(new_x, st)] = true;
        pre[i + 1][make_pair(new_x, st)] = make_pair(first, second);
      }
    }
  }
  for (map<pair<int, int>, bool>::iterator it = dp[m].begin();
       it != dp[m].end(); it++) {
    int first = it->first.first;
    int second = it->first.second;
    bool flag = true;
    for (int j = n - 1, t = first; j >= 0; j--) {
      int p = t % base;
      t /= base;
      if (p != a[j]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      find(n, m, first, second);
    }
  }
  for (int i = 0; i < n; i++) printf("%s\n", s[i] + 1);
  return 0;
}