#include using namespace std; typedef long long int ll; ll MOD = 1000000007; ll INFL = 1ll << 60; ll INF = 1 << 28; // ==================================================================== int main() { int n, k; cin >> n >> k; bool v[1010][1010]; for (int i = 0; i < 1010; i++) for (int j = 0; j < 1010; j++) v[i][j] = false; bool end = false; int count = 0, c = 0, ny = 0, nx = 0, l = 0; for (int i = 0; true; i++) { for (int w = 0; w < k; w++) { for (int y = 0; y < w; y++) { if (count >= n) break; v[ny + y][nx + w] = true; count++; } if (count >= n) { l = i * k + w; break; } for (int x = 0; x < w + 1; x++) { if (count >= n) break; v[ny + w][nx + x] = true; count++; } if (count >= n) { l = i * k + w; break; } } if (count >= n) break; ny += k, nx += k; } int m = l + 1; cout << m << endl; for (int y = 0; y < m; y++) { for (int x = 0; x < m; x++) { cout << ((v[y][x]) ? '#' : '.'); } cout << endl; } }