#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int N = 100006;
int n;
char s[55];
int main() {
  scanf("%s", s);
  int ans = 0;
  for (int i = 0; i < strlen(s); 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 << endl;
}
