#abc285c. [abc285_c]abc285_brutmhyhiizp
[abc285_c]abc285_brutmhyhiizp
Problem Statement
In a parallel universe, AtCoder holds AtCoder Big Contest, where problems are given at once.
The IDs of the problems are as follows, from the -st problem in order: A
, B
, ..., Z
, AA
, AB
, ..., ZZ
, AAA
, ...
In other words, the IDs are given in the following order:
- the strings of length consisting of uppercase English letters, in lexicographical order;
- the strings of length consisting of uppercase English letters, in lexicographical order;
- the strings of length consisting of uppercase English letters, in lexicographical order;
Given a string that is an ID of a problem given in this contest, find the index of the problem. (See also Samples.)
Constraints
- is a valid ID of a problem given in AtCoder Big Contest.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
AB
Sample Output 1
28
The problem whose ID is AB
is the -th problem of AtCoder Big Contest, so should be printed.
Sample Input 2
C
Sample Output 2
3
The problem whose ID is C
is the -rd problem of AtCoder Big Contest, so should be printed.
Sample Input 3
BRUTMHYHIIZP
Sample Output 3
10000000000000000
The problem whose ID is BRUTMHYHIIZP
is the -th (last) problem of AtCoder Big Contest, so should be printed as an integer.