QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 128 MB 満点: 100

#4179. SuperGCD

統計

Sheng bill has an amazing ability for mental arithmetic and can even calculate the GCD (Greatest Common Divisor) of two huge numbers in his head! Because of this, he often challenges others to GCD calculation competitions. One day, Sheng bill arrogantly approached you and demanded a competition, but it would be very embarrassing to lose to him! Therefore, you decided to write a program to teach him a lesson.

Input

Two lines:

  • First line: a number $A$.
  • Second line: a number $B$.

Output

One line, representing the greatest common divisor of $A$ and $B$.

Examples

Input 1

12
54

Output 1

6

Subtasks

Test Case $A,B \leq $
$1 \sim 2$ $10^{18}$
$3$ $10^{100}$
$4$ $10^{500}$
$5$ $10^{5\,000}$
$6$ $10^{6\,000}$
$7$ $10^{7\,000}$
$8 \sim 10$ $10^{10\,000}$

For $100\%$ of the data, $1 \leq A,B \leq 10^{10\,000}$.

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.