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 cnt = ((n as f64).sqrt().ceil() as usize).max(n/k + if n%k>0 { 1 } else { 0 }); println!("{}", cnt); let mut result = vec![vec!["."; cnt]; cnt]; let mut cnts = 0usize; let mut flg = false; for i in 0..cnt { for j in 0..k.min(cnt) { result[i][(j+i)%cnt] = "#"; cnts += 1; if cnts == n { flg = true; break; } } if flg { break; } } for i in 0..cnt { println!("{}", result[i].join("")); } }