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;
struct _ {
  _() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  stringstream ss;
} _;
template <class A, class B>
ostream &operator<<(ostream &o, pair<A, B> t) {
  o << "(" << t.first << ", " << t.second << ")";
  return o;
}
template <class T>
inline string tostring(T first) {
  _.ss.clear();
  _.ss.str("");
  _.ss << first;
  return _.ss.str();
}
template <class T>
inline T convert(const string &s) {
  char *p;
  if (is_integral<T>())
    return strtoll(s.c_str(), &p, 10);
  else
    return strtod(s.c_str(), &p);
}
template <class T>
void PV(T a, T b, int p = 0, int w = 0, string s = " ") {
  int c = 0;
  while (a != b) {
    cout << setw(w) << *a++;
    cout << ((a != b && (!p || ++c % p)) ? s : "\n");
  }
  cout.flush();
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
const long long linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 100010;
int n, m;
int a[N];
int b[N];
const int tot = 6 * 6 * 6 * 6 * 6;
int dp1[11][1 << 5][tot];
pair<int, int> pre1[11][1 << 5][tot];
int dp2[11][1 << 5][tot];
pair<int, int> pre2[11][1 << 5][tot];
int c[1 << 5];
int go(int cur, int last, int first) {
  int v[5] = {};
  for (int i = 0; i < n; i++) {
    v[i] = cur % 6;
    cur /= 6;
  }
  for (int i = 0; i < n; i++) {
    if ((first >> i & 1) && !(last >> i & 1)) v[i]++;
  }
  int nxt = 0;
  for (int i = n - 1; i >= 0; i--) nxt = 6 * nxt + v[i];
  return nxt;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < 1 << n; i++) {
    vector<int> v;
    for (int j = 0; j < n; j++)
      if (i >> j & 1) v.push_back(j);
    int cnt = 0;
    for (int j = 0; j < v.size(); j++) {
      if (j == 0 || v[j] != v[j - 1] + 1) cnt++;
    }
    c[i] = cnt;
  }
  if (m == 1) {
    for (int i = 0; i < n; i++) {
      if (b[i])
        cout << "*" << endl;
      else
        cout << "." << endl;
    }
    return 0;
  }
  int half = m / 2;
  {
    dp1[0][0][0] = 1;
    for (int i = 0; i < half; i++) {
      for (int j = 0; j < 1 << n; j++) {
        for (int first = 0; first < tot; first++) {
          if (dp1[i][j][first] == 0) continue;
          for (int k = 0; k < 1 << n; k++) {
            if (c[k] != b[i]) continue;
            int nxt = go(first, j, k);
            dp1[i + 1][k][nxt] = 1;
            pre1[i + 1][k][nxt] = make_pair(j, first);
          }
        }
      }
    }
  }
  {
    dp2[0][0][0] = 1;
    for (int i = 0; i < m - half; i++) {
      for (int j = 0; j < 1 << n; j++) {
        for (int first = 0; first < tot; first++) {
          if (dp2[i][j][first] == 0) continue;
          for (int k = 0; k < 1 << n; k++) {
            if (c[k] != b[m - i - 1]) continue;
            int nxt = go(first, j, k);
            dp2[i + 1][k][nxt] = 1;
            pre2[i + 1][k][nxt] = make_pair(j, first);
          }
        }
      }
    }
  }
  char res[6][22] = {};
  for (int i = 0; i < 1 << n; i++)
    for (int j = 0; j < 1 << n; j++) {
      for (int left = 0; left < tot; left++) {
        if (!dp1[half][i][left]) continue;
        int v[5];
        int t = left;
        for (int w = 0; w < n; w++) {
          v[w] = a[w] - t % 6;
          if ((i >> w & 1) && (j >> w & 1)) v[w]++;
          t /= 6;
        }
        int valid = 1;
        for (int w = 0; w < n; w++) {
          if (v[w] < 0 || v[w] > 5) valid = 0;
        }
        if (!valid) continue;
        int right = 0;
        for (int w = n - 1; w >= 0; w--) right = 6 * right + v[w];
        if (!dp2[m - half][j][right]) continue;
        {
          int L = left, last = i;
          for (int w = half; w > 0; w--) {
            for (int u = 0; u < n; u++) {
              res[u][w - 1] = (last >> u & 1) ? '*' : '.';
            }
            tie(last, L) = pre1[w][last][L];
          }
        }
        {
          int R = right, last = j;
          for (int w = m - half; w > 0; w--) {
            for (int u = 0; u < n; u++) {
              res[u][m - w] = (last >> u & 1) ? '*' : '.';
            }
            tie(last, R) = pre2[w][last][R];
          }
        }
        for (int w = 0; w < n; w++) cout << res[w] << endl;
        return 0;
      }
    }
  return 0;
}