import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); System.out.println(selectIndex(s)); } public static int selectIndex(String s) { char[] cha = s.toCharArray(); int count = cha[0] - 'a'; int countTwo = 0; int countThree = 0; int countFour = 0; if (s.length() == 1) { return count*16276; } if (s.length() == 2) { countTwo = cha[1] - 'a'; return count*16276 + countTwo*651 + 1; } if (s.length() == 3) { countTwo = cha[1] - 'a'; countThree = cha[2] - 'a'; return count*16276 + countTwo*651 + countThree*26 + 2; } else { countTwo = cha[1] - 'a'; countThree = cha[2] - 'a'; countFour = cha[3] - 'a'; return count*16276 + countTwo*651 + countThree*26 + countFour +3; } } }