
k = gets.chomp.to_i

x = 7
count = 1
a = []
b = []
a[0]=7
b[0]=0

if(k<7)
puts "-1"
exit
end

(2..k).each{|i|
  (2..i).each{|j|
    b[j-1]=70*(10**(j-2))
  }
  a[i-1] = a[0] + b.sum
  if(a[i-1] % k == 0)
    puts count+1
    exit
  else
    count += 1
  end
  }