loop do

  n = gets.to_i
  if n == 0 then break end

  dimp = 0
  dimn = 0
  tmp = ''

  optr = Array.new(n + 1, '?')
  opnd = Array.new(n + 1).map{Array.new}

  for i in 0 .. n - 1
    
    keynext = gets.chomp.chars
    
    dimn = keynext.count('.')
    tmp  = keynext[-1]

    #p optr, opnd

    if dimn < dimp
 
      opcnt = dimp - dimn

      while opcnt > 0

        tmpresult = opnd[dimp].shift

        while opnd[dimp].size > 0

          if optr[dimp - 1] == '+'
            tmpresult = tmpresult + opnd[dimp].shift
          elsif optr[dimp - 1] == '*'
            tmpresult = tmpresult * opnd[dimp].shift
          end

          #p tmpresult
        end
        opcnt -= 1
        dimp -= 1

        opnd[dimp] << tmpresult
        #p optr, opnd
      end
    end
    dimp = dimn

    if tmp == '+' || tmp == '*'
      optr[dimn] = tmp
    else
      opnd[dimn].push(tmp.to_i)
    end
  end

  while dimp > 0

    tmpresult = opnd[dimp].shift

    while opnd[dimp].size > 0

      if optr[dimp - 1] == '+'
        tmpresult = tmpresult + opnd[dimp].shift
      elsif optr[dimp - 1] == '*'
        tmpresult = tmpresult * opnd[dimp].shift
      end
    end

    #p optr, opnd

    dimp -= 1
    opnd[dimp] << tmpresult
  end
  puts opnd[dimp]
end



