401917: GYM100574 D Valentine's Cake

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Valentine's Caketime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

Rasta has bought a cake for valentine's day. He knows that his love, Rosita loves number a and he, himself loves number b. So he want to cut the cake into c pieces where c is the greatest number that a and b are both multiplies of c .

Your task is to write a program with language DIT, and storages a b 0 0 calculates number c and put it in storage number 1 (the other storages don't matter).

Your program's order mustn't exceed 2 * 107 .

Input

The numbers in the storages are a b 0 0 in order.

1 ≤ a, b ≤ 105

Output

c should be in the first storage.

ExamplesInput
1 5 0 0
Output
1
Input
6 8 0 0
Output
2

加入题单

上一题 下一题 算法标签: