# 【思维+暴力】Block Towers

Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks.

The students don’t want to use too many blocks, but they also want to be unique, so no two students’ towers may contain the same number of blocks. Find the minimum height necessary for the tallest of the students' towers.

Input

The first line of the input contains two space-separated integers n and m (0 ≤ n, m ≤ 1 000 000n + m > 0) — the number of students using two-block pieces and the number of students using three-block pieces, respectively.

Output

Print a single integer, denoting the minimum possible height of the tallest tower.

Examples

Input
`1 3`
Output
`9`
Input
`3 2`
Output
`8`
Input
`5 0`
Output
`10`

Note

In the first case, the student using two-block pieces can make a tower of height 4, and the students using three-block pieces can make towers of height 36, and 9blocks. The tallest tower has a height of 9 blocks.

In the second case, the students can make towers of heights 24, and 8 with two-block pieces and towers of heights 3 and 6 with three-block pieces, for a maximum height of 8 blocks.

1.n个学生以两块砖头为一个单元叠砖，m个学生以3块砖头为一个单元叠砖）
2.n + m个学生使用的砖块总数没有相同的（高度各不相同）
3.找到某一种叠法，求所有n + m个学生叠的砖块最高高度的最小值。
//warning：以下分析与网上不一样，可能是错的，但是能AC

```2 4 6 8 10
3 6 9 12 15```

```2N<=MAX
3M<=MAX(只有一个等于号成立)```

```MAX/2 >= N   ①
MAX/3 >=M    ②```

```#include <iostream>
using namespace std;
int main()
{
int a, b, i = 1;
cin >> a >> b;
while (i++)
{
if (i / 2 >= a)
if (i / 3 >= b)
if (i / 2 + i / 3 - i / 6 >= a + b)
{
cout << i << endl;
break;
}
}
return 0;
}```

```#include <iostream>
using namespace std;
int main()
{
int a, b, i = 1;cin >> a >> b;
while (i++) if (i / 2 >= a && i / 3 >= b && i / 2 + i / 3 - i / 6 >= a + b) { cout << i << endl; break; }return 0;
}```