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>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
int n, m;
int a[7], b[25];
int powers[7];
string s[7];
bool used[11 * 11 * 11 * 11 * 11 + 100][50][25];
bool dfs(int v, int mask, int k) {
  if (used[v][mask][k]) {
    return false;
  } else {
    used[v][mask][k] = true;
  }
  if (k == m) {
    bool flag = true;
    for (int i = 0; i < n; i++) {
      if (a[i] != v / powers[i] % 11) {
        flag = false;
      }
    }
    return flag;
  } else {
    for (int i = 0; i < n; i++) {
      if ((v / powers[i]) % 11 > a[i]) {
        return false;
      }
      if ((v / powers[i]) % 11 + (m - k + 1) / 2 < a[i]) {
        return false;
      }
    }
    if (b[k] == 0) {
      if (dfs(v, 0, k + 1)) {
        for (int r = 0; r < n; r++) {
          s[r].push_back('.');
        }
        return true;
      }
    } else if (b[k] == 1) {
      for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
          int v2 = 0;
          for (int k = n - 1; k >= 0; k--) {
            v2 *= 11;
            if (k >= i && k <= j) {
              v2 += v / powers[k] % 11 + ((mask & (1 << k)) == 0);
            } else {
              v2 += v / powers[k] % 11;
            }
          }
          if (dfs(v2, (1 << (j + 1)) - (1 << i), k + 1)) {
            for (int r = 0; r < n; r++) {
              if (r >= i && r <= j) {
                s[r].push_back('*');
              } else {
                s[r].push_back('.');
              }
            }
            return true;
          }
        }
      }
    } else if (b[k] == 2) {
      for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
          for (int i2 = j + 2; i2 < n; i2++) {
            for (int j2 = i2; j2 < n; j2++) {
              int v2 = 0;
              for (int k = n - 1; k >= 0; k--) {
                v2 *= 11;
                if ((k >= i && k <= j) || (k >= i2 && k <= j2)) {
                  v2 += v / powers[k] % 11 + ((mask & (1 << k)) == 0);
                } else {
                  v2 += v / powers[k] % 11;
                }
              }
              if (dfs(v2,
                      (1 << (j + 1)) - (1 << i) + (1 << (j2 + 1)) - (1 << i2),
                      k + 1)) {
                for (int r = 0; r < n; r++) {
                  if ((r >= i && r <= j) || (r >= i2 && r <= j2)) {
                    s[r].push_back('*');
                  } else {
                    s[r].push_back('.');
                  }
                }
                return true;
              }
            }
          }
        }
      }
    } else if (b[k] == 3) {
      int v2 = 0;
      for (int i = n - 1; i >= 0; i--) {
        v2 *= 11;
        if (i % 2 == 0) {
          v2 += v / powers[i] % 11 + ((mask & (1 << i)) == 0);
        } else {
          v2 += v / powers[i] % 11;
        }
      }
      if (dfs(v2, 21, k + 1)) {
        for (int r = 0; r < n; r++) {
          if (r % 2 == 0) {
            s[r].push_back('*');
          } else {
            s[r].push_back('.');
          }
        }
        return true;
      }
    }
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  for (int j = 0; j < m; j++) {
    scanf("%d", b + j);
  }
  powers[0] = 1;
  for (int i = 1; i < 7; i++) {
    powers[i] = powers[i - 1] * 11;
  }
  dfs(0, 0, 0);
  for (int i = 0; i < n; i++) {
    for (int j = m - 1; j >= 0; j--) {
      printf("%c", s[i][j]);
    }
    printf("\n");
  }
  return 0;
}