#include using namespace std; #define int long long #define FOR(i, s, n) for (int i = (s); i < (int)(n); i++) #define RFOR(i, s, n) for (int i = (n) - 1; i >= (int)(s); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define ALL(a) a.begin(), a.end() constexpr long long INF = 1e18; templateinline bool CHMAX(T&a,T b){if(ainline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;} signed main(){ int N,K; cin >> N >> K; int gridSize = (N+K-1)/K; vector>a(gridSize,vector(gridSize,'.')); int cnt = N; for(int i = 0;i < gridSize;){ for(int j = 0;j < gridSize;){ REP(k,K){ REP(l,K){ if(cnt == 0)break; a[i+k][j+l] = '#'; cnt--; } } i += K; j += K; } } cout << gridSize << endl; REP(i,gridSize){ REP(j,gridSize){ if(j)cout << " "; cout << a[i][j]; } cout << endl; } }