AtCoder Grand Contest 030
A
Poisonous Cookies
AtCoder
⌀ 0
原题
←B →
翻译中…

Problem Statement

翻译中…

Takahashi has $A$ untasty cookies containing antidotes, $B$ tasty cookies containing antidotes and $C$ tasty cookies containing poison.

翻译中…

Eating a cookie containing poison results in a stomachache, and eating a cookie containing poison while having a stomachache results in a death. As he wants to live, he cannot eat one in such a situation. Eating a cookie containing antidotes while having a stomachache cures it, and there is no other way to cure stomachaches.

翻译中…

Find the maximum number of tasty cookies that Takahashi can eat.

翻译中…

Constraints

翻译中…
  • $0 \leq A,B,C \leq 10^9$
  • $A,B$ and $C$ are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

A B C

翻译中…

Output

翻译中…

Print the maximum number of tasty cookies that Takahashi can eat.

翻译中…

样例

Input #1
3 1 4
Output #1
5
We can eat all tasty cookies, in the following order: - A tasty cookie containing poison - An untasty cookie containing antidotes - A tasty cookie containing poison - A tasty cookie containing antidotes - A tasty cookie containing poison - An untasty cookie containing antidotes - A tasty cookie containing poison
Input #2
5 2 9
Output #2
10
Input #3
8 8 1
Output #3
9
题目信息
题号
agc030_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。