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