#include #define rep(i,n) for(int i=0;i ; const ll INF = 1e18; const int MOD = 1000000007; int main(){ int n,k; cin >> n >> k; int p = n / (k * k); int q = n % (k * k); int r; rep(i,k+1){ if(i * i >= q){ r = i; break; } } int m = p * k + r; vector> ans(m,vector(m,'.')); int cnt = 0; rep(i,m)rep(j,m){ if(i/k == j/k && i/k < p) ans[i][j] = '#',cnt ++; else if(i/k == j/k && cnt < n) ans[i][j] = '#',cnt ++; } cout << m << endl; rep(i,m){ rep(j,m) cout << ans[i][j] ; cout << endl; } return 0; }