#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans(0);
  for (int i = 0; i < s.size(); i++)
    if (isupper(s[i]))
      ans += s[i] - 64;
    else if (islower(s[i]))
      ans -= s[i] - 96;
  cout << ans;
}
