## Problem: GCD and Fibonacci Numbers

You will be given two positive numbers M and N. Your task is to print the greatest common divisor of Fib(M) and Fib(N) where Fib(x) means the xth Fibonacci numbers defined as:

Fib(0) = 0

Fib(1) = 1

for n > 1, Fib(n) = Fib(n-1) + Fib(n-2)

Input:

The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consists of exactly one line. This line consists of two space separated positive integers N and M.

Output:

Corresponding to each test case, in a new line, print the value of gcd( Fib(M), Fib(N) ) modulo 100.

Constraints:

1 ≤ T ≤ 1000

1 ≤ M, N ≤ 1000

Example:

Input

2

3 6

7 8

Output

2

1

Explanation:

Fib(3) = 2 and Fib(6) = 8

GCD(2,8)%100 = 2

Fib(7) = 13 and Fib(8) = 21

GCD(13,21)%100 = 1

def nth_fibo(n): """return the nth fibonacci number""" if n == 0 or n == 1: return n n1, n2 = 0, 1 for _ in range(n): n1, n2 = n2, n1+n2 return n1 def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) if __name__ == '__main__': t = input() for _ in range(t): a, b = map(int, raw_input().split()) print gcd(nth_fibo(a), nth_fibo(b))%100

## Reply