var i:string;
j,k,q:integer;
begin
while not eof do begin
readln(i);
q:=0;
if i='0' then exit;
j:=length(i);
for k:= 1 to j do begin
i[k]:=upcase(i[k]);
if (ord(i[k])-64>0) and (ord(i[k])-64<27) then q:=q+(ord(i[k])-64)
else writeln('Fail');
end;
writeln(q);
end;
end.