URI Online Judge | 1803 | [PJ][P1]

Matring

By M.C. Pinto, UNILA BR Brazil

Timelimit: 1

Matring is a mix of Matrix and String. It was developed by UNILA (Union of Nerds for Integration of Logic and Adventure) to keep messages safe from eavesdropping.

The first and last column of a matring keep the key to translate it to the real message. The remaining columns of a matring represent an ASCII-coded string, one column per character.

For a N-character long message, the corresponding matring is a 4x(N+2) matrix of digits. Each column is read as a 4-digit number; a top to bottom sequence of digits is the same as a left to right sequence in horizontal.

Let the first number be F, the last number be L and the remaining ones to be a sequence of numbers Mi, where 1 ≤ iN. The first column of a matring is indexed as zero.

To decode a matring to an string, we must calculate: Ci = (F * Mi + L) mod 257, where Ci is the ASCII-coded character of the original message at position i.

Your task is to develop an algorithm to decode matrings.

Input

The input is a matring, i.e. a 4x(N+2) matrix of digits (from 0 to 9), 0 < N < 80.

Output

The output is given in one single line and is the decoded string. Include the end-of-line character after the string.

Input Samples Output Samples

41805
99934
39127
23659

OBI

5686702
0531447
5115038
2795214

UNILA

28665943
68409984
86877400
51804393

Hodor!