#!/usr/bin/perl -w

use v5.36;
use strict;
use experimental 'multidimensional';

my $sum;
while (<>) {
	chomp;
	substr($_, length()/2, 0) = ' ';
	my ($c) = /(.)\S*\s\S*\1/;
	$sum += $c =~ /[A-Z]/
		? ord($c) - ord('A') + 27
		: ord($c) - ord('a') + 1; 
}
say $sum;
