#include <bits/stdc++.h>
using namespace std;
int main() {
  int res = 0;
  string t;
  cin >> t;
  for (int i = 0; i < t.size(); i++) {
    int l1 = ('@' < t[i]) && ('[' > t[i]);
    int l2 = ('`' < t[i]) && ('{' > t[i]);
    res += (l1 * ((t[i] | 32) - 'a' + 1)) - (l2 * ((t[i] | 32) - 'a' + 1));
  }
  cout << res << endl;
  return 0;
}
