#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using i64 = int64_t; using i32 = int32_t; template void init_n(vector& v, size_t n, U x) { v = vector(n, x); } template void init_n(vector& v, size_t n) { init_n(v, n, T()); } template void read_n(vector& v, size_t n, size_t o = 0) { v = vector(n+o); for (size_t i=o; i> v[i]; } template void read_n(T a[], size_t n, size_t o = 0) { for (size_t i=o; i> a[i]; } template T gabs(const T& x) { return max(x, -x); } #define abs gabs int main() { i64 n, k; cin >> n >> k; i64 bcnt = n / (k * k); i64 rest = n - k * k * bcnt; i64 rh = 1; for (; rh * rh < rest; ++rh); i64 m = bcnt * k + rh; cout << m << '\n'; for (i64 i = 0; i < bcnt; ++i) { for (i64 l = 0; l < k; ++l) { for (i64 j = 0; j < m; ++j) { char c = '.'; if (i * k <= j && j < (i + 1) * k) c = '#'; cout << c; } cout << '\n'; } } for (i64 i = 0; i < rh; ++i) { for (i64 j = 0; j < m; ++j) { char c = '.'; if (j >= m - rh && rest > 0) { c = '#'; --rest; } cout << c; } cout << '\n'; } return 0; }