#! /usr/bin/perl
# Start: Sat Sep  6 13:44:15 EDT 1997
# End: Sat Sep  6 13:50:27 EDT 1997
# End debug: Sat Sep  6 13:59:13 EDT 1997

%prov = (sprintf("%20d",0),"yes");  # All sums in prov side.
%mun = (sprintf("%20d",0),"yes");  # All sums in mun side.

while($line=<>) {
	if ( $line =~ m/^\s*([A-Z])[a-zA-Z]*\s+(\d+)/ ) {
		# Municipal
		$value = $2;
		@l = sort keys(%mun);
		foreach $i (@l) { $mun{sprintf("%20d",$i+$value)} = "yes"; }
	} elsif ( $line =~ m/^\s*([a-z])[a-zA-Z]*\s+(\d+)/ ) {
		# Provincial
		$value = $2;
		@l = sort keys(%prov);
		foreach $i (@l) { $prov{sprintf("%20d",$i+$value)} = "yes"; }
	}
}

print "Mun: \n";
foreach $i ( sort keys(%mun) ) { print "$i\n "; }
print "\n\nProv: \n";
foreach $i ( sort keys(%prov) ) { print "$i\n "; }
print "\n";

# Now see which is max.
foreach $i (sort keys(%mun)) {
	if ( $prov{$i} eq "yes" ) { $highest=$i; }
}
$highest=$highest+0; # strip leading spaces.
print "$highest\n";
