Communication

No attempts yetTime limit1sMemory limit128 MB

Problem

A kindergarten for small mathematicians has to teach its pupils to talk to each other, so every two rooms in the building must be joined by one computer network. For this problem the building is a box with VV floors, and one floor holds R×SR \times S rooms. The rooms have to be joined as cheaply as possible. A line between two rooms that share a wall on the same floor costs 1000 korunas, and a line between two rooms stacked on top of each other, where the ceiling of one room is the floor of the other, costs 2000 korunas. Some rooms are already joined, which makes the count harder. Write a program that computes the minimum cost of joining every room into one network.

A line can only be laid between two neighbouring rooms, and two rooms joined through a chain of lines can talk to each other as well.

Input

The input consists of several blocks. One block describes one building. The first line of a block holds three integers VV, RR and SS (1V,R,S631 \le V, R, S \le 63). The last block of the input starts with 0 0 0 and is not processed.

After the first line come the plan of the ground floor, the plan of the links between the ground floor and the first floor, the plan of the first floor, the plan of the links between the first floor and the second floor, and so on, ending with the plan of the top floor. A blank line follows every floor plan and every link plan.

The plan of one floor consists of 2R12R-1 lines, and each line holds 2S12S-1 characters. Counting lines and columns from one, a * on an odd line in an odd column is a room. Between two characters that stand for rooms on the same line there is either -, meaning the two rooms are already joined, or ., meaning they are not. On even lines the even columns always hold ., and the odd columns hold either . or |. A | means the two rooms drawn directly above and directly below it are already joined.

The plan of the links between two floors also consists of 2R12R-1 lines, and each line holds 2S12S-1 characters. Even lines hold only .. On odd lines the even columns hold ., and the odd columns hold either . or o. An o means the room at that position on the lower floor and the room at the same position on the upper floor are already joined.

Output

Print one line per building. If every room of the building is already joined into one network, print

Budova je jiz dostatecne propojena.

otherwise print

Ocekavana cena: XXXX Kc

where XXXX is the minimum cost of joining every room. Write the cost with a comma after every third digit counted from the right, so 3000 is written 3,000 and 518000 is written 518,000.