#!/usr/bin/perl -w

use v5.30;
use strict;

my @pts = map { [ /(\d+)/g ] } <>;

my ($minx, $miny, $maxx, $maxy);
for my $pt (@pts) {
	$minx = $pt->[0] if !defined $minx || $minx > $pt->[0];
	$maxx = $pt->[0] if !defined $maxx || $maxx < $pt->[0];
	$miny = $pt->[1] if !defined $miny || $miny > $pt->[1];
	$maxy = $pt->[1] if !defined $maxy || $maxy < $pt->[1];
}

my $count;
for my $x ($minx .. $maxx) {
for my $y ($miny .. $maxy) {
	my $dist;
	for my $i (0 .. $#pts) {
		my $pt = $pts[$i];
		$dist += abs($x-$pt->[0]) + abs($y-$pt->[1]);
	}
	$count++ if $dist < 10000;
} }

say $count;
