import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int size = (n + k - 1) / k; char[][] field = new char[size][size]; for (int i = 0; i < size; i++) { Arrays.fill(field[i], '.'); } int count = 0; StringBuilder sb = new StringBuilder(); sb.append(size).append("\n"); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (((j >= i && (i + k - 1) % size >= j) || (i + k > size && (j >= i || (i + k - 1) % size >= j ))) && count < n) { field[i][j] = '#'; count++; } } sb.append(new String(field[i])).append("\n"); } System.out.print(sb); } }