for(;h=readline().split(",");){ t=0 for(e in h)[f,i]=h[e].split("'"),t+=f*12,t+=+i a=t/h.length+.9|0 print((a/12|0)+"'"+(a%12))}