program ex(f1,f2);
type
zn=array [1..100] of longint;
ka=array [0..1000] of longint;
var
a:zn;
c:ka;
f1,f2:text;
i,j,k,m,ans,n,p,l,step:longint;
procedure dfs(step:longint);
var
i,j,p:longint;
begin
for i:=1 to k do
if (c[step-1]<>i)and(a[i]>0) then
begin
a[i]:=a[i]-1;
c[step]:=i;
if step<n then dfs(step+1) else ans:=(ans+1) mod 1000000007;
a[i]:=a[i]+1;
end;
end;
begin
assign(f1,'color.in'); reset(f1);
assign(f2,'color.out'); rewrite(f2);
readln(f1,k);
for i:=1 to k do read(f1,a[i]);
n:=0;
for i:=1 to k do n:=n+a[i];
ans:=0;
c[0]:=0;
dfs(1);
writeln(f2,ans);
close(f1);
close(f2);
end.