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