import std.algorithm;
import std.ascii;
import std.stdio;
import std.string;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		int res = 0;
		foreach (c; s)
		{
			if (c.isLower)
			{
				res -= c - 'a' + 1;
			}
			else if (c.isUpper)
			{
				res += c - 'A' + 1;
			}
		}
		writeln (res);
	}
}
