print "INPUT"

#This program should be run with Python 2.7

#Author: Primoz Prevc

#School: St.Stanislav's Institution

#Country: Slovenia

#Division: Intermediate 3

 

podatki111=[]

podatek1=raw_input("1. ")

podatki111.append(podatek1)

podatki11=podatki111[0]

podatki1=podatki11.split(",")

 

podatki222=[]

podatek2=raw_input("2. ")

podatki222.append(podatek2)

podatki22=podatki222[0]

podatki2=podatki22.split(",")

 

podatki333=[]

podatek3=raw_input("3. ")

podatki333.append(podatek3)

podatki33=podatki333[0]

podatki3=podatki33.split(",")

 

podatki444=[]

podatek4=raw_input("4. ")

podatki444.append(podatek4)

podatki44=podatki444[0]

podatki4=podatki44.split(",")

 

podatki555=[]

podatek5=raw_input("5. ")

podatki555.append(podatek5)

podatki55=podatki555[0]

podatki5=podatki55.split(",")

 

print "OUTPUT"

 

 

#########################################################

system1=podatki1[0]

 

x1=len(podatki1)

 

del podatki1[x1-1]

del podatki1[0]

 

y1=len(podatki1)

 

a1=0

b1=0

c1=0

d1=0

e1=0

f1=0

g1=0

o1=0

j1=0

k1=0

 

for i in range(y1):

    if podatki1[i-1]=="1":

        a1=a1+1

for i in range(y1):

    if podatki1[i-1]=="2":

        b1=b1+2

for i in range(y1):

    if podatki1[i-1]=="3":

        c1=c1+3

for i in range(y1):

    if podatki1[i-1]=="4":

        d1=d1+4

for i in range(y1):

    if podatki1[i-1]=="5":

        e1=e1+5

for i in range(y1):

    if podatki1[i-1]=="6":

        f1=f1+6

for i in range(y1):

    if podatki1[i-1]=="7":

        g1=g1+7

for i in range(y1):

    if podatki1[i-1]=="8":

        o1=o1+8

for i in range(y1):

    if podatki1[i-1]=="9":

        j1=j1+9

for i in range(y1):

    if podatki1[i-1]=="10":

        k1=k1+10

 

 

v1=0

v2=0

v3=0

v4=0

v5=0

v6=0

v7=0

v8=0

v9=0

v10=0

h1=0

h2=0

h3=0

h4=0

h5=0

h6=0

h7=0

h8=0

h9=0

h10=0

 

 

if a1==1:

    v1=v1+16

if b1==2:

    v2=v2+8

if c1==3:

    v3=v3+4

if d1==4:

    v4=v4+2

if e1==5:

    v5=v5+1

if f1==6:

    v6=v6+16

if g1==7:

    v7=v7+8

if o1==8:

    v8=v8+4

if j1==9:

    v9=v9+2

if k1==10:

    v10=v10+1

 

 

if a1==1:

    h1=h1+16

if b1==2:

    h2=h2+16

if c1==3:

    h3=h3+8

if d1==4:

    h4=h4+8

if e1==5:

    h5=h5+4

if f1==6:

    h6=h6+4

if g1==7:

    h7=h7+2

if o1==8:

    h8=h8+2

if j1==9:

    h9=h9+1

if k1==10:

    h10=h10+1

 

 

 

if system1=="A":

    r1=v1+v2+v3+v4+v5+1

    r2=v6+v7+v8+v9+v10+1

elif system1=="H":

    r3=h2+h4+h6+h8+h10+1

    r4=h1+h3+h5+h7+h9+1

 

if system1=="A":

    print "1.",r1,"/",r2

elif system1=="H":

    print "1.",r3,"/",r4

 

####################################################################################3

 

 

system2=podatki2[0]

 

x2=len(podatki2)

 

del podatki2[x2-1]

del podatki2[0]

 

 

y2=len(podatki2)

 

 

a2=0

b2=0

c2=0

d2=0

e2=0

f2=0

g2=0

o2=0

j2=0

k2=0

 

for i in range(y2):

    if podatki2[i-1]=="1":

        a2=a2+1

for i in range(y2):

    if podatki2[i-1]=="2":

        b2=b2+2

for i in range(y2):

    if podatki2[i-1]=="3":

        c2=c2+3

for i in range(y2):

    if podatki2[i-1]=="4":

        d2=d2+4

for i in range(y2):

    if podatki2[i-1]=="5":

        e2=e2+5

for i in range(y2):

    if podatki2[i-1]=="6":

        f2=f2+6

for i in range(y2):

    if podatki2[i-1]=="7":

        g2=g2+7

for i in range(y2):

    if podatki2[i-1]=="8":

        o2=o2+8

for i in range(y2):

    if podatki2[i-1]=="9":

        j2=j2+9

