## Problem Description

Damian and Coco the Monkey are preparing themselves for programming contests.

They realise that an important part of preparing for a competition is the sharing of knowledge from experienced seniors to those who just started. Therefore, during the next training session Damian decided to make teams so that juniors are solving problems together with their seniors.

Damian believes that the optimal team (of three people) should consist of one senior and two juniors. This allows for seniors to share their experience with a greater number of people.

On the other hand, Coco the Monkey believes that the optimal team should consist of two seniors and one junior. Thus, each junior can gain more knowledge and experience.

As a result, they decided to compromise. All teams during the training sessions should belong to one of the two types described above. Additionally, they agreed that the total number of teams should be maximised.

There are N seniors and M juniors. Not every person(senior or junior) must be part of a team. Each person can only be part of one team. Can you calculate what is the maximum number of teams that can be formed?

## Input

The first line of input will contain two integers, N and M.

## Output

On a single line output the maximum number of teams that can be formed.

## Limits

Subtask 1 (12%): 1 ≤ N, M ≤ 10

Subtask 2 (42%): 1 ≤ N, M ≤ 500 000

Subtask 3 (46%): 1 ≤ N, M ≤ 1018

Subtask 4 (0%): Sample Testcases

```2 6
```

```2
```

## Sample Output 1 Explanation

There are 2 seniors and 6 juniors. We can form two teams of (senior, junior, junior). This is the maximum.

```4 5
```

```3
```

## Sample Output 2 Explanation

There are 4 seniors and 5 juniors. We can form a total of three teams: two teams of (senior, junior, junior) and one team of (senior, senior, junior). This is the maximum.

## Credits

HCI NOI November Training 2015 Session 4 Problem B