import java.util.Scanner; public class Main{ public static void main(String[] args)throws Exception{ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int a1=sc.nextInt(); int a2=sc.nextInt(); int a3=sc.nextInt(); int max=Math.max(a1, a2); max=Math.max(max, a3); int count=0; for(int i=1001;i>=1;i--){ if(judge(a1,a2,a3,i)){ if(i==1001){ System.out.println("INF"); return; } count++; } } System.out.println(count); } //カラマツか判断 boolean judge(int a1,int a2,int a3,int p){ a1%=p; a2%=p; a3%=p; if(!(a1!=a2&&a2!=a3&&a3!=a1))return false; if(a1>a2&&a2>a3)return false; if(a1