#include using namespace std; using ll = long long; int calc(int n, int K) { if (n == 0) return 0; if (n >= K * K) return calc(n - K * K, K) + K; int res = 0; for (int i = 1; i <= K; i++) { if (n <= i * i) { res = i; break; } } return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, K; cin >> n >> K; int m = calc(n, K); cout << m << "\n"; vector ans(m, string(m, '.')); for (int i = 0; i < m; i++) { int ii = i / K; for (int j = 0; j < m; j++) { int jj = j / K; if (ii == jj) { ans[i][j] = '#'; } } cout << ans[i] << "\n"; } return 0; }