for i in range(y2):

    if podatki2[i-1]=="10":

        k2=k2+10

 

 

v12=0

v22=0

v32=0

v42=0

v52=0

v62=0

v72=0

v82=0

v92=0

v102=0

h12=0

h22=0

h32=0

h42=0

h52=0

h62=0

h72=0

h82=0

h92=0

h102=0

 

 

if a2==1:

    v12=v12+16

if b2==2:

    v22=v22+8

if c2==3:

    v32=v32+4

if d2==4:

    v42=v42+2

if e2==5:

    v52=v52+1

if f2==6:

    v62=v62+16

if g2==7:

    v72=v72+8

if o2==8:

    v82=v82+4

if j2==9:

    v92=v92+2

if k2==10:

    v102=v102+1

 

 

if a2==1:

    h12=h12+16

if b2==2:

    h22=h22+16

if c2==3:

    h32=h32+8

if d2==4:

    h42=h42+8

if e2==5:

    h52=h52+4

if f2==6:

    h62=h62+4

if g2==7:

    h72=h72+2

if o2==8:

    h82=h82+2

if j2==9:

    h92=h92+1

if k2==10:

    h102=h102+1

 

 

 

if system2=="A":

    r12=v12+v22+v32+v42+v52+1

    r22=v62+v72+v82+v92+v102+1

elif system2=="H":

    r32=h22+h42+h62+h82+h102+1

    r42=h12+h32+h52+h72+h92+1

 

if system2=="A":

    print "2.",r12,"/",r22

elif system2=="H":

    print "2.",r32,"/",r42

       

 

##########################################################################

 

system3=podatki3[0]

 

x3=len(podatki3)

 

del podatki3[x3-1]

del podatki3[0]

 

 

 

y3=len(podatki3)

 

 

a3=0

b3=0

c3=0

d3=0

e3=0

f3=0

g3=0

o3=0

j3=0

k3=0

 

for i in range(y3):

    if podatki3[i-1]=="1":

        a3=a3+1

for i in range(y3):

    if podatki3[i-1]=="2":

        b3=b3+2

for i in range(y3):

    if podatki3[i-1]=="3":

        c3=c3+3

for i in range(y3):

    if podatki3[i-1]=="4":

        d3=d3+4

for i in range(y3):

    if podatki3[i-1]=="5":

        e3=e3+5

for i in range(y3):

    if podatki3[i-1]=="6":

        f3=f3+6

for i in range(y3):

    if podatki3[i-1]=="7":

        g3=g3+7

for i in range(y3):

    if podatki3[i-1]=="8":

        o3=o3+8

for i in range(y3):

    if podatki3[i-1]=="9":

        j3=j3+9

for i in range(y3):

    if podatki3[i-1]=="10":

        k3=k3+10

 

 

v13=0

v23=0

v33=0

v43=0

v53=0

v63=0

v73=0

v83=0

v93=0

v103=0

h13=0

h23=0

h33=0

h43=0

h53=0

h63=0

h73=0

h83=0

h93=0

h103=0

 

 

if a3==1:

    v13=v13+16

if b3==2:

    v23=v23+8

if c3==3:

    v33=v33+4

if d3==4:

    v43=v43+2

if e3==5:

    v53=v53+1

if f3==6:

    v63=v63+16

if g3==7:

    v73=v73+8

if o3==8:

    v83=v83+4

if j3==9:

    v93=v93+2

if k3==10:

    v103=v103+1

 

 

if a3==1:

    h13=h13+16

if b3==2:

    h23=h23+16

if c3==3:

    h33=h33+8

if d3==4:

    h43=h43+8

if e3==5:

    h53=h53+4

if f3==6:

    h63=h63+4

if g3==7:

    h73=h73+2

if o3==8:

    h83=h83+2

if j3==9:

    h93=h93+1

if k3==10:

    h103=h103+1

 

 

 

if system3=="A":

    r13=v13+v23+v33+v43+v53+1

    r23=v63+v73+v83+v93+v103+1

elif system3=="H":

    r33=h23+h43+h63+h83+h103+1

    r43=h13+h33+h53+h73+h93+1

 

if system3=="A":

    print "3.",r13,"/",r23

elif system3=="H":

    print "3.",r33,"/",r43

 

######################################################################3

 

 

system4=podatki4[0]

 

x4=len(podatki4)

 

del podatki4[x4-1]

del podatki4[0]

 

y4=len(podatki4)

 

a4=0

b4=0

c4=0

d4=0

e4=0

f4=0

g4=0

o4=0

j4=0

k4=0

 

for i in range(y4):

    if podatki4[i-1]=="1":

        a4=a4+1

for i in range(y4):

    if podatki4[i-1]=="2":

        b4=b4+2

