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