var
n,t0,i:longint;
d:array[0..100001]of char;
function check(l,r:longint):longint;
var x,tt0,z:longint;
begin
tt0:=1;
z:=l;
while z<=r do
begin
if d[z]='*'then tt0:=tt0*3;
if d[z]='('then
begin
x:=n;
while d[x]<>')'do dec(x);
d[x]:=' ';
tt0:=tt0*check(z+1,x-1);
z:=x;
end;
inc(z);
end;
check:=tt0;
end;
begin
assign(input,'exp.in');reset(input);
assign(output,'exp.out');rewrite(output);
readln(n);
for i:=1 to n do read(d[i]);
write(check(1,n));
close(input);
close(output);
end.