#include <bits/stdc++.h>
using namespace std;
long long mul(long long a, long long b) { return (a * b) % (100000007); }
long long add(long long a, long long b) { return (a + b) % (100000007); }
long long sub(long long a, long long b) {
  return (a - b + llabs(a - b) / (100000007) * (100000007) + (100000007)) %
         (100000007);
}
void upd(long long &a, long long b) {
  a = (a % (100000007) + b % (100000007)) % (100000007);
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  int p1 = '@', p2 = '[', p3 = '`', p4 = '{';
  string s;
  cin >> s;
  int len = s.length();
  int res = 0;
  for (int i = 0; i < len; i++) {
    if (!isalpha(s[i])) continue;
    int ind = tolower(s[i]) - 'a' + 1;
    int k1 = 0, k2 = 0;
    if (p1 < s[i] && p2 > s[i]) k1 = ind;
    if (p3 < s[i] && p4 > s[i]) k2 = ind;
    res += k1 - k2;
  }
  cout << res << endl;
  return 0;
}
