#include <bits/stdc++.h>
using namespace std;
char s[100];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int br = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z')
      br += s[i] - 'A' + 1;
    else if (s[i] >= 'a' && s[i] <= 'z')
      br -= s[i] - 'a' + 1;
  }
  printf("%d\n", br);
  return 0;
}
