QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#6244. Barareh Cinema

Estadísticas

The Khans of Barareh have always tried to keep the people away from technology. However, due to public dissatisfaction, they finally decided to build a cinema in Upper Barareh. Due to the deep-rooted differences between Upper Barareh and Lower Barareh, it was decided that movies would be screened separately for both groups.

The populations of Lower Barareh and Upper Barareh have always been equal, but after the recent Barareh war, the population of Upper Barareh is $a$ and the population of Lower Barareh is $b$, and all residents are interested in watching movies at the cinema. Given Shir-Farhad's family relationship with the residents of Upper and Lower Barareh, the cinema construction project has been entrusted to him. Since Shir-Farhad lacks the necessary competence for this task, his awakened conscience asks him to appoint Kianoush, the family's son-in-law, to this task.

The capacity of the cinema hall has not yet been determined, but we want to set it to a number like $c$. The Supreme Council of Barareh Order, in order to obstruct Kianoush's path toward modernization, has issued policies for the hall's capacity. In each screening, at most $c$ people can be inside the hall. Also, the total number of screenings must be the minimum possible. Furthermore, for each group, at least one screening must be completely full. Predictions indicate that the residents will come to the cinema and keep the tradition of queuing alive. On the other hand, due to the recent war, the larger group, fearing the "Hasht-baloo" (a local term for chaos/trouble), is not willing to have a smaller number of people in the queue than the smaller group.

Input

The first line of input contains two numbers $a$ and $b$, representing the population of Upper Barareh and Lower Barareh, respectively.

Output

Print the value $c$, which is the capacity of the cinema hall under the mentioned conditions, in a single line.

Constraints

$1 \le a, b \le 10^{18}$

Examples

Input 1

6 12

Output 1

6

Input 2

12 8

Output 2

8

Input 3

15 15

Output 3

15

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.