#!/usr/athena/bin/perl

$start = 200;
$breakstart = 1750;
#$breakstart = 1550;
$breakend = 2033;
#$breakend = 1800;
$short = 6;
$long = 15;
while(<>){
	$ct++;
	split;
	shift(@_);
	shift(@_);
	shift(@_);

	push(@sh, $_[0]);
	push(@st, $_[1]);
	push(@ss, $_[2]);
	push(@sv, $_[3]);
	push(@lh, $_[0]);
	push(@lt, $_[1]);
	push(@ls, $_[2]);
	push(@lv, $_[3]);

	shift @sh if ($#sh > $short);
	shift @st if ($#st > $short);
	shift @ss if ($#ss > $short);
	shift @sv if ($#sv > $short);

	shift @lh if ($#lh > $long);
	shift @lt if ($#lt > $long);
	shift @ls if ($#ls > $long);
	shift @lv if ($#lv > $long);

	$x = join(" ", @_);
	$type = 1;

	$sh = $sh[0];
	$st = $st[0];
	$ss = $ss[0];
	$sv = $sv[0];
	$lh = $lh[0];
	$lt = $lt[0];
	$ls = $ls[0];
	$lv = $lv[0];

	if($type == 2){
		print "$x $sh $st $ss $sv $lh $lt $ls $lv $type\n";
	}	
	print "$x $sh $st $ss $sv $lh $lt $ls $lv $type\n";
}
sub avg {
    @x = @_;
    local($ct);		
    $ct=0;
    $tot=0;
    for $x (@x){
	$tot += $x;
	$ct++;
    }
    ($tot/$ct);
}
