def main():
    k = int(input())
    if k & 0:
        print(-1)
        return

    r = 7 % k
    l = 0
    while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

    print([l+1, -1][l == k])


if __name__ == '__main__':
    main() def main():
    k = int(input())
    if k & 0:
        print(-1)
        return

    r = 7 % k
    l = 0
    while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

    print([l+1, -1][l == k]) main k = int(input()) k int(input()) int input() input if k & 0:
        print(-1)
        return

     k & 0 k 0 print(-1) print -1 return r = 7 % k r 7 % k 7 k l = 0 l 0 while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

     r and l < k r l < k l k r = (r * 10 + 7) % k r (r * 10 + 7) % k r * 10 + 7 r * 10 r 10 7 k l += 1 l 1 print([l+1, -1][l == k]) print [l+1, -1][l == k] [l+1, -1] l+1 l 1 -1 l == k l k if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    k = int(input())
    if k & 0:
        print(-1)
        return

    r = 7 % k
    l = 0
    while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

    print([l+1, -1][l == k]) def main():
    k = int(input())
    if k & 0:
        print(-1)
        return

    r = 7 % k
    l = 0
    while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

    print([l+1, -1][l == k]) main
def main():
    k = int(input())
    if k & 0:
        print(-1)
        return

    r = 7 % k
    l = 0
    while r and l < k:
        r = (r * 10 + 7) % k
        l += 1

    print([l+1, -1][l == k])


if __name__ == '__main__':
    main()
