#include using namespace std; using ll = long long; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define REP(i, n) FOR(i, 0, n) #define REP1(i, n) FOR(i, 1, (n) + 1) #define ALL(c) (c).begin(), (c).end() template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} const int MOD = 1000000007; const int INF = 1000000001; int main() { int n, k; cin >> n >> k; int x = (n + k - 1) / k; cout << x << endl; int z = 0; int c = 0; REP(i, x) { REP(j, x) { if (c < n && j >= z && j < z + k) { cout << "#"; c++; } else if (c < n && i >= x - (k - 1) && j < k - (x - i)) { cout << "#"; c++; } else { cout << "."; } } cout << endl; z++; } }