use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let k: usize = itr.next().unwrap().parse().unwrap(); let m = (n + k * k - 1) / (k * k) * k; let mut ans: Vec> = vec![vec!['.'; m]; m]; let mut a = 0; let mut b = 0; 'out: loop { for i in k * a..k * a + k { for j in k * a..k * a + k { ans[i][j] = '#'; b += 1; if b == n { break 'out; } } } a += 1; } let mut out = Vec::new(); writeln!(out, "{}", m).ok(); for i in 0..m { let s: String = ans[i].clone().into_iter().collect(); writeln!(out, "{}", s).ok(); } stdout().write_all(&out).unwrap(); }