#!/usr/bin/perl use strict; use warnings; my ($x, $y, $d) = split / /, <>; my $count = 0; for(my $i = 0; $i <= $x; $i++) { for(my $j = 0; $j <= $y; $j++) { if($i + $j == $d) { $count++; } } } print "$count\n"; exit;