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