Var
x, sum: integer;
begin
read(x);
while(x gt; 0) do
if(x mod 10 lt;= 5) then sum := sum + x mod 10;
x := x div 10;
end;
write(sum);
end.
Var
x, sum: integer;
begin
read(x);
while(x gt; 0) do
begin
if(x mod 10 lt;= 5) then sum := sum + x mod 10;
x := x div 10;
end;
write(sum);
end.