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 dp = newseqwith((a-1)*(b-1)+1,false) ans = 0 if a<=(a-1)*(b-1): dp[a]=true if b<=(a-1)*(b-1): dp[b]=true if c<=(a-1)*(b-1): dp[c]=true for i in 1..(a-1)*(b-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()