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