CF1214B.Badges

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Badges

There are bb boys and gg girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and nn participants have accepted the invitation. The organizers do not know how many boys and girls are among them.

Organizers are preparing red badges for girls and blue ones for boys.

Vasya prepared n+1n+1 decks of badges. The ii-th (where ii is from 00 to nn, inclusive) deck contains ii blue badges and nin-i red ones. The total number of badges in any deck is exactly nn.

Determine the minimum number of decks among these n+1n+1 that Vasya should take, so that there will be a suitable deck no matter how many girls and boys there will be among the participants of the tournament.

Input

The first line contains an integer bb (1b3001 \le b \le 300), the number of boys.

The second line contains an integer gg (1g3001 \le g \le 300), the number of girls.

The third line contains an integer nn (1nb+g1 \le n \le b + g), the number of the board games tournament participants.

Output

Output the only integer, the minimum number of badge decks that Vasya could take.

Note

In the first example, each of 4 decks should be taken: (0 blue, 3 red), (1 blue, 2 red), (2 blue, 1 red), (3 blue, 0 red).

In the second example, 4 decks should be taken: (2 blue, 3 red), (3 blue, 2 red), (4 blue, 1 red), (5 blue, 0 red). Piles (0 blue, 5 red) and (1 blue, 4 red) can not be used.

Samples

5
6
3
4
5
3
5
4

在线编程 IDE

建议全屏模式获得最佳体验