def isok(a) return false if a[0]==a[2] return (a[1]a[0]&&a[1]>a[2]) end a=gets.split.map(&:to_i) if a[1]==1 && isok(a) puts :INF else p (1..100000).count{|i|isok(a.map{|e|e%i})} end