total = 0
for string in input().split(","):
    val = 0
    for s in string:
        val = (val + ord(s)) * 17 % 256
    total += val
print(total)