#!/usr/bin/perl -w

use v5.16;

my $sum;
while (<>) {
	while (1) {
		$_ = int($_/3)-2;
		last if $_ <= 0;	
		$sum += $_;
	} 
}
say $sum;
