Under construction

Still being built. Things may change

Random Number Generator

Time limit1sMemory limit1024 MB

Summary
Given N digits drawn as 9 by 8 pictures of dots and hashes, print the number those digits form.
Level

Easy2 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

Justas bought a random number generator that can produce any positive integer with exactly N digits. Unfortunately, the generator's screen is very small, so the generated number does not fit on it. Instead, the number is shown by displaying its digits one at a time.

Each digit is drawn as a 9 × 8 image made of white and black pixels. If white pixels are drawn as dots (.) and black pixels as hashes (#), the digits look like this:

..#####..  ....##...  .#######.  .#######.  ##.......
.##...##.  ..####...  ##.....##  ##.....##  ##....##.
##.....##  ....##...  .......##  .......##  ##....##.
##.....##  ....##...  .#######.  .#######.  ##....##.
##.....##  ....##...  ##.......  .......##  #########
.##...##.  ....##...  ##.......  ##.....##  ......##.
..#####..  ..######.  #########  .#######.  ......##.
.........  .........  .........  .........  .........
.########  .#######.  .########  .#######.  .#######.
.##......  ##.....##  .##....##  ##.....##  ##.....##
.##......  ##.......  .....##..  ##.....##  ##.....##
.#######.  ########.  ....##...  .#######.  .########
.......##  ##.....##  ...##....  ##.....##  .......##
.##....##  ##.....##  ...##....  ##.....##  ##.....##
..######.  .#######.  ...##....  .#######.  .#######.
.........  .........  .........  .........  .........

Given N digits drawn this way, compute the number that the digits form. The digits are given in order from left to right.

Input

The first line contains the number of digits N. The next 8N lines describe the digits, with each digit described by eight lines. Each line consists of nine characters (. and #).

The first digit is not zero.

Output

Print the number formed by the given digits.

Constraints

1 ≤ N ≤ 5120

Examples1

  1. Example 1

    Input
    4
    .#######.
    ##.....##
    .......##
    .#######.
    ##.......
    ##.......
    #########
    .........
    ..#####..
    .##...##.
    ##.....##
    ##.....##
    ##.....##
    .##...##.
    ..#####..
    .........
    ....##...
    ..####...
    ....##...
    ....##...
    ....##...
    ....##...
    ..######.
    .........
    .########
    .##....##
    .....##..
    ....##...
    ...##....
    ...##....
    ...##....
    .........
    
    Expected output
    2017