#include using namespace std; int gcd(int a, int b){ if (b == 0){ return a; } else { return gcd(b, a % b); } } int main(){ int A, B, C; cin >> A >> B >> C; int g = gcd(A, gcd(B, C)); if (g > 1){ cout << "INF" << endl; } else { vector X = {A, B, C}; vector dp(4000001, false); dp[0] = true; for (int i = 0; i < 3; i++){ for (int j = 0; j <= 4000000 - X[i]; j++){ if (dp[j]){ dp[j + X[i]] = true; } } } int ans = 0; for (int i = 0; i <= 4000000; i++){ if (!dp[i]){ ans++; } } cout << ans << endl; } }