fn main() { let mut nk = String::new(); std::io::stdin().read_line(&mut nk).ok(); let nk: Vec = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nk[0]; let k = nk[1]; let size = (n / k + if n % k > 0 { 1 } else { 0 }).max((n as f64).sqrt().ceil() as usize); println!("{}", size); let mut grid = vec![vec!["."; size]; size]; let mut cnt = 0usize; for i in 0..size { for j in 0..k.min(size) { grid[i][(i+j)%size] = "#"; cnt += 1; if cnt == n { break; } } if cnt == n { break; } } for i in 0..size { println!("{}", grid[i].join("")); } }