#!/usr/bin/perl -w

use strict;

my @prev;
my $len = 25;

while (my $num = <>) {
	chomp $num;
	if (@prev >= $len) {
		shift @prev if @prev > $len;
		for my $i (0 .. $len-2) {
			for my $j ($i+1 .. $len-1) {
				if ($prev[$i]+$prev[$j] == $num) {
					goto FOUND;
				}
			}
		}
		print "$num is not a sum of ", join(', ', @prev), "\n";
		exit 0;
	FOUND:
	}
	push @prev, $num;
}

