//#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int a,b,c; cin >> a >> b >> c; if(__gcd(a,b)!=1 and __gcd(b,c)!=1 and __gcd(c,a)!=1 and __gcd(__gcd(a,b),c)!=1){ printf("INF\n"); } else{ const int N=10000000; vector<bool> dp(N,false); dp[a]=true; dp[b]=true; dp[c]=true; int res=0; for(int i=1;i<N;i++){ if(!dp[i]){ res++; continue; } if(i+a<N){ dp[i+a]=true; } if(i+b<N){ dp[i+b]=true; } if(i+c<N){ dp[i+c]=true; } } printf("%d\n",res); } }