import string
import sys

ncalls = {}
tottime = {}
stack = []

i = 0
first = None
for line in sys.stdin.readlines() :
    i = i + 1
    if not i%1000 : sys.stderr.write('%i lines processed\n'%(i))
    k, v = string.split(line,'$')
    k = string.strip(k)
    v = string.strip(v)
    begend = k[:string.index(k,' ')]
    func = k[string.index(k,' '):]
    if begend == 'begin' :
        stack.append( (func, v) )
        ncalls[func] = ncalls.get(func,0) + 1
    elif begend == 'end' :
        if stack[-1][0] != func :
            print 'glouk ?', stack,line,'line',i
            stack.pop()
        else :
            f,begin_clock = stack.pop()
            tottime[func] = tottime.get(func,0.0) + float(v)-float(begin_clock)
    if not first : first = func

print 'function\tncalls\ttottime\tpercall\tpercent'
for k,v in ncalls.items() :
    try:
        print '%s;%s;%f;%f;%f' %(k,v,tottime[k],tottime[k]/v,tottime[k]*100/tottime[first])
    except:
        print k,'????'
        
            
