#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int L=1e8;
bitset<L>dp;
long A,B,C;
main()
{
	cin>>A>>B>>C;
	if(A>B)swap(A,B);
	if(B>C)swap(B,C);
	if(A>B)swap(A,B);
	int g=gcd(A,gcd(B,C));
	if(g>1)
	{
		cout<<"INF"<<endl;
		return 0;
	}
	dp[0]=1;
	for(int i=0;A<<i<L;i++)dp|=dp<<(A<<i);
	for(int i=0;B<<i<L;i++)dp|=dp<<(B<<i);
	for(int i=0;C<<i<L;i++)dp|=dp<<(C<<i);
	cout<<(~dp).count()<<endl;
}