Scanf.scanf "%d %d" (fun a b ->
    let w = 250 in
    let width = w * 2 in
    let fill len c1 c2 =
        let bar = String.make width c1 in
        let rec loop rest h acc =
            if rest = 0 then h, acc else (
                let rep = min w rest in
                let s = String.init width (fun k ->
                    if k mod 2 = 0 then c1 else
                        if k < rep * 2 then c2 else c1
                )
                in
                loop (rest - rep) (h + 2) (bar :: s :: acc)
            )
        in
        loop len 1 [ bar ]
    in
    let h, l =
        match a, b with
        | 1, _ -> fill b '.' '#'
        | _, 1 -> fill a '#' '.'
        | _    -> let h1, l1 = fill (b - 1) '.' '#' in
                  let h2, l2 = fill (a - 1) '#' '.' in
                  h1 + h2, l1 @ l2
    in
    Printf.printf "%d %d\n" h width;
    List.iter print_endline l
)