const
shu:array[0..9,0..9] of integer=((0,1,0,0,0,0,0,1,1,0)
,(1,0,0,1,1,0,0,1,1,1)
,(0,0,0,0,0,0,0,0,1,0)
,(0,1,0,0,0,0,0,1,1,1)
,(0,1,0,0,0,0,0,0,1,1)
,(0,0,0,0,0,0,1,0,1,1)
,(0,0,0,0,0,1,0,0,1,0)
,(1,1,0,1,0,0,0,0,1,1)
,(1,1,1,1,1,1,1,1,0,1)
,(0,1,0,1,1,1,0,1,1,0));
var
num,i,lst:integer;
st:string;
z,tj:array[1..10] of integer;
procedure try(n:integer);
var
i:integer;
begin
i:=0;
if n>lst then for i:=1 to (n-1) do num:=num*tj[i];
for i:=0 to 9 do tj[n]:=tj[n]+shu[z[n],i];
try(n+1);
end;
begin
num:=1;
read(st);
lst:=length(st);
for i:=1 to lst do z[i]:=ord(st[i])-48;
try(1);
writeln(num);
writeln;
end.
shu:array[0..9,0..9] of integer=((0,1,0,0,0,0,0,1,1,0)
,(1,0,0,1,1,0,0,1,1,1)
,(0,0,0,0,0,0,0,0,1,0)
,(0,1,0,0,0,0,0,1,1,1)
,(0,1,0,0,0,0,0,0,1,1)
,(0,0,0,0,0,0,1,0,1,1)
,(0,0,0,0,0,1,0,0,1,0)
,(1,1,0,1,0,0,0,0,1,1)
,(1,1,1,1,1,1,1,1,0,1)
,(0,1,0,1,1,1,0,1,1,0));
var
num,i,lst:integer;
st:string;
z,tj:array[1..10] of integer;
procedure try(n:integer);
var
i:integer;
begin
i:=0;
if n>lst then for i:=1 to (n-1) do num:=num*tj[i];
for i:=0 to 9 do tj[n]:=tj[n]+shu[z[n],i];
try(n+1);
end;
begin
num:=1;
read(st);
lst:=length(st);
for i:=1 to lst do z[i]:=ord(st[i])-48;
try(1);
writeln(num);
writeln;
end.