#include using namespace std; using ll = long long; int cnt[4000005]; int main(){ int a, b, c; cin >> a >> b >> c; if(gcd(a,gcd(b,c))>1){ cout << "INF" << endl; return 0; } int n = 1; if(gcd(a,b)==1){ n = a*b; }else if(gcd(b,c)==1){ n = b*c; }else{ n = c*a; } for(int i = 0; i <= n/a; i++){ for(int j = 0; j <= (n-i*a)/b; j++){ for(int k = 0; k <= (n-i*a-j*b)/c; k++){ cnt[i*a+j*b+k*c]++; } } } int ans = 0; for(int i = 1; i < n; i++){ if(cnt[i]==0) ans++; } cout << ans << endl; return 0; }