#!/usr/bin/perl -w

use strict;

my @nums = sort { $a <=> $b } <>;
chomp @nums;

my %is_listed = map { $_ => 1 } @nums;

for my $i (0 .. $#nums-1) {
	for my $j ($i .. $#nums) {
		my $rest = 2020-$nums[$i]-$nums[$j];
		if ($rest > 0 && $is_listed{$rest} && $rest != $nums[$i]
			&& $rest != $nums[$j]) {
			print "$nums[$i]*$nums[$j]*$rest=", $nums[$i]*$nums[$j]*$rest, "\n";
			last;
		}
	}
}

