var
n,t0,i:longint;
d:array[0..100001]of char;
f0,f1:array[0..100001]of longint;
procedure cheng(l,r:longint);
var z:longint;
begin
for z:=l to r do
begin
f0[z]:=f0[z-1]*2+f1[z-1];
f1[z]:=f1[z-1];
end;
f1[l]:=f1[r];
f0[l]:=f0[r];
end;
//_______________________________
procedure jia(l,r:longint);
var x,z:longint;
begin
for z:=l to r do
begin
f0[z]:=f0[z-1];
f1[z]:=f1[z-1]*2+f0[z-1];
end;
f0[l]:=f0[r];
f1[l]:=f1[r];
end;
//_________________________________
procedure check(l,r:longint);
var x,y,z:longint;
begin
{x:=l+1;
while (d[x]<>'(')and(x<n)do inc(x);
if x<>n then
begin
y:=r-1;
while (d[y]<>')')and(x>0)do dec(y);
f0[x]:=color;f1[y]:=color;
check(color-1,x,y);
end; }
f1[l+1]:=1;
f0[l+1]:=1;
z:=l;
while z<r-1 do
begin
inc(z);
if d[z]='*'then
begin
x:=z;
while d[z+1]='*' do inc(z);
cheng(x,z);
end;
if d[z]='+'then
begin
x:=z;
while d[z+1]='+' do inc(z);
jia(x,z);
end;
if d[z]='('then
begin
x:=r-1;
while d[x]<>')' do dec(x);
check(z,x);
end;
end;
f0[l]:=f0[r-1];
f1[l]:=f1[r-1];
f0[r]:=f0[r-1];
f1[r]:=f1[r-1];
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]);
check(0,n+1);
write(f0[0]);
close(input);
close(output);
end.