xiaozqh
[srcbox.git] / rqnoj / rqnoj68.pas
blob11421debf0761f568ec62e0401cc883d9395e7e5
1 var
2 n:string;
3 k,i,j:longint;
4 a:array [0..33] of longint;
5 ans:qword;
7 begin
8 readln(n);
9 p:=pos(' ',n);
10 val(copy(n,p+1,length(n)),k);
11 delete(n,p,length(n));
12 for i:=1 to k do
13 begin
14 readln(x,y);
15 for j:=1 to length(n) do
16 if ord(n[j])-ord('0')=x then inc(a[j]);
17 end;
18 for i:=1 to length(n) do
19 ans:=ans*(a[i]+1);
20 writeln(ans);
21 end.