#include using namespace std; typedef long long ll; typedef pair P; #define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0) int main() { int n,k; cin >> n >> k; int m = (n+k*k-1)/(k*k)*k; if (k*k > n) m = ceil(sqrt(n)); cout << m << endl; vector x(m,0),y(m,0); for (int i = 0;i < m;++i) { for (int j = 0;j < m;++j) { if (n && x[i] < k && y[j] < k) cout << "#",n--,x[i]++,y[j]++; else cout << "."; } cout << "\n"; } }