D - Digital Display /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 7

注意

この問題に対する言及は、2020/6/6 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。

問題文

N 桁の数字列を表示する電光掲示板があります。 この電光掲示板は 54N+1 列に並べられたランプにより構成されます。 1 \leq j \leq N を満たす j について、左から j 桁目の数字の表示には左から 4j-2,4j-1,4j 列目のランプが用いられます。 それ以外の 1,5, \ldots, 4N+1 列目のランプは全て消灯しています。

電光掲示板の表示の状況は 5 つの長さ 4N+1 の文字列 s_1,s_2,s_3,s_4,s_5 により表されます。 具体的には、1 \leq i \leq 5, 1 \leq j \leq 4N+1 を満たす (i,j) について、 s_{i} の先頭から j 番目の文字は上から i 行目、左から j 列目のランプの点灯状況を表しています。

文字列中の # は対応する位置のランプが点灯していることを、. は消灯していることを表します。

電光掲示板に表示されている N 桁の数字列を出力してください。

各数字の表示の仕方については入力例 1 を参考にしてください。

制約

  • 1 \leq N \leq 50
  • s_1,s_2,s_3,s_4,s_5#. のみからなる長さ 4N+1 の文字列
  • s_1,s_2,s_3,s_4,s_51,5, \ldots, 4N+1 文字目は全て .
  • 入力に対応する数字列が必ず存在し、各数字の表示の仕方は入力例 1 のものと同様

入力

入力は以下の形式で標準入力から与えられる。

N
s_1
s_2
s_3
s_4
s_5

出力

電光掲示板で表示されている N 桁の数字列を出力せよ。


入力例 1

10
.###..#..###.###.#.#.###.###.###.###.###.
.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.
.#.#..#..###.###.###.###.###...#.###.###.
.#.#..#..#.....#...#...#.#.#...#.#.#...#.
.###.###.###.###...#.###.###...#.###.###.

出力例 1

0123456789

入力例 2

29
.###.###.###.###.###.###.###.###.###.#.#.###.#.#.#.#.#.#.###.###.###.###..#..###.###.###.###.###.#.#.###.###.###.###.
...#.#.#...#.#.#.#.#.#...#.#...#.#.#.#.#.#...#.#.#.#.#.#.#.....#.#.#.#.#.##..#.#...#.#.#...#.#...#.#...#.#.....#...#.
.###.#.#...#.###.#.#.###.###...#.###.###.###.###.###.###.###...#.###.#.#..#..###...#.###.###.###.###.###.###.###.###.
.#...#.#...#...#.#.#.#.#...#...#.#.#...#.#.#...#...#...#.#.#...#...#.#.#..#..#.#...#...#.#...#.#...#.#.....#...#.#...
.###.###...#.###.###.###.###...#.###...#.###...#...#...#.###...#.###.###.###.###...#.###.###.###...#.###.###.###.###.

出力例 2

20790697846444679018792642532

Score : 7 points

Warning

Do not make any mention of this problem until June 6, 2020, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).

Problem Statement

We have an electric bulletin board that shows an N-digit number. The board is made of a grid of lamps with 5 rows and 4N+1 columns. For each j such that 1 \leq j \leq N, the j-th digit from the left is displayed using the lamps in the (4j-2)-th, (4j-1)-th, and (4j)-th columns from the left. All the remaining lamps in the 1-st, 5-th, \ldots, (4N+1)-th columns are off.

The state of the board is represented by five strings of length 4N+1 each: s_1, s_2, s_3, s_4, and s_5. More specifically, for each pair (i,j) such that 1 \leq i \leq 5 and 1 \leq j \leq 4N+1, the j-th character of s_{i} repsesents the state of the lamp at the i-th row from the top and the j-th column from the left.

The characters # and . stand for "on" and "off" states, respectively.

Print the sequence of digits displayed on the board.

To see how the board displays each digit, refer to Sample Input 1.

Constraints

  • 1 \leq N \leq 50
  • s_1, s_2, s_3, s_4, and s_5 are strings of length 4N+1 each and consist of # and ..
  • The 1-st, 5-th, \ldots, (4N+1)-th characters of each of the strings s_1, s_2, s_3, s_4, and s_5 are all .s.
  • The input is a valid representation of a sequence of digits in the same way as in Sample Input 1.

Input

Input is given from Standard Input in the following format:

N
s_1
s_2
s_3
s_4
s_5

Output

Print the N-digit sequence displayed on the board.


Sample Input 1

10
.###..#..###.###.#.#.###.###.###.###.###.
.#.#.##....#...#.#.#.#...#.....#.#.#.#.#.
.#.#..#..###.###.###.###.###...#.###.###.
.#.#..#..#.....#...#...#.#.#...#.#.#...#.
.###.###.###.###...#.###.###...#.###.###.

Sample Output 1

0123456789

Sample Input 2

29
.###.###.###.###.###.###.###.###.###.#.#.###.#.#.#.#.#.#.###.###.###.###..#..###.###.###.###.###.#.#.###.###.###.###.
...#.#.#...#.#.#.#.#.#...#.#...#.#.#.#.#.#...#.#.#.#.#.#.#.....#.#.#.#.#.##..#.#...#.#.#...#.#...#.#...#.#.....#...#.
.###.#.#...#.###.#.#.###.###...#.###.###.###.###.###.###.###...#.###.#.#..#..###...#.###.###.###.###.###.###.###.###.
.#...#.#...#...#.#.#.#.#...#...#.#.#...#.#.#...#...#...#.#.#...#...#.#.#..#..#.#...#...#.#...#.#...#.#.....#...#.#...
.###.###...#.###.###.###.###...#.###...#.###...#...#...#.###...#.###.###.###.###...#.###.###.###...#.###.###.###.###.

Sample Output 2

20790697846444679018792642532