#include #define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++) #define rep(i, begin, end) for(int i = int(begin); i < int(end); i++) #define all(v) v.begin(), v.end() #define lint long long auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;}; auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;}; void debug_impl() { std::cerr << std::endl; } template void debug_impl(Head head, Tail... tail){ std::cerr << " " << head; debug_impl(tail...); } #define debug(...)\ std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\ debug_impl(__VA_ARGS__);\ std::cerr << std::noboolalpha; template auto make_vector_impl(size_t sz, T t) {return std::vector(sz, t);} template = nullptr> auto make_vector(size_t sz, U u) {return make_vector_impl(sz, T(u));} template = nullptr> auto make_vector(size_t sz) {return std::vector(sz);} template = nullptr> auto make_vector(size_t a, Args... args) {return make_vector_impl(a, make_vector(args...));} template auto& at(T& t, Size_t i) {return t.at(i);} template auto& at(T& t, Size_t i, Args... args) {return at(t.at(i), args...);} template std::istream& operator>> (std::istream& is, std::vector& v) { for (auto & x : v) is >> x; return is; } template std::ostream& operator<< (std::ostream& os, const std::vector& v) { auto n = v.size(); os << "{"; for (size_t i = 0; i < n; i++) {os << (i > 0 ? "," : "") << v.at(i);} return os << "}"; } int main() { std::cin.tie(0); std::cin.sync_with_stdio(false); int n, k; std::cin >> n >> k; auto N = n / k + 10; auto ret = make_vector< 2, int >(N, N, false); auto cnt = 0; bool flg = false; rep(i, 0, N) rep(j, 0, N) { if ((i + j) % N < k) { at(ret, i, j) = true; if (++cnt == n) { flg = true; break; } } if (flg) break; } std::cout << N << std::endl; for (auto& v : ret) { for (auto x : v) { std::cout << (x ? '#' : '.'); } std::cout << std::endl; } return 0; }