program color;
type
fxz=array[0..75] of longint;
var
f1,f2:text;
a,c:fxz;
i,j,k,n,ans:longint;
procedure sc(x:longint);
var
i:longint;
begin if x=n+1 then begin inc(ans);ans:=ans mod 1000000007;end
else for i:=1 to k do
if (c[i]<>0)and(a[x-1]<>i)
then begin a[x]:=i;
dec(c[i]);
sc(x+1);
inc(c[i]);
end;
end;
begin
assign(f1,'color.in');
assign(f2,'color.out');
reset(f1);rewrite(f2);
readln(f1,k);
n:=0;
for i:=1 to k do
begin
read(f1,c[i]);
n:=n+c[i];
end;
ans:=0;a[0]:=0;
sc(1);
writeln(f2,ans);
close(f1);close(f2);
end.