#include "bits/stdc++.h" using namespace std; int main(){ int n,k; cin >> n >> k; int m = n / (k*k) * k; int r = n / (k*k); int more = 0; for(int i = 0; i < k; i++){ if(r <= i*i) more = i; else break; } m += more; cout << m << endl; for(int i = 0; i < m; i++){ for(int j = 0; j < m; j++){ if(n != 0 && i/k == j/k){ cout << '#'; n--; }else{ cout << '.'; } } cout << endl; } }