import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); sc.close(); int n2 = (int) Math.ceil(Math.sqrt(n)); if (n2 <= k) { System.out.println(n2); int cnt = 0; for (int i = 0; i < n2; i++) { for (int j = 0; j < n2; j++) { if (cnt < n) { System.out.print('#'); cnt++; } else { System.out.print('.'); } } System.out.println(); } } else { int m = (n + k - 1) / k; System.out.println(m); char[][] a = new char[m][m]; for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { a[i][j] = '.'; } } int cnt = 0; label: for (int i = 0; i < m; i++) { int x = i; for (int j = 0; j < m; j++) { a[j][x] = '#'; cnt++; if (cnt == n) { break label; } x++; if (x == m) { x = 0; } } } for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { System.out.print(a[i][j]); } System.out.println(); } } } }