import Foundation
let K = Int(readLine()!)!

var value = 7
var result = -1
for i in 0..<Int(pow(10.0, 9.0)) {
    if value % K == 0 {
        result = i+1
        break
    }
    value = value * 10 + 7
}

print(result)
