# puts i

k = gets.chomp.to_i
i = 1
a = 7 % k
h = a
if k != 7
    until a == 0 
        a = (7 + a * 10) % k
        if a == h || i == k
            puts "-1"
            exit
        end
        i += 1
    end
else
    puts "1"
    exit
end
puts i