using System; using System.Linq; class C { static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); static void Main() => Console.WriteLine(Solve()); static object Solve() { var a = Read(); Array.Sort(a); //if (a.Any(x => x == 1)) return 0; if (Gcd(Gcd(a[0], a[1]), a[2]) > 1) return "INF"; var u = new bool[a[0] * a[1]]; for (int k = 0; k < a[0]; k++) for (int i = k * a[1]; i < u.Length; i += a[0]) u[i] = true; for (int i = 0; i < u.Length; i += a[2]) u[i] = true; for (int i = a[0]; i < u.Length; i++) { if (u[i]) continue; for (int j = 1; j < i; j++) { if (u[j] && u[i - j]) { u[i] = true; break; } } } return u.Count(x => !x); } static int Gcd(int a, int b) { for (int r; (r = a % b) > 0; a = b, b = r) ; return b; } }