func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    let K = readInt()

    var previous = 0
    for i in 1...15 {
        let number = previous + 7 * Int(pow(10.0, Double(i-1)))
        if number.isMultiple(of: K) {
            print(i)
            return
        }

        previous = number
    }

    print(-1)
}
mainC()