#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 = (m + k - 1) / k; 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'; }