var
s: string;
i,n: integer;
begin
readln(s);
n:=1;
for i:=1 to length(s) do
if ((s[i]='3') or (s[i]='6') or (s[i]='9')) then
n:=n*(ord(s[i])-48);
write(n);
end.
var
s: string;
i,n: integer;
begin
readln(s);
n:=1;
for i:=1 to length(s) do
if ((s[i]='3') or (s[i]='6') or (s[i]='9')) then
n:=n*(ord(s[i])-48);
write(n);
end.