Module Module1
  Sub main()
    Dim N = Console.ReadLine()
    If N Mod 2 = 0 Or N Mod 5 = 0 Then
      Console.WriteLine("-1")
    Else
      Dim num as Integer = 0
      Dim m as Integer = 0
      Do
        num = num + 1
        m = (m * (10 Mod N) + (7 Mod N)) Mod N
      Loop While(m <> 0)

      Console.WriteLine(num)
     End If
  End Sub
End Module