#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0;
  char c;
  while (cin >> c) {
    if (c >= 'A' && c <= 'Z')
      s += c - 'A' + 1;
    else if (c >= 'a' && c <= 'z')
      s -= c - 'a' + 1;
  }
  cout << s << endl;
  return 0;
}
