#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; ll gcd(ll a, ll b){return (b==0?a:gcd(b,a%b));} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} bool dp[10000005]; int main(){ ll A, B, C; cin >> A >> B >> C; if(gcd(A,B) != 1 && gcd(B,C) != 1 && gcd(A,C) != 1 && gcd(gcd(A,B), C) != 1){ cout << "INF" << endl; return 0; } dp[0] = true; rep(i,10000005){ if(!dp[i]) continue; if(i+A<10000005) dp[i+A] = true; if(i+B<10000005) dp[i+B] = true; if(i+C<10000005) dp[i+C] = true; } int ret = 0; for(int i=10000004; i>0; i--){ if(!dp[i]) ret++; } cout << ret << endl; return 0; }