#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int sum = 0;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    bool x = (s[i] > '@' && s[i] < '[');
    bool y = (s[i] > '`' && s[i] < '{');
    int n = ((s[i] - 64) * x - (s[i] - 96) * y);
    sum += n;
  }
  cout << sum;
}
