#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int m, k; cin >> m >> k; int n = 1; while (n * min(n, k) < m) ++n; V res(n, string(n, '.')); for (int i = 0; i < n; ++i) { for (int j = 0; j < k; ++j) { if (m) { res[i][(i + j) % n] = '#'; --m; } } } cout << n << '\n'; for (const auto& e : res) cout << e << '\n'; }