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