**Description:**

Some phone usage rate may be described as follows:

- first minute of a talk costs
`min1`

cents, - each minute from the 2nd up to 10th (inclusive) costs
`min2_10`

cents - each minute after 10th costs
`min11`

cents.

You have `S`

cents on your account before the call. What is the duration of the longest call (in minutes rounded down to the nearest integer) you can have?

**Example**

For `min1 = 3`

, `min2_10 = 1`

, `min11 = 2`

and `S = 20`

, the output should be

`phoneCall(min1, min2_10, min11, S) = 14`

.

Here’s why:

- the first minute costs
`3`

cents, which leaves you with`20 - 3 = 17`

cents; - the total cost of minutes
`2`

through`10`

is`1 * 9 = 9`

, so you can talk`9`

more minutes and still have`17 - 9 = 8`

cents; - each next minute costs
`2`

cents, which means that you can talk`8 / 2 = 4`

more minutes.

Thus, the longest call you can make is `1 + 9 + 4 = 14`

minutes long.

**Input/Output**

**[time limit] 3000ms (cs)**

**[input] integer min1***Constraints:*

`1 ≤ min1 ≤ 10`

.**[input] integer min2_10***Constraints:*

`1 ≤ min2_10 ≤ 10`

.**[input] integer min11***Constraints:*

`1 ≤ min11 ≤ 10`

.**[input] integer S***Constraints:*

`2 ≤ S ≤ 60`

.**[output] integer**

**Tests:**

- Test1
Input:
**min1:**3**min2_10:**1**min11:**2**S:**20Expected Output:14

- Test2
Input:
**min1:**2**min2_10:**2**min11:**1**S:**2Expected Output:1

- Test3
Input:
**min1:**10**min2_10:**1**min11:**2**S:**22Expected Output:11

- Test4
Input:
**min1:**2**min2_10:**2**min11:**1**S:**24Expected Output:14

- Test5
Input:
**min1:**1**min2_10:**2**min11:**1**S:**6Expected Output:3

**Solution(C#):**

int phoneCall(int min1, int min2_10, int min11, int S) { if(min1 >= 1 && min1 <= 10 && min2_10 >= 1 && min2_10 <= 10 && min11 >= 1 && min11 <= 10 && S >= 2 && S <= 60){ int t1 = S/min1; if(t1>1){ int t2 = (S - min1)/min2_10; if(t2>=9){ return 10+(S - min1 - 9*min2_10)/min11; }else{ return 1+t2; } } else{ return t1; } return S-min1-min2_10-min11; }else{ throw new ArgumentOutOfRangeException(); } }