for i in range(y4):

    if podatki4[i-1]=="3":

        c4=c4+3

for i in range(y4):

    if podatki4[i-1]=="4":

        d4=d4+4

for i in range(y4):

    if podatki4[i-1]=="5":

        e4=e4+5

for i in range(y4):

    if podatki4[i-1]=="6":

        f4=f4+6

for i in range(y4):

    if podatki4[i-1]=="7":

        g4=g4+7

for i in range(y4):

    if podatki4[i-1]=="8":

        o4=o4+8

for i in range(y4):

    if podatki4[i-1]=="9":

        j4=j4+9

for i in range(y4):

    if podatki4[i-1]=="10":

        k4=k4+10

 

 

v14=0

v24=0

v34=0

v44=0

v54=0

v64=0

v74=0

v84=0

v94=0

v104=0

h14=0

h24=0

h34=0

h44=0

h54=0

h64=0

h74=0

h84=0

h94=0

h104=0

 

 

if a4==1:

    v14=v14+16

if b4==2:

    v24=v24+8

if c4==3:

    v34=v34+4

if d4==4:

    v44=v44+2

if e4==5:

    v54=v54+1

if f4==6:

    v64=v64+16

if g4==7:

    v74=v74+8

if o4==8:

    v84=v84+4

if j4==9:

    v94=v94+2

if k4==10:

    v104=v104+1

 

 

if a4==1:

    h14=h14+16

if b4==2:

    h24=h24+16

if c4==3:

    h34=h34+8

if d4==4:

    h44=h44+8

if e4==5:

    h54=h54+4

if f4==6:

    h64=h64+4

if g4==7:

    h74=h74+2

if o4==8:

    h84=h84+2

if j4==9:

    h94=h94+1

if k4==10:

    h104=h104+1

 

 

if system4=="A":

    r14=v14+v24+v34+v44+v54+1

    r24=v64+v74+v84+v94+v104+1

elif system4=="H":

    r34=h24+h44+h64+h84+h104+1

    r44=h14+h34+h54+h74+h94+1

 

if system4=="A":

    print "4.",r14,"/",r24

elif system4=="H":

    print "4.",r34,"/",r44

 

#################################################################################

 

system5=podatki5[0]

 

x5=len(podatki5)

 

del podatki5[x5-1]

del podatki5[0]

 

y5=len(podatki5)

 

a5=0

b5=0

c5=0

d5=0

e5=0

f5=0

g5=0

o5=0

j5=0

k5=0

 

for i in range(y5):

    if podatki5[i-1]=="1":

        a5=a5+1

for i in range(y5):

    if podatki5[i-1]=="2":

        b5=b5+2

for i in range(y5):

    if podatki5[i-1]=="3":

        c5=c5+3

for i in range(y5):

    if podatki5[i-1]=="4":

        d5=d5+4

for i in range(y5):

    if podatki5[i-1]=="5":

        e5=e5+5

for i in range(y5):

    if podatki5[i-1]=="6":

        f5=f5+6

for i in range(y5):

    if podatki5[i-1]=="7":

        g5=g5+7

for i in range(y5):

    if podatki5[i-1]=="8":

        o5=o5+8

for i in range(y5):

    if podatki5[i-1]=="9":

        j5=j5+9

for i in range(y5):

    if podatki5[i-1]=="10":

        k5=k5+10

 

 

v15=0

v25=0

v35=0

v45=0

v55=0

v65=0

v75=0

v85=0

v95=0

v105=0

h15=0

h25=0

h35=0

h45=0

h55=0

h65=0

h75=0

h85=0

h95=0

h105=0

 

 

if a5==1:

    v15=v15+16

if b5==2:

    v25=v25+8

if c5==3:

    v35=v35+4

if d5==4:

    v45=v45+2

if e5==5:

    v55=v55+1

if f5==6:

    v65=v65+16

if g5==7:

    v75=v75+8

if o5==8:

    v85=v85+4

if j5==9:

    v95=v95+2

if k5==10:

    v105=v105+1

 

if a5==1:

    h15=h15+16

if b5==2:

    h25=h25+16

if c5==3:

    h35=h35+8

if d5==4:

    h45=h45+8

if e5==5:

    h55=h55+4

if f5==6:

    h65=h65+4

if g5==7:

    h75=h75+2

if o5==8:

    h85=h85+2

if j5==9:

    h95=h95+1

if k5==10:

    h105=h105+1

 

 

if system5=="A":

    r15=v15+v25+v35+v45+v55+1

    r25=v65+v75+v85+v95+v105+1

elif system5=="H":

    r35=h25+h45+h65+h85+h105+1

    r45=h15+h35+h55+h75+h95+1

 

if system5=="A":

    print "5.",r15,"/",r25

elif system5=="H":

    print "5.",r35,"/",r45