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