a,b,c=map(int,input().split()) M=max(a,b,c) B=lambda x:[a%x,b%x,c%x] z=[(0,(0,(1,-1)[p>M])[B(p)[1]==max(B(p))or B(p)[1]==min(B(p))])[len(set(B(p)))==3]for p in range(1,M+9)] print((sum(z),'INF')[-1 in z])