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