def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
@m=[]
def solve(cal,a,len,x)
  return if(a[x] == nil)
  ans = (cal == "+")? 0 : 1
  while(a[x].size >= len)
  if((a[x][-1] == "+" or a[x][-1] == "*") and a[x].size == len)
    @m.push(a[x][-1])
    ans += solve(a[x][-1],a,len+1,x+1) if(cal == "+")
    ans *= solve(a[x][-1],a,len+1,x+1) if(cal == "*")
  else
    if cal == "+"
      ans += (a[x].size == len)?  a[x][-1].to_i : 0
    else
      ans *= (a[x].size == len)?  a[x][-1].to_i : 1  
    end
  end
  x+=1
  break if(a[x] == nil)
  end
  return ans
end
while((n = inp[0])!=nil)
  if(n == 1)
    puts inp[0]
    next
  end
  tab = []
  n.times do 
    tab.push(gets.chomp)
  end
  ans = solve(tab[0],tab,1,0) 
  if(ans == nil)
    exit
  end
  p ans 
end