#!/usr/bin/perl -w

use v5.30;
use strict;

my %map;
while (<>) {
	chomp;
	my ($id, $x, $y, $w, $h) = /(\d+)/g;
	for my $dx (0 .. $w-1) {
		for my $dy (0 .. $h-1) {
			$map{$x+$dx,$y+$dy}++;
		}
	}
}

my $sum;
for my $k (keys %map) {
	$sum++ if $map{$k} > 1;
}
say $sum;
