#include <bits/stdc++.h>
char s[1000];
int main() {
  int ans = 0;
  scanf("%s", s);
  for (int i = 0; i < strlen(s); ++i) {
    char c = s[i];
    int t;
    if ('a' <= c && c <= 'z')
      t = c - 'a' + 1;
    else
      t = c - 'A' + 1;
    ans += (('@' < c && '[' > c) - ('`' < c && '{' > c)) * t;
  }
  printf("%d\n", ans);
  return 0;
}
