#include using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector; using vvi = vector>; using vll = vector; int load() { int n; cin >> n; vector lines(n); for (auto& x : lines) cin >> x; vi pos(n); for (int i = 0; i < n; ++i) pos[i] = find(lines[i].begin(), lines[i].end(), '#') - lines[i].begin(); int res = 1; for (int i = 1; i < n; ++i) { if (pos[i] < pos[i - 1]) res = res * 2 + 1; else res = res * 2; } return res; } void out(int x) { vi pos; pos.push_back(0); while (x > 1) { if (x % 2 == 1) pos.push_back(pos.back() + 1); else pos.push_back(pos.back() - 1); x /= 2; } reverse(pos.begin(), pos.end()); int mn = *min_element(pos.begin(), pos.end()); int mx = *max_element(pos.begin(), pos.end()); int ln = mx - mn + 1; int n = pos.size(); cout << n << '\n'; for (int i = 0; i < n; ++i) { string res(ln, '.'); res[pos[i] - mn] = '#'; cout << res << '\n'; } } void solve() { int a = load(); int b = load(); out(a + b); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; while (t--) { solve(); } return 0; }