#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; int M = (N + K - 1) / K; int X = sqrt(N - 1e-9) + 1; M = max(M, X); vector res(M, string(M, '.')); for (int i = 0; i < M; i++) { for (int j = 0; j < M; j++) { if ((i + j) % M < K) { if (N > 0) { res[i][j] = '#'; } N--; } } } cout << M << endl; for (int i = 0; i < M; i++) { cout << res[i] << endl; } }