var s,n:integer;
begin
s:=0;
readln(n);
while n>0 do begin
if ((n mod 10) mod 2 = 0) and (n mod 10>=5) then
s:=s+n mod 10;
n:=n div 10;
end;
writeln(s);
end.
var s,n:integer;
begin
s:=0;
readln(n);
while n>0 do begin
if ((n mod 10) mod 2 = 0) and (n mod 10>=5) then
s:=s+n mod 10;
n:=n div 10;
end;
writeln(s);
end.