#include <bits/stdc++.h>
using namespace std;
string s;
char c;
long ans, l;
int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  l = s.length();
  for (int i = 0; i < l; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') ans += s[i] - 'A' + 1;
    if (s[i] >= 'a' && s[i] <= 'z') ans -= s[i] - 'a' + 1;
  }
  cout << ans;
}
