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