Time limit
2s
Memory limit
256 MB
Two positive integers A and B are given. In decimal notation, every digit of each number is 1. Write a program that prints the greatest common divisor of A and B.
The first line contains two positive integers N and M, separated by a space. N is the number of 1 digits in A, and M is the number of 1 digits in B.
Both N and M are less than 2^63.
Print the greatest common divisor of A and B on the first line.
The answer has no more than 10,000,000 digits.