HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


GCD of ones

Volume problems

• Reverse permutation
• Nameplates
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Cities and roads
• Cycle detection
• Diameter of graph
• Divisors count
• GCD of ones
• Prime numbers
• Set cover problem
• Shopping
• Corridor
• Divisors

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

Given two natural numbers. First of them A consists of exactly N ones, second B of exactly M ones. Find their greatest common divisor.

Input

There are two integers N and M on the first line (0 < N, M ≤ 2000).

Output

Write greatest common divisor of A = 11...1 (N times) and B = 11...1 (M times).

Example

stdin stdout

1 1

1

1 2 1
Для отправки решений необходимо выполнить вход.

www.contester.ru