label = input() output = 0 for char in label: output = output * 26 + (ord(char) - ord('A') + 1) print(output)