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;
int n, mm, a[5 + 1], b[2][10 + 1], m[2], maxt;
bool dp[2][10 + 1][31 + 1][7776 + 1];
pair<int, int> pr[2][10 + 1][31 + 1][7776 + 1];
vector<int> pp, hpp;
int tik(int i) {
  int ret = 0;
  while (i > 0) {
    if (i % 2 == 0) {
      i /= 2;
    } else {
      ret++;
      while (i % 2 == 1) {
        i /= 2;
      }
    }
  }
  return ret;
}
bool chk(int x, int y) {
  int ind = n;
  while (ind--) {
    if (x % 2 == 1 && y % 6 == 0) {
      return 0;
    }
    x /= 2;
    y /= 6;
  }
  return 1;
}
int cal(int x, int y, int z) {
  int ret = 0;
  int ind = n;
  while (ind--) {
    if (x % 2 == 1 && y % 2 == 0) {
      ret *= 6;
      ret += ((z % 6) - 1);
    } else {
      ret *= 6;
      ret += (z % 6);
    }
    x /= 2;
    y /= 2;
    z /= 6;
  }
  int hel = 0;
  ind = n;
  while (ind--) {
    hel *= 6;
    hel += (ret % 6);
    ret /= 6;
  }
  return hel;
}
void solve(int ind) {
  for (int i = 1; i < m[ind]; i++) {
    for (int j = 0; j < (1 << n); j++) {
      if (tik(j) == b[ind][i]) {
        for (int k = 0; k < 7776; k++) {
          if (chk(j, k)) {
            for (int l = 0; l < (1 << n); l++) {
              int x = cal(j, l, k);
              dp[ind][i][j][k] |= dp[ind][i - 1][l][x];
              if (dp[ind][i - 1][l][x]) {
                pr[ind][i][j][k] = {l, x};
              }
            }
          }
        }
      }
    }
  }
}
void print() {
  int ind = n;
  while (ind--) {
    for (int i = 0; i < pp.size(); i++) {
      if (pp[i] % 2 == 0) {
        cout << ".";
      } else {
        cout << "*";
      }
      pp[i] /= 2;
    }
    cout << endl;
  }
}
int kh5(int x) {
  int bb[5] = {0, 0, 0, 0, 0};
  int ind = 0;
  while (ind < n) {
    bb[ind] = x % 2;
    x /= 2;
    ind++;
  }
  int ret = 0;
  ;
  while (ind--) {
    ret *= 6;
    ret += bb[ind];
  }
  return ret;
}
int main() {
  cin >> n >> mm;
  m[0] = (mm / 2) + (mm % 2);
  m[1] = mm / 2;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  maxt = 7776;
  for (int i = 0; i < m[0]; i++) {
    cin >> b[0][i];
  }
  for (int i = 0; i < m[1]; i++) {
    cin >> b[1][m[1] - i - 1];
  }
  for (int i = 0; i < (1 << n); i++) {
    if (tik(i) == b[0][0]) {
      dp[0][0][i][kh5(i)] = 1;
    }
    if (m[1] > 0 && tik(i) == b[1][0]) {
      dp[1][0][i][kh5(i)] = 1;
    }
  }
  solve(0);
  if (mm == 1) {
    int x = 0;
    for (int i = n - 1; i >= 0; i--) {
      x *= 6;
      x += a[i];
    }
    for (int i = 0; i < (1 << n); i++) {
      if (dp[0][0][i][x]) {
        pp.push_back(i);
        print();
        exit(0);
      }
    }
  }
  solve(1);
  for (int i = 0; i < (1 << n); i++) {
    if (tik(i) == b[0][m[0] - 1]) {
      for (int j = 0; j < (1 << n); j++) {
        if (tik(j) == b[1][m[1] - 1]) {
          for (int k = 0; k < maxt; k++) {
            if (dp[0][m[0] - 1][i][k]) {
              int hel = 0;
              int ind = 0;
              int x = i, y = j, z = k;
              bool nist = 0;
              while (ind < n) {
                if (x % 2 == 1 && y % 2 == 1) {
                  hel *= 6;
                  hel += (a[ind] - (z % 6) + 1);
                  if (a[ind] - (z % 6) + 1 > 5 || a[ind] - (z % 6) + 1 < 0) {
                    nist = 1;
                  }
                } else {
                  hel *= 6;
                  hel += (a[ind] - (z % 6));
                  if (a[ind] - (z % 6) > 5 || a[ind] - (z % 6) < 0) {
                    nist = 1;
                  }
                }
                x /= 2;
                y /= 2;
                z /= 6;
                ind++;
              }
              if (nist) {
                continue;
              }
              int hel2 = 0;
              ind = n;
              while (ind--) {
                hel2 *= 6;
                hel2 += (hel % 6);
                hel /= 6;
              }
              hel = hel2;
              if (dp[1][m[1] - 1][j][hel]) {
                x = m[0] - 1;
                y = i;
                z = k;
                while (x >= 0) {
                  hpp.push_back(y);
                  int yy = pr[0][x][y][z].first;
                  z = pr[0][x][y][z].second;
                  y = yy;
                  x--;
                }
                for (int q = hpp.size() - 1; q >= 0; q--) {
                  pp.push_back(hpp[q]);
                }
                x = m[1] - 1;
                y = j;
                z = hel;
                while (x >= 0) {
                  pp.push_back(y);
                  int yy = pr[1][x][y][z].first;
                  z = pr[1][x][y][z].second;
                  y = yy;
                  x--;
                }
                print();
                exit(0);
              }
            }
          }
        }
      }
    }
  }
}