import sys def p(c): o = ord(c) if o > 96: return o-96 else: return o-64+26 def gen(): for _ in range(100): g1 = next(sys.stdin)[:-1] g2 = next(sys.stdin)[:-1] g3 = next(sys.stdin)[:-1] b = set(g1) & set(g2) & set(g3) yield list(b)[0] print(sum(p(c) for c in gen()))