#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; bool bo[4003000] = { false }; long long gcd(long long a, long long b) { if (a % b == 0) { return (b); } else { return (gcd(b, a % b)); } } int main() { int a, b, c; cin >> a >> b >> c; if (gcd(a, gcd(b, c)) != 1) { cout << "INF" << endl; return 0; } bo[0] = true; for (int i = 0; i <= 4000000; i++) { if (bo[i]) { bo[i + a] = true; bo[i + b] = true; bo[i + c] = true; } } int co = 0; for (int i = 0; i <= 4000000; i++) { if (!bo[i]) { co++; } } cout << co << endl; }