# -*- coding: utf-8 -*- """ No.358 も~っと!門松列 https://yukicoder.me/problems/no/358 """ import sys from sys import stdin input = stdin.readline def is_kadomatsu(A): if A[0] == A[1] or A[1] == A[2] or A[0] == A[2]: return False if max(A) != A[1] and min(A) != A[1]: return False return True def main(args): ans = 0 A = [int(x) for x in input().split()] if is_kadomatsu(A): print('INF') else: for p in range(1, max(A)+1): B = A[:] B[0] %= p B[1] %= p B[2] %= p if is_kadomatsu(B): ans += 1 print(ans) if __name__ == '__main__': main(sys.argv[1:])