a=gets.to_i 8.upto(100){|i|break(puts(i)) if a%i==7}&&p(-1)