Green Card
To climb, two people are required: one to climb and one to stay on the ground and hold the rope (belay) in case the climber falls. To belay, one must have a green card. However, one does not need a green card to climb.
Climbing a wall, including tying the rope to the harness and everything around it, takes exactly $10$ minutes. There are many climbing walls available, so any number of people can climb simultaneously (but they must be belayed by different people).
A group of friends consists of $N$ people with green cards and $M$ people without green cards. How many minutes will it take at a minimum before everyone has had a chance to climb once?
Input
The first line contains an integer $N$ ($2 \le N \le 400,000,000$), the number of people with a green card.
The second line contains an integer $M$ ($0 \le M \le 400,000,000$), the number of people without a green card.
Output
Print: the minimum number of minutes required before all $N + M$ people have had a chance to climb.
Scoring
Your solution will be tested on a set of test groups, each worth a number of points. Each test group contains a set of test cases. To get the points for a test group you need to solve all test cases in the test group.
|
Group |
Points |
Constraints |
|
$1$ |
$20$ |
$M = 0$ |
|
$2$ |
$20$ |
$N = 2$ |
|
$3$ |
$40$ |
$M, N \le 100$ |
|
$4$ |
$20$ |
No additional constraints. |
Explanation of Examples
In the first example, there are two people, both with green cards. One person belays while the other climbs, and then they can switch roles. In total, it takes $20$ minutes for both people to have climbed.
In the second example, there are four people, two of whom have green cards. The two people with green cards can both climb during the first $20$ minutes (as in the first example). Then, the two people without green cards can climb simultaneously. Thus, it takes a total of $30$ minutes for everyone to have climbed.
In the third example, there are six people, three of whom have green cards. One way to achieve climbing in $30$ minutes is to have always two people climbing at the same time, one with a green card and one without.
| Sample Input 1 | Sample Output 1 |
|---|---|
2 0 |
20 |
| Sample Input 2 | Sample Output 2 |
|---|---|
2 2 |
30 |
| Sample Input 3 | Sample Output 3 |
|---|---|
3 3 |
30 |