#!/usr/bin/env python3 lines = (x.strip() for x in open("input.txt")) s = 0 for line in lines: a = set(line[:len(line)//2]) b = set(line[len(line)//2:]) i = a.intersection(b) o = ord(i.pop()) s += o-0x60 if o > 0x60 else o-38 print(s)