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 PYTHON):

Solution:
bs = [[], [], [], [], [], []]
nz = []
def go(n, b, tup=tuple):
    m = len(b)
    N = 2 ** n
    dp = [set() for _ in xrange(N)]
    dp[0].add(0)
    prev = {}
    for k, x in enumerate(b):
        ndp = [set() for _ in xrange(N)]
        for i in xrange(N):
            if not dp[i]:
                continue
            for j in bs[x]:
                z = nz[i][j]
                for l in dp[i]:
                    nl = l + z
                    ndp[j].add(nl)
                    prev[k+1,j,nl] = (i, l)
        dp, ndp = ndp, dp
    return dp, prev
def main():
    n, m = map(int, raw_input().split())
    a = map(int, raw_input().split())
    b = map(int, raw_input().split())
    if m == 1:
        for x in a:
            print "*" if x else "."
        return
    N = 2 ** n
    ss = []
    for j in xrange(N):
        t = c = 0
        for i in xrange(n):
            if j >> i & 1:
                if not c:
                    c = 1
                    t += 1
            else:
                c = 0
        ss.append(bin(j)[2:].zfill(n)[::-1])
        bs[t].append(j)
    for i in xrange(N):
        tz = []
        for j in xrange(N):
            tt = 0
            for k in xrange(n):
                if ss[i][k] == '1' and ss[j][k] == '0': 
                    tt += 11 ** k
            tz.append(tt)
        nz.append(tz)
    ta = 0
    for i in xrange(n):
        ta += a[i] * (11 ** i)
    dpl, prel = go(n, b[:m/2])
    dpr, prer = go(n, b[m-1:m/2-1:-1])
    tup = tuple
    lal = m / 2
    lar = m - m / 2
    for i in xrange(N):
        for j in xrange(N):
            tz = 0
            for k in xrange(n):
                if ss[i][k] == '1' or ss[j][k] == '1':
                    tz += 11 ** k
            for l in dpl[i]:
                r = ta - tz - l
                if r in dpr[j]:
                    ansl = []
                    for k in xrange(lal, 0, -1):
                        ansl.append(i)
                        i, l = prel[k,i,l]
                    ansr = []
                    for k in xrange(lar, 0, -1):
                        ansr.append(j)
                        j, r = prer[k,j,r]
                    ansl = ansl[::-1] + ansr
                    ans = [['.'] * m for k in xrange(n)]
                    for i in xrange(m):
                        for j in xrange(n):
                            if ansl[i] >> j & 1:
                                ans[j][i] = '*'
                    for x in ans:
                        print ''.join(x)
                    return
main()