// #pragma GCC optimize("Ofast") // #pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; // #define int ll using pii = pair<int, int>; mt19937 rnd(42432); const ll M = 4e12 + 1; char a[2028][2028]; int pref[2028][2028]; inline void rebuild() { for (int i = 0; i <= 2025; i++) { for (int j = 0; j <= 2025; j++) { pref[i][j] = (a[i][j] != '?'); if (i) pref[i][j] += pref[i - 1][j]; if (j) pref[i][j] += pref[i][j - 1]; if (i && j) pref[i][j] -= pref[i - 1][j - 1]; } } } inline int get(int i, int j, int x, int y) { int ans = pref[x][y]; if (i) ans -= pref[i - 1][y]; if (j) ans -= pref[x][j - 1]; if (i && j) ans += pref[i - 1][j - 1]; return ans; } const int N = 2025; int CNT= 0; int max_x = 0; int max_y = 0; bool try_place(int n, int m) { for (int i = 0; i + n <= N; i++) { for (int j = 0; j + m <= N; j++) { if (a[i][j] != '?') continue; int g = get(i, j, i + n - 1, j + m - 1); if (g != 0) continue; for (int x = 0; x <= n; x++) { for (int y = 0; y <= m; y++) { if (x == n || y == m) a[i + x][j + y] = '.'; else a[i + x][j + y] = '#'; CNT++; } } return true; } } return false; } pair<ll, pii> all[N * N]; void solve() { CNT = 0; ll k = 1e6 + rnd() % 1000; cin >> k; int n = 2025; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) a[i][j] = '?'; } int t = 0; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { ll cur = 1ll * i * j * (i - 1) * (j - 1) / 4ll; if (cur <= k && cur) { all[t++] = {cur, {i, j}}; } else break; } } int cnt = 0; sort(all, all + t, greater()); for (int i = 0; i < t; i++) { auto [v, px] = all[i]; if (k == 0) break; while (k >= v) { if (!try_place(px.first, px.second) && !try_place(px.second, px.first)) { break; } rebuild(); k -= v; cnt++; if (cnt > 8) exit(1); } } if (k != 0) exit(1); cout << 2025 << " " << 2025 << "\n"; for (int i = 0; i < 2025; i++) { for (int j = 0; j < 2025; j++) { if (a[i][j] == '?') a[i][j] = '.'; cout << a[i][j]; } cout << "\n"; } // for (int i = 0; i < 10; i++) { // for (int j = 0; j < 10; j++) { // if (a[i][j] == '?') // a[i][j] = '.'; // cout << a[i][j]; // } // cout << "\n"; // } // cout << endl; } int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int tt = 1; // cin >> tt; for (int t = 0; t < tt; t++) { solve(); } return 0; }