#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """20 4 # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 def solve(N, K): for M in range(1, INF): if M <= K: if N <= M*M: A = [['#'] * M for _ in range(M)] return M, A else: if N <= K*M: A = [['.'] * M for _ in range(M)] j = 0 for i in range(M): for _ in range(K): A[i][j] = '#' j = (j + 1) % M return M, A return None, None N, K = map(int, input().split()) M, A = solve(N, K) print(M) for i in range(M): print(''.join(A[i]))