#include <bits/stdc++.h>
using namespace std;
long long sum = 0;
int main() {
  char c;
  while (cin >> c) {
    if (isalpha(c)) sum += isupper(c) ? c - 'A' + 1 : -(c - 'a' + 1);
  }
  cout << sum;
  return 0;
}
