#!/usr/bin/env perl
use strict;
use warnings;

my $s = 0;
while (<ARGV>) {
    $_ =~ /(\d)/;
    my $first = $1;
    $_ =~ /.*(\d)/;
    my $last = $1;
    $s += ($first . $last);
}

print("$s\n");
