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 m = (n + k - 1) / k; int mod = n % k; StringBuilder sb = new StringBuilder(); for (int i = 0; i < m; i++) { char[] arr = new char[m]; for (int j = 0; j < m; j++) { if (((i >= mod) && (i + j) % m < k) || ((i < mod) && (i + j) % m < k - 1)) { arr[j] = '#'; } else { arr[j] = '.'; } } sb.append(arr).append("\n"); } System.out.println(m); System.out.print(sb); } }