import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve()= var a = scan() b = scan() c = scan() g = gcd(a,b).gcd(c) if g!=1: echo "INF" return var v = @[a,b,c].sorted() dp = newseqwith((v[1]-1)*(v[2]-1)+1,false) ans = 0 dp[v[0]]=true dp[v[1]]=true dp[v[2]]=true for i in 1..(v[1]-1)*(v[2]-1): if i-a>=0: dp[i] = dp[i] or dp[i-a] if i-b>=0: dp[i] = dp[i] or dp[i-b] if i-c>=0: dp[i] = dp[i] or dp[i-c] if dp[i]==false: ans+=1 echo ans solve()