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;
long long n, m, hm;
long long ans[20], an[5], am[20];
vector<long long> pre[4];
long long prep[5] = {1, 6, 36, 216, 1296};
unordered_map<long long, vector<long long>> tb;
bool vis[25][(1 << 5)][7780];
inline long long g6(long long mask, long long ind) {
  return (mask / prep[ind]) % 6;
}
void answer() {
  for (long long(i) = (0); (i) < (n); ++(i)) {
    for (long long(j) = (0); (j) < (m); ++(j)) {
      cout << ((ans[j] & (1 << i)) ? '*' : '.');
    }
    cout << endl;
  }
  exit(0);
}
vector<long long> store;
void f2(long long ind, long long lmask, long long mask) {
  if (ind < hm) {
    long long key = mask + (lmask << 30);
    tb[key] = store;
    return;
  }
  if (vis[ind][lmask][mask]) return;
  for (long long next : pre[am[ind]]) {
    long long nmask = mask;
    for (long long(i) = (0); (i) < (n); ++(i)) {
      if ((next & (1 << i)) && !(lmask & (1 << i))) nmask += 1 * prep[i];
    }
    store.push_back(next);
    f2(ind - 1, next, nmask);
    store.pop_back();
  }
  vis[ind][lmask][mask] = 1;
}
void f1(long long ind, long long lmask, long long mask) {
  if (ind == hm) {
    for (long long(i) = (0); (i) < (n); ++(i))
      if (g6(mask, i) > an[i]) return;
    for (long long(i) = (0); (i) < (n); ++(i)) an[i] -= g6(mask, i);
    bool valid = 1;
    for (long long(i) = (0); (i) < (n); ++(i)) {
      if (an[i] > ((m - hm + 1) >> 1)) valid = 0;
    }
    if (valid)
      for (long long(lm) = (0); (lm) < (1 << n); ++(lm)) {
        long long key = lm << 30;
        for (long long(i) = (0); (i) < (n); ++(i)) {
          if ((lm & (1 << i)) && (lmask & (1 << i))) ++an[i];
          key += an[i] * prep[i];
        }
        if (tb.find(key) != tb.end()) {
          vector<long long> vans = tb[key];
          for (long long(i) = (0); (i) < (vans.size()); ++(i)) {
            ans[m - i - 1] = vans[i];
          }
          answer();
        }
        for (long long(i) = (0); (i) < (n); ++(i))
          if ((lm & (1 << i)) && (lmask & (1 << i))) --an[i];
      }
    for (long long(i) = (0); (i) < (n); ++(i)) an[i] += g6(mask, i);
    return;
  }
  if (vis[ind][lmask][mask]) return;
  for (long long next : pre[am[ind]]) {
    long long nmask = mask;
    for (long long(i) = (0); (i) < (n); ++(i)) {
      if (next & (1 << i) && !(lmask & (1 << i))) nmask += 1 * prep[i];
    }
    ans[ind] = next;
    f1(ind + 1, next, nmask);
  }
  vis[ind][lmask][mask] = 1;
}
int main() {
  cin >> n >> m;
  hm = (m >> 1);
  for (long long(i) = (0); (i) < (n); ++(i)) cin >> an[i];
  for (long long(i) = (0); (i) < (m); ++(i)) cin >> am[i];
  for (long long mask = 0; mask < (1 << n); ++mask) {
    long long c = 0, last = 0;
    for (long long i = 0; i < n; ++i) {
      if (mask & (1 << i) && last == 0) {
        ++c;
      }
      last = mask & (1 << i);
    }
    pre[c].push_back(mask);
  }
  for (long long(i) = (0); (i) < (m); ++(i)) {
    for (long long(j) = (0); (j) < (32); ++(j)) {
      for (long long(k) = (0); (k) < (7780); ++(k)) vis[i][j][k] = 0;
    }
  }
  f2(m - 1, 0, 0);
  f1(0, 0, 0);
}