import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A = list(map(int,read().split())) def is_kadomatsu(B): if len(set(B)) != 3: return False if B[0]B[1]>B[2]: return False return True if is_kadomatsu(A): print('INF') exit() answer = 0 for p in range(1,1001): B = [x%p for x in A] if is_kadomatsu(B): answer += 1 print(answer)