#include "bits/stdc++.h" using namespace std; void solve() { int n, k; cin >> n >> k; int m = (n + k - 1) / k; if (m * m < n) { m = sqrt(n); if (m * m < n) m++; } cout << m << endl; int l = 0, r = min(k, m); for (int _ = 0; _ < m; _++) { for (int i = 0; i < m; i++) { if (n && ((l <= i && i < r) || (l <= i + m && i + m < r))) { cout << '#'; n--; } else { cout << '.'; } } l++, r++; cout << '\n'; } } int main() { solve(); return 0; }