#!/usr/bin/perl6
# your code goes here
react { 
	whenever $*IN.lines.Supply { 
		my Int $a = 0; 
		my @x = .comb>>.Int; 
		
		for @x[0..(*-1)/2] Z, @x[*/2..*-1] {
			$a += .[0] * 2 if .[0] == .[1]; 
		}; 
		say $a; 
	}
}