Module Program
    Sub Main(args As String())
        Dim K = Integer.Parse(Console.ReadLine())

        Dim x = 0
        For i = 1 To K
            x *= 10
            x += 7
            x = x Mod K
            If x = 0 Then
                Console.WriteLine(i)
                Return
            End If
        Next

        Console.WriteLine(-1)
    End Sub
End Module