Killjee and shop

0

0 votes
Easy
Problem

Killjee has X balloons, he is going to his class from his hostel. There are Y shops between Killjee's class and hostel. The faculty has asked Killjee to bring exactly Z balloons. 

In each shop killjee can sell a balloon, buy a balloon or do nothing. You need to find highest number of balloons killjee can have at any moment during his journey from hostel to class.

 

INPUT

Input contains 3 integers. X, Y and Z.

 

OUTPUT

Print answer to the given problem

 

CONSTRAINTS

1X,Y,Z109

Sample Input
5 7 8
Sample Output
10
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

He can buy 1 balloon in first four shop then sell 1 balloon in next 2 shop.

Editor Image

?