#include <bits/stdc++.h>
using namespace std;
string a;
int main() {
  int ans = 0;
  getline(cin, a);
  for (int i = 0; i < a.size(); i++) {
    if ((a[i] >= 'A') && (a[i] <= 'Z')) ans += a[i] + 1 - 'A';
    if ((a[i] >= 'a') && (a[i] <= 'z')) ans -= a[i] + 1 - 'a';
  }
  cout << ans;
  return 0;
}
