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