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;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Chkbit(int N, int pos) { return (bool)(N & (1 << pos)); }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int n, m, a[22], b[22], AA;
short dp[21][33][11][11][11][11][11];
vector<int> Store[35];
char Ans[22][22];
short Solve(int col, int mask, int A[]) {
  if (AA) return 1;
  if (col == m) {
    for (int i = 0; i < n; i++) {
      if (A[i] != a[i]) return 0;
    }
    AA = 1;
    return 1;
  }
  short &res = dp[col][mask][A[0]][A[1]][A[2]][A[3]][A[4]];
  if (res != -1) {
    return res;
  }
  for (int i = 0; i < n; i++) {
    if (A[i] > a[i]) return res = 0;
  }
  res = 0;
  for (int i = 0; i < Store[b[col]].size(); i++) {
    for (int j = 0; j < n; j++) {
      if (!Chkbit(mask, j) && Chkbit(Store[b[col]][i], j)) A[j]++;
    }
    res += Solve(col + 1, Store[b[col]][i], A);
    if (res) {
      for (int j = 0; j < n; j++) {
        if (Chkbit(Store[b[col]][i], j)) Ans[j][col] = '*';
      }
      return 1;
    }
    for (int j = 0; j < n; j++) {
      if (!Chkbit(mask, j) && Chkbit(Store[b[col]][i], j)) A[j]--;
    }
  }
  return res;
}
int A[6];
int CntBit(int mask) {
  int pv = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (Chkbit(mask, i)) {
      if (!pv) cnt++;
      pv = 1;
    } else
      pv = 0;
  }
  return cnt;
}
int main() {
  n = in<int>(), m = in<int>();
  for (int i = 0; i < n; i++) {
    a[i] = in<int>();
  }
  for (int i = 0; i < m; i++) {
    b[i] = in<int>();
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      Ans[i][j] = '.';
    }
  }
  for (int i = 0; i < (1 << n); i++) {
    Store[CntBit(i)].push_back(i);
  }
  memset(dp, -1, sizeof(dp));
  memset(A, 0, sizeof(A));
  int ans = Solve(0, 0, A);
  for (int i = 0; i < n; i++) {
    cout << Ans[i] << endl;
  }
  return 0;
}