public class Solution_excel2003
{
public int Find(String str)
{
char[] strArr = str.toCharArray();
int exp = 0;
int sum = 0;
for (int i = strArr.length - 1; i >= 0; i--)
{
int num = strArr[i] - 'A' + 1;
sum += num * ((int) Math.pow(26, exp));
exp++;
}
return sum;
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
while (sc.hasNext())
{
String str = sc.nextLine();
Solution_excel2003 find = new Solution_excel2003();
System.out.println(find.Find(str));
}
}
}