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