#include <bits/stdc++.h>
using namespace std;
long long a;
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++)
    if (s[i] >= 'a' && s[i] <= 'z')
      a -= s[i] + 1 - 'a';
    else if (s[i] >= 'A' && s[i] <= 'Z')
      a += s[i] + 1 - 'A';
  cout << a;
  return 0;
}
