m=map
c[a,b,c]=a#b#c!!0
f#s=filter(`elem`s)f
p i|i>90=i-96|let=i-38
s[]=[];s(a:b:c:d)=[a,b,c]:s d
d l|(f,s)<-splitAt(length l`div`2)l=f#s!!0
main=interact$show.((,).(sum.m d)<*>sum.m c.s).m(m$p.fromEnum).lines
