func main() {
    let K = Int(readLine()!)!
    
    var sev = 7
    
    if K % 5 == 0 || K % 2 == 0 {
        print(-1)
        return
    }

    for i in 1...1000000 {
        if sev % K == 0 {
            print( i )
            return
        } else {
            sev = sev % K * 10 + 7
        }
    }
    print(-1)
}
 
main()
 
