def solve(string):
    k = int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    n = 7
    ans = 1
    while n % k:
        n = (10 * n + 7) % k
        ans += 1
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip())) def solve(string):
    k = int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    n = 7
    ans = 1
    while n % k:
        n = (10 * n + 7) % k
        ans += 1
    return str(ans) solve k = int(string) k int(string) int string if k % 2 == 0 or k % 5 == 0:
        return "-1"
     k % 2 == 0 or k % 5 == 0 k % 2 == 0 k % 2 k 2 0 k % 5 == 0 k % 5 k 5 0 return "-1" "-1" n = 7 n 7 ans = 1 ans 1 while n % k:
        n = (10 * n + 7) % k
        ans += 1
     n % k n k n = (10 * n + 7) % k n (10 * n + 7) % k 10 * n + 7 10 * n 10 n 7 k ans += 1 ans 1 return str(ans) str(ans) str ans string string if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip())) __name__ == '__main__' __name__ '__main__' import sys sys print(solve(sys.stdin.read().strip())) print solve(sys.stdin.read().strip()) solve sys.stdin.read().strip() sys.stdin.read().strip sys.stdin.read() sys.stdin.read sys.stdin sys stdin read strip def solve(string):
    k = int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    n = 7
    ans = 1
    while n % k:
        n = (10 * n + 7) % k
        ans += 1
    return str(ans) def solve(string):
    k = int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    n = 7
    ans = 1
    while n % k:
        n = (10 * n + 7) % k
        ans += 1
    return str(ans) solve
def solve(string):
    k = int(string)
    if k % 2 == 0 or k % 5 == 0:
        return "-1"
    n = 7
    ans = 1
    while n % k:
        n = (10 * n + 7) % k
        ans += 1
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
