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

Solution:

import java.util.*;
import java.io.*;

public class F
{
   public static void main(String[] args)
   {
      new F(new FastScanner());
   }

   int R, C;
   ArrayList<Integer>[] relMasks;
   int[] rowSum, colSum;
   HashMap<Long, Integer> choice;

   boolean isOn(int i, int mask)
   {
      return ((1<<i)&mask) > 0;
   }

   long hash(int[] sums, int col, int mask)
   {
      long hv = mask;
      hv = hv*C+col;
      for (int i=0; i<R; i++)
         hv = hv*(rowSum[i]+1)+sums[i];
      return hv;
   }

   int go(int[] sums, int col, int mask)
   {
      if (col == C)
      {
         for (int s : sums)
            if (s != 0)
               return -1;
         return 0;
      }
      for (int s : sums)
         if (s > C-col || s < 0)
            return -1;
      long hv = hash(sums, col, mask);
      Integer rr = choice.get(hv);
      if (rr != null) return rr;

      int res = -1;
      int[] nxtSums = new int[R];
      for (int cur : relMasks[colSum[col]])
      {
         for (int i=0; i<R; i++) nxtSums[i] = sums[i];
         for (int i=0; i<R; i++)
            if (!isOn(i, mask) && isOn(i, cur))
               nxtSums[i]--;

         if (go(nxtSums, col+1, cur) != -1)
         {
            res = cur;
            break;
         }
      }

      choice.put(hv, res);
      return res;
   }

   public F(FastScanner in)
   {
      R = in.nextInt();
      C = in.nextInt();
      choice = new HashMap<Long, Integer>();
      rowSum = new int[R];
      colSum = new int[C];
      for (int i=0; i<R; i++) rowSum[i] = in.nextInt();
      for (int i=0; i<C; i++) colSum[i] = in.nextInt();
      relMasks = new ArrayList[R+1];
      for (int i=0; i<R+1; i++)
         relMasks[i] = new ArrayList<Integer>();
      for (int mask=0; mask<(1<<R); mask++)
      {
         int score = 0, last = 0;
         for (int i=0; i<R; i++)
         {
            if (isOn(i, mask))
            {
               if (last == 0)
                  score++;
               last = 1;
            }
            else
            {
               last = 0;
            }
         }
         relMasks[score].add(mask);
      }
 
      int hv = go(rowSum, 0, 0);
      int[] sum = new int[R];
      for (int i=0; i<R; i++) sum[i] = rowSum[i];

      int last = 0;
      int[] grid = new int[C];
      for (int c=0; c<C; c++)
      {
         grid[c] = hv;
         for (int i=0; i<R; i++)
            if (!isOn(i, last) && isOn(i, hv))
               sum[i]--;
      
         last = hv;
         hv = go(sum, c+1, last);
      }

      for (int r=0; r<R; r++)
      {
         for (int c=0; c<C; c++)
         {
            int mask = grid[c];
            System.out.print(isOn(r, mask) ? '*' : '.');
         }
         System.out.println();
      }
   }
}

class FastScanner{
   private InputStream stream;
   private byte[] buf = new byte[1024];
   private int curChar;
   private int numChars;

   public FastScanner()
   {
      stream = System.in;
   }

   int read()
   {
      if (numChars == -1)
         throw new InputMismatchException();
      if (curChar >= numChars){
         curChar = 0;
         try{
            numChars = stream.read(buf);
         } catch (IOException e) {
            throw new InputMismatchException();
         }
         if (numChars <= 0)
            return -1;
      }
      return buf[curChar++];
   }

   boolean isSpaceChar(int c)
   {
      return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
   }
   
   boolean isEndline(int c)
   {
      return c=='\n'||c=='\r'||c==-1;
   }

   int nextInt()
   {
      return Integer.parseInt(next());
   }
   
   long nextLong()
   {
      return Long.parseLong(next());
   }

   double nextDouble()
   {
      return Double.parseDouble(next());
   }

   String next(){
      int c = read();
      while (isSpaceChar(c))
         c = read();
      StringBuilder res = new StringBuilder();
      do{
         res.appendCodePoint(c);
         c = read();
      }while(!isSpaceChar(c));
      return res.toString();
   }
   
   String nextLine(){
      int c = read();
      while (isEndline(c))
         c = read();
      StringBuilder res = new StringBuilder();
      do{
         res.appendCodePoint(c);
         c = read();
      }while(!isEndline(c));
      return res.toString();
   }
}