var
A,S,i:integer;
procedure summ(a:integer;var s:integer);
var
k:integer;
t:boolean;
begin
t:=false;
k:=a;
if k<10 then k:=k+10;<br> repeat
t:=(k mod 10=5);
k:=k div 10;
until (k=0) or t;
if not t then
s:=s+a;
end;
begin
S:=0;
for i:=1 to 4 do begin
write(I,' число =');
readln(A);
summ(A,S);
end;
writeln('S=',S);
end.