Program lol (input, output); var a, n, b, p,s, m:integer; c:real; begin read (n); a:=n; b:=0; c:=0; p:=1; while a <> 0 do begin a:=a div 10; b:=b+1; end; while b <> 0 do begin p:=1; for m:=1 to b do p:=p*10; s:=(n mod p) div (p div 10); if s > 7 then c:=c+s; b:=b-1; end; writeln (c); end.
var a, n, b, p,s, m:integer;
c:real;
begin
read (n);
a:=n;
b:=0;
c:=0;
p:=1;
while a <> 0 do
begin
a:=a div 10;
b:=b+1;
end;
while b <> 0 do
begin
p:=1;
for m:=1 to b do
p:=p*10;
s:=(n mod p) div (p div 10);
if s > 7 then
c:=c+s;
b:=b-1;
end;
writeln (c);
end.