#include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; /*-------------------------------------------------*/ signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); // freopen("input.txt", "r", stdin); int n, k; cin >> n >> k; int block = n / (k * k); int nokori = 0; while (nokori * nokori < n - block * k * k) ++nokori; int m = block * k + nokori; vector > a(m, vector(m, '.')); REP(i, block) { FOR(y, k * i, k * i + k) FOR(z, k * i, k * i + k) a[y][z] = '#'; } n -= block * k * k; FOR(i, k * block, m) FOR(j, k * block, m) { if (n > 0) { a[i][j] = '#'; --n; } } cout << m << '\n'; REP(i, m) { REP(j, m) cout << a[i][j]; cout << '\n'; } return 0; }