시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB554100.000%

문제

Your task is to extract $2$ alphabets from a binary tree which is composed of unsigned integers respecting the following rules. Let $n$ be the height of a tree. At the level $k$ ($1≤ k ≤ n$), the tree contains $k$ of nodes and each node has $2$ children nodes (except the leaf nodes at the level n which have no children). See the example below to understand the tree formation. Some nodes may have $2$ parent nodes.

    1
   / \
  4   5
 / \ / \
7   8   9

You need to walk in a tree on the path that has a maximum summation (e.g., $1 + 5 + 9 = 15$). Numbers in each summation cannot cross into different links (e.g., $5+7$ is illegal). Then, your intermediate task is to calculate $2$ numbers for alphabet extraction. The first number is calculated from $\sum_{i=1}^{n}{i^2}$ where $i$ is a number along the maximum summation path and $n$ is the height of a tree. The second number is a summation of the maximum path ($\sum_{i=1}^{n}{i}$). Regarding to the example above, the first number $= 1 + 25 + 81 = 107$ and the second number $= 1 + 5 + 9 = 15$.

Finally, these two numbers are transformed into two lower case alphabets from ‘a’ to ‘z’ respectively, where ‘a’ is used for $0$ and ‘z’ is used for $25$. Since there are only $26$ alphabets, a number greater than $25$ will reuse the same set of alphabets. For example, $107$ = ‘d’ and $15$ = ‘p’ (that is, the first alphabet ‘a’ = $0$, or $26$, or $52$ etc).

Write a program to find the $2$ mysterious alphabets from a given tree.

입력

The first line of input contains the height ($n$) of a tree ($0<n< 100$). The second line contains unsigned integer numbers ($i$) in each level of a tree ($0<i<100$), consecutively. Assume that there is only one maximum path in a tree.

출력

The first line contains two integer calculated from the rules above, and the second line contains $2$ decoded alphabets.

예제 입력 1

3
1 4 5 7 8 9

예제 출력 1

107 15
dp

예제 입력 2

4
1 5 2 5 1 9 3 4 20 1

예제 출력 2

486 32
sg

예제 입력 3

5
2 4 9 1 3 1 1 1 1 2 12 5 4 3 2

예제 출력 3

166 20
ku

예제 입력 4

6
9 8 8 7 7 7 9 1 1 3 8 2 10 5 1 2 3 2 1 9 81

예제 출력 4

6765 109
ff