#include <bits/stdc++.h> using namespace std; #define nl "\n" #define nf endl #define ll long long #define pb push_back #define _ << ' ' << int main() { ios::sync_with_stdio(0); cin.tie(0); ll K; cin >> K; ll N = 2025; vector mt(N + 1, vector<ll>(N + 1, 0)); auto calc = [&](ll n, ll m, ll k) { ll a = n * (n - 1) * m * (m - 1); a /= 4; ll b = n * k * (k - 1); b /= 2; // cout << "calc" _ n _ m _ k _ a _ b << nf; return a + b; }; auto append = [&](ll x1, ll y1, ll n, ll m, ll k) { // cout << "append" _ x1 _ y1 _ n _ m _ k << nf; for (ll i = x1; i < x1 + n; i++) { for (ll j = y1; j < y1 + m; j++) { assert(i <= N && j <= N); mt[i][j] = 1; } } ll i = x1 + n; for (ll j = y1; j < y1 + k; j++) { assert(i <= N && j <= N); mt[i][j] = 1; } }; ll curr_x1 = 2, curr_y1 = 2; while (K != 0) { ll n = 0, m = N - curr_y1; for (;; n++) { if (calc(n, m, 0) > K) { n--; break; } } ll k = 0; for (;; k++) { if (calc(n, m, k) > K) { k--; break; } } // cout << "n, m, k, calc =" _ n _ m _ k _ calc(n, m, k) << nf; append(curr_x1, curr_y1, n, m, k); if (n < m) { curr_x1 += n + 2; } else { curr_y1 += m + 1; } K -= calc(n, m, k); } for (ll i = 1; i <= N; i++) { for (ll j = 1; j <= N; j++) { if (mt[i][j] == 1) cout << '#'; else cout << '.'; } cout << nl; } }